public override void SelectExecute() { this.tableName = "Assess";//初始化表名 statement = searchField == null?string.Format("select StaffNo,staff.Name as StaffName,date_format(Date,'%Y-%m-%d') as Date,Score from {0},Staff where StaffNo=No", tableName) : string.Format("select StaffNo,staff.Name as StaffName,date_format(Date,'%Y-%m-%d') as Date,Score from {1},Staff where StaffNo=No and staff.Name LIKE '%{0}%'", SearchField, tableName); DataTable table = service.QueryManipulation(statement, connection); this.Table = DataTableToObservableCollection.ToObservableCollection <AssessViewModel>(table); tableLastIndex = searchField == null?Table.LastOrDefault().StaffNo : tableLastIndex; count = Table.Count(); editedIndexs = new List <int>(); statements = new List <string>(); }
public override void SelectExecute() { this.tableName = "staff"; statement = searchField == null?string.Format("select No, Name, Gender, date_format(Birthday, '%Y-%m-%d') as Birthday, Department, Position, date_format(EntryDate, '%Y-%m-%d') as EntryDate,date_format(ContractDate, '%Y-%m-%d') as ContractDate, Username, Password, Authority, Status from {0}", tableName) : string.Format("select No, Name, Gender, date_format(Birthday, '%Y-%m-%d') as Birthday, Department, Position, date_format(EntryDate, '%Y-%m-%d') as EntryDate, date_format(ContractDate, '%Y-%m-%d') as ContractDate, Username, Password, Authority, Status from {1} WHERE Name LIKE '%{0}%'", SearchField, tableName); DataTable table = service.QueryManipulation(statement, connection); this.Table = DataTableToObservableCollection.ToObservableCollection <StaffViewModel>(table); tableLastIndex = searchField == null?Table.LastOrDefault().No : tableLastIndex; toEditNo = tableLastIndex + 1; count = Table.Count(); editedIndexs = new List <int>(); statements = new List <string>(); }