protected override void ItemShowing() { StaffCategory ct = UpdatingItem as StaffCategory; txtName.Text = ct.Name; txtMemo.Text = ct.Memo; }
// Filter by category, using LINQ expressions public void filterByCategory(StaffCategory StaffCategory) { var selected = from Staff c in Staff where c.StaffCategory == StaffCategory select c; visibleStaff.Clear(); selected.ToList().ForEach(visibleStaff.Add); }
public Staff(int id, string firstName, string surname, string address1, string address2, StaffCategory category, double baseLocLat, double baseLocLon) { Id = id; FirstName = firstName; Surname = surname; Address1 = address1; Address2 = address2; Category = category; BaseLocLat = baseLocLat; BaseLocLon = baseLocLon; }
public CommandResult Update(StaffCategory info) { StaffCategory original = ProviderFactory.Create <IStaffCategoryProvider>(_RepoUri).GetByID(info.ID).QueryObject; if (original != null) { return(ProviderFactory.Create <IStaffCategoryProvider>(_RepoUri).Update(info, original)); } else { return(new CommandResult(ResultCode.NoRecord, ResultCodeDecription.GetDescription(ResultCode.NoRecord))); } }
protected override Object GetItemFromInput() { StaffCategory ct = UpdatingItem as StaffCategory; if (IsAdding) { ct = new StaffCategory(); ct.ID = txtName.Text; } ct.Name = txtName.Text; ct.Memo = txtMemo.Text; return(ct); }
public static bool Save(DayCarePL.StaffCategoryProperties objStaffCat) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clStaffCategory, "Save", "Execute Save Method", DayCarePL.Common.GUID_DEFAULT); clConnection.DoConnection(); bool result = false; DayCareDataContext db = new DayCareDataContext(); StaffCategory DBstaffCategory = null; try { DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clStaffCategory, "Save", "Debug Save Method", DayCarePL.Common.GUID_DEFAULT); if (objStaffCat.Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT)) { DBstaffCategory = new StaffCategory(); DBstaffCategory.Id = System.Guid.NewGuid(); } else { DBstaffCategory = db.StaffCategories.SingleOrDefault(S => S.Id.Equals(objStaffCat.Id)); } DBstaffCategory.LastModifiedDatetime = DateTime.Now; DBstaffCategory.LastModifiedById = objStaffCat.Id; DBstaffCategory.Name = objStaffCat.Name; DBstaffCategory.Comments = objStaffCat.Comments; DBstaffCategory.SchoolId = objStaffCat.SchoolId; DBstaffCategory.Active = objStaffCat.Active; DBstaffCategory.LastModifiedById = objStaffCat.LastModifiedById; DBstaffCategory.LastModifiedDatetime = DateTime.Now; if (objStaffCat.Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT)) { db.StaffCategories.InsertOnSubmit(DBstaffCategory); } db.SubmitChanges(); result = true; } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clStaffCategory, "Save", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); result = false; } return(result); }
public CommandResult Delete(StaffCategory info) { return(ProviderFactory.Create <IStaffCategoryProvider>(_RepoUri).Delete(info)); }
public CommandResult Add(StaffCategory info) { return(ProviderFactory.Create <IStaffCategoryProvider>(_RepoUri).Insert(info)); }
// set method, the purpose is to achieve encapsulation public void setStaffCategory(StaffCategory staffCategory) { this.StaffCategory = staffCategory; }