public void Put(int id, [FromBody] StaffDirectory staffDirectoryRecord) { _logger.Log(LogLevel.Information, "Request Recieved to update" + id.ToString(), null); var staffInfo = _staffDirectoryService.GetStaffById(id); _staffDirectoryService.UpdateStaffRecord(staffDirectoryRecord); _logger.Log(LogLevel.Information, "Updation of Staff Record is completed", null); }
/// <summary> /// Updates a specific StaffDirectory based on it's ID /// </summary> /// <returns>StaffDirectory</returns> public StaffDirectory Put([FromBody] StaffDirectory staffdirectory) { if (String.IsNullOrEmpty(staffdirectory.StaffDirectoryId)) { staffdirectory.StaffDirectoryId = Guid.NewGuid().ToString(); } this.OnBeforePut(staffdirectory); this.SDM.Upsert(staffdirectory); this.OnAfterPut(staffdirectory); return(staffdirectory); }
public void Post([FromBody] StaffDirectory staffDirectoryRecord) { _logger.Log(LogLevel.Information, "Request recieved to create a new Staff Record", null); var record = JsonConvert.SerializeObject(staffDirectoryRecord); System.IO.File.WriteAllText(Path.Combine(Path.GetTempPath(), "log_" + Guid.NewGuid() + ".txt"), record); var Id = _staffDirectoryService.CreateStaffRecord(staffDirectoryRecord); _logger.Log(LogLevel.Information, "Creation of new Staff Record is completed", null); }
public string GetDisplayName() { StaffDirectory sd = DA.Current.Single <StaffDirectory>(StaffDirectoryID); if (sd != null) { return(sd.Client.DisplayName); } else { throw new StaffDirectoryNotFoundException(StaffDirectoryID); } }
public int GetClientID() { StaffDirectory sd = DA.Current.Single <StaffDirectory>(StaffDirectoryID); if (sd != null) { return(sd.Client.ClientID); } else { throw new StaffDirectoryNotFoundException(StaffDirectoryID); } }
public bool IsReadOnly(StaffDirectory item) { if (CurrentUser.HasPriv(ClientPrivilege.Administrator | ClientPrivilege.Developer)) { return(false); } if (item.Client == CurrentUser) { return(false); } return(true); }
public static IStaffDirectory CreateModel(this StaffDirectory source, IEnumerable <IClient> staff) { var c = staff.First(x => x.ClientID == source.Client.ClientID); return(new StaffDirectoryItem { StaffDirectoryID = source.StaffDirectoryID, ClientID = source.Client.ClientID, LName = c.LName, FName = c.FName, ContactEmail = c.Email, HoursXML = source.HoursXML, ContactPhone = source.ContactPhone, Office = source.Office, Deleted = source.Deleted, LastUpdate = source.LastUpdate }); }
public string GetWorkHoursTime(DayOfWeek day, WorkHoursPart part) { if (staffTime == null) { StaffDirectory sd = DA.Current.Single <StaffDirectory>(StaffDirectoryID); if (sd == null) { throw new StaffDirectoryNotFoundException(StaffDirectoryID); } staffTime = new StaffTimeInfoCollection(sd.HoursXML); } StaffTimeInfo timeInfo = staffTime[day]; StaffTimeValue timeValue = null; switch (part) { case WorkHoursPart.MorningStart: timeValue = timeInfo.AM.Start; break; case WorkHoursPart.MorningEnd: timeValue = timeInfo.AM.End; break; case WorkHoursPart.AfternoonStart: timeValue = timeInfo.PM.Start; break; case WorkHoursPart.AfternoonEnd: timeValue = timeInfo.PM.End; break; default: throw new ArgumentException("part"); } return(timeValue.Value.ToString()); }
public StaffTimeInfoCollection GetStaffTime() { if (staffTime == null) { if (StaffDirectoryID == 0) { staffTime = new StaffTimeInfoCollection(); } else { StaffDirectory sd = DA.Current.Single <StaffDirectory>(StaffDirectoryID); if (sd == null) { throw new StaffDirectoryNotFoundException(StaffDirectoryID); } staffTime = new StaffTimeInfoCollection(sd.HoursXML); } } return(staffTime); }
public void Load() { if (StaffDirectoryID == 0 && !CanAdd()) { AppendAlert("You do not have permission to add.", true); return; } if (StaffDirectoryID == 0) { return; } StaffDirectory sd = DA.Current.Single <StaffDirectory>(StaffDirectoryID); if (sd == null) { throw new StaffDirectoryNotFoundException(StaffDirectoryID); } if (sd.Deleted) { if (!CanDelete()) { AppendAlert("You do not have permission to access a deleted record.", true); return; } } PhoneNumber phoneNumber = PhoneNumber.Parse(sd.ContactPhone); PhoneAreaCode = phoneNumber.AreaCode; PhonePrefix = phoneNumber.Prefix; PhoneLineNumber = phoneNumber.LineNumber; Office = sd.Office; Deleted = sd.Deleted; }
partial void OnAfterDelete(StaffDirectory staffdirectory);
partial void OnBeforeDelete(StaffDirectory staffdirectory);
partial void OnAfterPut(StaffDirectory staffdirectory);
partial void OnBeforePut(StaffDirectory staffdirectory);
partial void OnAfterGetById(StaffDirectory StaffDirectories, String staffDirectoryId);
public bool UpdateStaffRecord(StaffDirectory Item) { return(_staffDirectoryRepository.Update(Item)); }
public bool CreateStaffRecord(StaffDirectory Item) { return(_staffDirectoryRepository.Insert(Item)); }
public static void FillStaffDropdown(DropDownList ddStaff) { StaffDirectory staff = new StaffDirectory(); DataSet dsStaff = staff.GetStaffList(); ddStaff.DataSource = dsStaff; ddStaff.DataTextField = "StaffName"; ddStaff.DataValueField = "StaffID"; ddStaff.DataBind(); ListItem itemStaff = new ListItem(); itemStaff.Value = "0"; itemStaff.Text = "-Select Staff-"; ddStaff.Items.Insert(0, itemStaff); }