public CommandResult Save(TASheetGroup info) { string id = null; ITASheetProvider provider = ProviderFactory.Create<ITASheetProvider>(_RepoUri); IUnitWork unitWork = ProviderFactory.Create<IUnitWork>(_RepoUri); if (!string.IsNullOrEmpty(info.SheetID)) { TASheetSearchCondition con = new TASheetSearchCondition(); con.SheetID = info.SheetID; List<TASheet> items = provider.GetItems(con).QueryObjects; foreach (TASheet item in items) { provider.Delete(item); } id = info.SheetID; } else { id = ProviderFactory.Create<IStringIDCreater>(_RepoUri).CreateID("SH", 4, "TASheet"); if (string.IsNullOrEmpty(id)) return new CommandResult(ResultCode.Fail, "创建ID失败"); info.SheetID = id; } if (info.Items != null && info.Items.Count > 0) info.Items.ForEach(it => it.SheetID = id); List<TASheet> sheets = TASheetGroup.UnGroup(info); foreach (TASheet sheet in sheets) { provider.Insert(sheet, unitWork); } return unitWork.Commit(); }
public CommandResult Delete(TASheetGroup info) { TASheetSearchCondition con = new TASheetSearchCondition(); con.SheetID = info.SheetID; ITASheetProvider provider = ProviderFactory.Create<ITASheetProvider>(_RepoUri); IUnitWork unitWork = ProviderFactory.Create<IUnitWork>(_RepoUri); List<TASheet> items = provider.GetItems(con).QueryObjects; foreach (TASheet item in items) { provider.Delete(item); } return unitWork.Commit(); }
protected override List<object> GetDataSource() { TASheetSearchCondition con = new TASheetSearchCondition(); List<TASheet> items = (new TASheetBLL(AppSettings.CurrentSetting.ConnectUri)).GetItems(con).QueryObjects; List<TASheetGroup> groups = TASheetGroup.Group(items); if (groups != null) { return (from item in groups orderby item.StartDate descending select (object)item).ToList(); } else { return null; } }
private bool CreateAttendanceResults(Staff staff, DatetimeRange dr, List<string> readers) { ShiftArrangeSearchCondition con1 = new ShiftArrangeSearchCondition(); con1.StaffID = staff.ID; con1.ShiftDate = dr; List<ShiftArrange> sas = (new ShiftArrangeBLL(AppSettings.CurrentSetting.ConnectUri)).GetItems(con1).QueryObjects; TASheetSearchCondition con2 = new TASheetSearchCondition(); con2.StaffID = staff.ID; List<TASheet> sheets = (new TASheetBLL(AppSettings.CurrentSetting.ConnectUri)).GetItems(con2).QueryObjects; AttendanceLogSearchCondition con3 = new AttendanceLogSearchCondition(); con3.Staff = new List<int>(); con3.Staff.Add(staff.ID); con3.Readers = readers; con3.ReadDateTime = dr; con3.ContainManualLogs = true; List<AttendanceLog> records = (new AttendanceLogBLL(AppSettings.CurrentSetting.ConnectUri)).GetItems(con3).QueryObjects; List<AttendanceResult> results = (new AttendanceAnalyst()).Analist(staff, sas, records, sheets, dr); CommandResult ret = (new AttendanceResultBLL(AppSettings.CurrentSetting.ConnectUri)).Add(staff.ID, dr, results); return ret.Result == ResultCode.Successful; }