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);
        }
Beispiel #2
0
 /// <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);
        }
Beispiel #4
0
        public string GetDisplayName()
        {
            StaffDirectory sd = DA.Current.Single <StaffDirectory>(StaffDirectoryID);

            if (sd != null)
            {
                return(sd.Client.DisplayName);
            }
            else
            {
                throw new StaffDirectoryNotFoundException(StaffDirectoryID);
            }
        }
Beispiel #5
0
        public int GetClientID()
        {
            StaffDirectory sd = DA.Current.Single <StaffDirectory>(StaffDirectoryID);

            if (sd != null)
            {
                return(sd.Client.ClientID);
            }
            else
            {
                throw new StaffDirectoryNotFoundException(StaffDirectoryID);
            }
        }
Beispiel #6
0
        public bool IsReadOnly(StaffDirectory item)
        {
            if (CurrentUser.HasPriv(ClientPrivilege.Administrator | ClientPrivilege.Developer))
            {
                return(false);
            }

            if (item.Client == CurrentUser)
            {
                return(false);
            }

            return(true);
        }
Beispiel #7
0
        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
            });
        }
Beispiel #8
0
        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());
        }
Beispiel #9
0
        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);
        }
Beispiel #10
0
        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;
        }
Beispiel #11
0
 partial void OnAfterDelete(StaffDirectory staffdirectory);
Beispiel #12
0
 partial void OnBeforeDelete(StaffDirectory staffdirectory);
Beispiel #13
0
 partial void OnAfterPut(StaffDirectory staffdirectory);
Beispiel #14
0
 partial void OnBeforePut(StaffDirectory staffdirectory);
Beispiel #15
0
 partial void OnAfterGetById(StaffDirectory StaffDirectories, String staffDirectoryId);
Beispiel #16
0
 public bool UpdateStaffRecord(StaffDirectory Item)
 {
     return(_staffDirectoryRepository.Update(Item));
 }
Beispiel #17
0
 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);
 }