1.filter үүсгэж байх үед бүх талбарыг автоматаар хамруулах
this.construct = function () {
var settings = arguments; // Allow multiple config objects in constructor call
........................
return this.each(function () {
//adding code
if (settings.filterColumns == null) {
settings.filterColumns = [];
var trs = $(this).find(">tbody>tr");
if ($(trs).size() > 0) {
var tr = $($(trs).get(0));
var l = $(tr).children().size() - 1;
for (var i = 0; i < l; i++) {
settings.filterColumns[i] = i;
}
}
}
//adding code end
.........................
});//this.each end
........................
};//this.construct end
2. filter хийж байх үед тоолох
function doFilter(table) {
..................
// Clear the table
$.tablesorter.clearTableBody(table);
// Push all rows which matched the search string onto the table for display. var resultRowsCount = resultRows.length;
for (var i = 0; i < resultRowsCount; i++) {
$(table.tBodies[0]).append(resultRows[i]);
}
//adding code
var tdcount = $(table).find("tfoot tr:eq(0) td.count");
if ($(tdcount).size() == 0) {
if ($(table).find("tfoot").size() == 0) {
$("<tfoot>").appendTo(table).append($("<tr>"));
}
tdcount = $("<td>").appendTo($(table).find("tfoot tr:eq(0)"));
$(tdcount).attr("class", "count");
}
$(tdcount).text("Count (Тоо):" + $(table.tBodies[0]).children().size());
//adding code end
..................
}
3. filter хийж байх үед сонгосон талбарын нийлбэр харах tablesorter.js дотор
/* sorting methods */
function multisort(table, sortList, cache) {
var trsum = $(table).find("tbody tr");
var sum = 0;
try {
var trsuml = $(trsum).size();
for (var trsumi = 0; trsumi < trsuml; trsumi++) {
var tr = $(trsum).get(trsumi);
var tdi = sortList[0][0];
var td = $(tr).children().get(parseInt(tdi));
sum = sum + parseInt($(td).text());
}
} catch (e) {
} finally {
var tdsum = $(table).find("tfoot tr:eq(0) td.sum");
if ($(tdsum).size() == 0) {
if ($(table).find("tfoot").size() == 0) {
$("<tfoot>").appendTo(table).append($("<tr>"));
}
tdsum = $("<td>").appendTo($(table).find("tfoot tr:eq(0)"));
$(tdsum).attr("class", "sum");
}
$(tdsum).text("Sum (Нийлбэр): " + sum);
}
........................
Thursday, September 29, 2011
MSSQL table create with foreign key
USE [MyDb]
GO
CREATE TABLE [dbo].[MachineWorkInfoes](
[Id] [int] IDENTITY(1,1) NOT NULL,
[WorkDate] [datetime] NOT NULL,
[FieldEngineerId] [int] NULL,
[MachineId] [int] NOT NULL,
[TransportCount] [int] NOT NULL,
[TimeStart] [float] NOT NULL,
[TimeEnd] [float] NOT NULL,
[Kilometer] [float] NOT NULL,
[WorkTime] [float] NOT NULL,
[Code] [nvarchar](50) NULL,
[Name] [nvarchar](150) NOT NULL,
[Description] [nvarchar](500) NULL,
[Ordering] [int] NULL,
[IsActive] [bit] NOT NULL,
[Created] [datetime] NOT NULL,
[CreatedName] [nvarchar](50) NULL,
[Modified] [datetime] NOT NULL,
[ModifiedName] [nvarchar](50) NULL,
[ParentId] [int] NULL,
[SiteId] [int] NOT NULL,
[SectionId] [int] NULL,
PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[MachineWorkInfoes] WITH CHECK ADD CONSTRAINT [MachineWorkInfo_FieldEngineer] FOREIGN KEY([FieldEngineerId])
REFERENCES [dbo].[EmployeeInfoes] ([Id])
GO
ALTER TABLE [dbo].[MachineWorkInfoes] CHECK CONSTRAINT [MachineWorkInfo_FieldEngineer]
GO
ALTER TABLE [dbo].[MachineWorkInfoes] WITH CHECK ADD CONSTRAINT [MachineWorkInfo_Machine] FOREIGN KEY([MachineId])
REFERENCES [dbo].[EmployeeWithCars] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[MachineWorkInfoes] CHECK CONSTRAINT [MachineWorkInfo_Machine]
GO
ALTER TABLE [dbo].[MachineWorkInfoes] WITH CHECK ADD CONSTRAINT [MachineWorkInfo_Section] FOREIGN KEY([SectionId])
REFERENCES [dbo].[SectionInfoes] ([Id])
GO
ALTER TABLE [dbo].[MachineWorkInfoes] CHECK CONSTRAINT [MachineWorkInfo_Section]
GO
энэ жишээгээр бол relationship class ийг дураараа үүсгэж загварчилж болно.
Жишээ нь: ASP.NET entity framework дээр entity Class нь нэг иймэрхүү бичиглэлтэй болно
ямар ажилчин ямар тушаал дээр хэзээ ажилласанг бүртгэх кодын жишээ
public class MachineWorkInfo : NamedMetaData
{
[DisplayName("Ажил хийсэн өдөр")]
[Required(ErrorMessage = "Ажил хийсэн өдөр заавал байх ёстой!")]
public DateTime WorkDate { get; set; }
[DisplayName("Хариуцсан ажилтан")]
[Required(ErrorMessage = "Хариуцсан ажилтан заавал байх ёстой!")]
public Nullable<int> FieldEngineerId { get; set; }
public virtual EmployeeInfo FieldEngineer { get; set; }
[DisplayName("Амжил хийсэн машин")]
[Required(ErrorMessage = "Амжил хийсэн машин заавал байх ёстой!")]
public int MachineId { get; set; }
public virtual EmployeeWithCar Machine { get; set; }
[DisplayName("Рэйсийн тоо")]
[Required(ErrorMessage = "Рэйсийн тоо заавал байх ёстой!")]
[RegularExpression(@"^\$?\d+(\.(\d{2}))?$", ErrorMessage = "Тоон утга байх ёстой!")]
public int TransportCount { get; set; }
[DisplayName("Спидометр явахад")]
[Required(ErrorMessage = "Спидометр явахад заавал байх ёстой!")]
[RegularExpression(@"^(-{0,1})([0-9]+)(\.{0,1})([0-9]*)$", ErrorMessage = "Тоон утга байх ёстой!")]
public double TimeStart { get; set; }
[DisplayName("Спидометр ирэхэд")]
[Required(ErrorMessage = "Спидометр ирэхэд заавал байх ёстой!")]
[RegularExpression(@"^(-{0,1})([0-9]+)(\.{0,1})([0-9]*)$", ErrorMessage = "Тоон утга байх ёстой!")]
public double TimeEnd { get; set; }
[DisplayName("Явсан километр")]
[Required(ErrorMessage = "Явсан километр заавал байх ёстой!")]
[RegularExpression(@"^(-{0,1})([0-9]+)(\.{0,1})([0-9]*)$", ErrorMessage = "Тоон утга байх ёстой!")]
public double Kilometer { get; set; }
[DisplayName("Ажилласан цаг")]
[Required(ErrorMessage = "Ажилласан цаг заавал байх ёстой!")]
[RegularExpression(@"^(-{0,1})([0-9]+)(\.{0,1})([0-9]*)$", ErrorMessage = "Тоон утга байх ёстой!")]
public double WorkTime { get; set; }
}
how to delete constrainted column from table
ALTER TABLE [dbo].[LanguageInfoes] DROP CONSTRAINT [FK_LanguageInfoes_SectionInfoes_SectionId]
GO
Exec ('DROP INDEX [' + @indexName + '] ON [' + @tableName + ']')
GO
GO
CREATE TABLE [dbo].[MachineWorkInfoes](
[Id] [int] IDENTITY(1,1) NOT NULL,
[WorkDate] [datetime] NOT NULL,
[FieldEngineerId] [int] NULL,
[MachineId] [int] NOT NULL,
[TransportCount] [int] NOT NULL,
[TimeStart] [float] NOT NULL,
[TimeEnd] [float] NOT NULL,
[Kilometer] [float] NOT NULL,
[WorkTime] [float] NOT NULL,
[Code] [nvarchar](50) NULL,
[Name] [nvarchar](150) NOT NULL,
[Description] [nvarchar](500) NULL,
[Ordering] [int] NULL,
[IsActive] [bit] NOT NULL,
[Created] [datetime] NOT NULL,
[CreatedName] [nvarchar](50) NULL,
[Modified] [datetime] NOT NULL,
[ModifiedName] [nvarchar](50) NULL,
[ParentId] [int] NULL,
[SiteId] [int] NOT NULL,
[SectionId] [int] NULL,
PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[MachineWorkInfoes] WITH CHECK ADD CONSTRAINT [MachineWorkInfo_FieldEngineer] FOREIGN KEY([FieldEngineerId])
REFERENCES [dbo].[EmployeeInfoes] ([Id])
GO
ALTER TABLE [dbo].[MachineWorkInfoes] CHECK CONSTRAINT [MachineWorkInfo_FieldEngineer]
GO
ALTER TABLE [dbo].[MachineWorkInfoes] WITH CHECK ADD CONSTRAINT [MachineWorkInfo_Machine] FOREIGN KEY([MachineId])
REFERENCES [dbo].[EmployeeWithCars] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[MachineWorkInfoes] CHECK CONSTRAINT [MachineWorkInfo_Machine]
GO
ALTER TABLE [dbo].[MachineWorkInfoes] WITH CHECK ADD CONSTRAINT [MachineWorkInfo_Section] FOREIGN KEY([SectionId])
REFERENCES [dbo].[SectionInfoes] ([Id])
GO
ALTER TABLE [dbo].[MachineWorkInfoes] CHECK CONSTRAINT [MachineWorkInfo_Section]
GO
энэ жишээгээр бол relationship class ийг дураараа үүсгэж загварчилж болно.
Жишээ нь: ASP.NET entity framework дээр entity Class нь нэг иймэрхүү бичиглэлтэй болно
ямар ажилчин ямар тушаал дээр хэзээ ажилласанг бүртгэх кодын жишээ
public class MachineWorkInfo : NamedMetaData
{
[DisplayName("Ажил хийсэн өдөр")]
[Required(ErrorMessage = "Ажил хийсэн өдөр заавал байх ёстой!")]
public DateTime WorkDate { get; set; }
[DisplayName("Хариуцсан ажилтан")]
[Required(ErrorMessage = "Хариуцсан ажилтан заавал байх ёстой!")]
public Nullable<int> FieldEngineerId { get; set; }
public virtual EmployeeInfo FieldEngineer { get; set; }
[DisplayName("Амжил хийсэн машин")]
[Required(ErrorMessage = "Амжил хийсэн машин заавал байх ёстой!")]
public int MachineId { get; set; }
public virtual EmployeeWithCar Machine { get; set; }
[DisplayName("Рэйсийн тоо")]
[Required(ErrorMessage = "Рэйсийн тоо заавал байх ёстой!")]
[RegularExpression(@"^\$?\d+(\.(\d{2}))?$", ErrorMessage = "Тоон утга байх ёстой!")]
public int TransportCount { get; set; }
[DisplayName("Спидометр явахад")]
[Required(ErrorMessage = "Спидометр явахад заавал байх ёстой!")]
[RegularExpression(@"^(-{0,1})([0-9]+)(\.{0,1})([0-9]*)$", ErrorMessage = "Тоон утга байх ёстой!")]
public double TimeStart { get; set; }
[DisplayName("Спидометр ирэхэд")]
[Required(ErrorMessage = "Спидометр ирэхэд заавал байх ёстой!")]
[RegularExpression(@"^(-{0,1})([0-9]+)(\.{0,1})([0-9]*)$", ErrorMessage = "Тоон утга байх ёстой!")]
public double TimeEnd { get; set; }
[DisplayName("Явсан километр")]
[Required(ErrorMessage = "Явсан километр заавал байх ёстой!")]
[RegularExpression(@"^(-{0,1})([0-9]+)(\.{0,1})([0-9]*)$", ErrorMessage = "Тоон утга байх ёстой!")]
public double Kilometer { get; set; }
[DisplayName("Ажилласан цаг")]
[Required(ErrorMessage = "Ажилласан цаг заавал байх ёстой!")]
[RegularExpression(@"^(-{0,1})([0-9]+)(\.{0,1})([0-9]*)$", ErrorMessage = "Тоон утга байх ёстой!")]
public double WorkTime { get; set; }
}
how to delete constrainted column from table
ALTER TABLE [dbo].[LanguageInfoes] DROP CONSTRAINT [FK_LanguageInfoes_SectionInfoes_SectionId]
GO
Exec ('DROP INDEX [' + @indexName + '] ON [' + @tableName + ']')
GO
Friday, September 16, 2011
Adobe photo hadgalchlaa A3 and pixel
- A3 — normally 420 x 297mm, but increase to 426 x 303mm;
- A4 — normally 297 x 210mm, but increase to 303 x 216mm;
- A5 — normally 210 x 148mm, but increase to 216 x 154mm;
- A6 — normally 148 x 105mm, but increase to 154 x 111mm;
- A7 — normally 105 x 74mm, but increase to 111 x 80mm;
- DL — normally 210 x 99mm, but increase to 216 x 105mm.
Subscribe to:
Posts (Atom)