private void BindInitialData() { StaffingDateRangeDA staffingDateRangeDA = new StaffingDateRangeDA(); List <StaffingDateRange> staffingDates = staffingDateRangeDA.GetAllStaffingDateRanges(); currentWards = DataRepository.Instance.AllWards; WardName_DropDownList.DataSource = currentWards; WardName_DropDownList.DataTextField = "WardName"; WardName_DropDownList.DataValueField = "WardCode"; WardName_DropDownList.DataBind(); //Modify the date range text foreach (StaffingDateRange staffingDate in staffingDates) { string startDate = staffingDate.StartDate.ToShortDateString(); string endDate = staffingDate.EndDate.ToShortDateString(); if (endDate == "01/01/0001") { endDate = Constants.EndDateNotSpecified; } staffingDate.DisplayPeriod = string.Format("{0} to {1}", startDate, endDate); } DatePeriodRange_DropDownList.DataSource = staffingDates; DatePeriodRange_DropDownList.DataTextField = "DisplayPeriod"; DatePeriodRange_DropDownList.DataValueField = "Index"; DatePeriodRange_DropDownList.DataBind(); Shift_DropDownList.DataSource = DataRepository.Instance.AllShiftTypes; Shift_DropDownList.DataTextField = "Name"; Shift_DropDownList.DataValueField = "ShiftID"; Shift_DropDownList.DataBind(); }
private void LoadBasicData() { ShiftTypeDA sda = new ShiftTypeDA(); AllShiftTypes = sda.GetAllShiftType(); WardDA wda = new WardDA(); AllWards = wda.GetAllWard(); StaffingDataDA stda = new StaffingDataDA(); AllStaffing = stda.GetAllStaffing(); StaffingDateRangeDA stfda = new StaffingDateRangeDA(); AllStaffingDateRanges = stfda.GetAllStaffingDateRanges(); //string safeMitigations = WebConfigurationManager.AppSettings["SafeMitigationActions"]; //this.SafeMitigations = new List<string>(); //this.SafeMitigations.AddRange(safeMitigations.Split('|')); MitigationActionsDA mtada = new MitigationActionsDA(); this.UnSafeMitigations = mtada.GetAllMitigationActions(); }
public List <StaffingData> GetAllStaffing() { List <StaffingData> allWards = new List <StaffingData>(); using (SqlConnection con = GetConnection()) { con.Open(); SqlCommand command = new SqlCommand("GetAllStaffing", con); command.CommandType = CommandType.StoredProcedure; var results = command.ExecuteReader(); if (results.HasRows) { StaffingData ward; StaffingDateRangeDA staffingDateRangeDA = new StaffingDateRangeDA(); List <StaffingDateRange> staffingDateRanges = staffingDateRangeDA.GetAllStaffingDateRanges(); int tempInt; while (results.Read()) { ward = new StaffingData(); ward.WardCode = results["Ward Code"].ToString(); ward.StaffingDate = results["Day"].ToString(); ward.Shift = results["Shift"].ToString(); int.TryParse(results["Beds"].ToString(), out tempInt); ward.Beds = tempInt; if (int.TryParse(results["Safe Staffing RN"].ToString(), out tempInt)) { ward.SafeRN = tempInt; } if (int.TryParse(results["Safe Staffing HCA"].ToString(), out tempInt)) { ward.SafeHCA = tempInt; } if (int.TryParse(results["Optimum Staffing RN"].ToString(), out tempInt)) { ward.OptimumRN = tempInt; } if (int.TryParse(results["Optimum Staffing HCA"].ToString(), out tempInt)) { ward.OptimumHCA = tempInt; } if (int.TryParse(results["StaffingDateIndex"].ToString(), out tempInt)) { ward.StaffingDateRangeIndex = tempInt; var staffingDateRange = (from p in staffingDateRanges where p.Index == tempInt select p).SingleOrDefault(); if (staffingDateRange != null) { ward.PeriodStartDate = staffingDateRange.StartDate; ward.PeriodEndDate = staffingDateRange.EndDate; } } allWards.Add(ward); } } } return(allWards); }
private void LoadDataForUpdate() { string wardCode = WardName_DropDownList.SelectedItem.Value; DateTime currentDate; ShiftRecordDA sda; //ShiftID int shiftID = -1; int.TryParse(Shift_DropDownList.SelectedItem.Value, out shiftID); DateTime.TryParse(Date_TextBox.Text, out currentDate); if (string.IsNullOrWhiteSpace(wardCode) || shiftID < 0 || currentDate == null) { return; } sda = new ShiftRecordDA(); ShiftRecord record = sda.GetShiftRecord(currentDate, wardCode, shiftID); if (record.ShiftRecordExists) { ShiftDataEntryFound_HiddenField.Value = "true"; } else { ShiftDataEntryFound_HiddenField.Value = "false"; } //Beds Beds_TextBox.Text = record.Beds.ToString(); //OptimumStaffingRN RN_OptimumStaffing_TextBox.Text = record.OptimumStaffingRN.ToString(); //OptimumStaffingHCA HCA_OptimumStaffing_TextBox.Text = record.OptimumStaffingHCA.ToString(); //PlannedNumberRN RN_PlannedNumber_TextBox.Text = record.PlannedNumberRN; //PlannedNumberHCA HCA_PlannedNumber_TextBox.Text = record.PlannedNumberHCA; //SafeStaffingRN RN_SafeStaffing_TextBox.Text = record.SafeStaffingRN.ToString(); //SafeStaffingHCA HCA_SafeStaffing_TextBox.Text = record.SafeStaffingHCA.ToString(); //Fix if defualt value is 0, empty string will be displayed. //TodayTrustRN RN_TodayTrust_TextBox.Text = record.TodayTrustRN; Overrride_RN_TodayTrust_TextBox.Text = record.TodayTrustRN; //TodayTrustHCA HCA_TodayTrust_TextBox.Text = record.TodayTrustHCA; Overrride_HCA_TodayTrust_TextBox.Text = record.TodayTrustHCA; //TodayBankRN RN_TodayBank_TextBox.Text = record.TodayBankRN; Overrride_RN_TodayBank_TextBox.Text = record.TodayBankRN; //TodayBankHCA HCA_TodayBank_TextBox.Text = record.TodayBankHCA; Overrride_HCA_TodayBank_TextBox.Text = record.TodayBankHCA; //TodayNonTrustRN RN_TodayNonTrust_TextBox.Text = record.TodayNonTrustRN; Overrride_RN_TodayNonTrust_TextBox.Text = record.TodayNonTrustRN; //TodayNonTrustHCA HCA_TodayNonTrust_TextBox.Text = record.TodayNonTrustHCA; Overrride_HCA_TodayNonTrust_TextBox.Text = record.TodayNonTrustHCA; //Comments Comments_TextBox.Text = record.Comments; if (record.IsSafeAfterMitigation == null) { //Safe if (record.IsSafe) { safeDropdown.SelectedIndex = 0; mitigationPanel.Visible = false; } else { safeDropdown.SelectedIndex = 1; mitigationPanel.Visible = true; } } //Check if the ward is unsafe and display the staffing adjustment panel if (record.IsSafeAfterMitigation == true) { safeDropdown.SelectedIndex = 0; mitigationPanel.Visible = false; Overrride_safeDropdown.SelectedIndex = 1; } else if (record.IsSafeAfterMitigation == false) { safeDropdown.SelectedIndex = 1; mitigationPanel.Visible = true; adjustStaffingFiguresPanel.Visible = true; adjustStaffingFiguresPanel.Attributes.Add("style", "display: block;"); fade.Attributes.Add("style", "display: block;"); Overrride_safeDropdown.SelectedIndex = 0; } //UnSafeMitigation if (UnSafeMitigation_DropDownList.Items.FindByValue(record.UnSafeMitigation) != null) { UnSafeMitigation_DropDownList.SelectedValue = record.UnSafeMitigation; } else { UnSafeMitigation_DropDownList.SelectedIndex = 0; } string shiftDataEntryFound = ShiftDataEntryFound_HiddenField.Value; if (shiftDataEntryFound.Equals("false")) { //Shift Name string shiftName = Shift_DropDownList.SelectedItem.Text; //ShiftRecord record = sda.GetShiftRecord(date, wardCode, shiftID); StaffingData staffingDataRecord = new StaffingData(); IList <StaffingData> allStaffing = DataRepository.Instance.AllStaffing; StaffingDateRangeDA staffingDateRangeDA = new StaffingDateRangeDA(); List <StaffingDateRange> staffingDateRange = new List <StaffingDateRange>(); staffingDateRange = staffingDateRangeDA.GetAllStaffingDateRanges(); // This is the logic that loads the optimum/safe staffing values according to the current date int currentDatePeriodIndex = 0; List <int> currentDatePeriodIndexs = new List <int>(); //foreach (StaffingDateRange item in staffingDateRange) //{ // if (IsCurrentDateInSpecifiedDatePeriod(currentDate, item.StartDate, item.EndDate)) // { // currentDatePeriodIndex = item.Index; // break; // } //} //Support for multiple periods foreach (StaffingDateRange item in staffingDateRange) { if (IsCurrentDateInSpecifiedDatePeriod(currentDate, item.StartDate, item.EndDate)) { currentDatePeriodIndexs.Add(item.Index); } } foreach (StaffingData item in allStaffing) { foreach (int period in currentDatePeriodIndexs) { if (item.StaffingDateRangeIndex == period && wardCode.Equals(item.WardCode) && shiftName.Equals(item.Shift) && item.StaffingDate == currentDate.ToString("dddd")) { staffingDataRecord = item; break; } } } //Beds Beds_TextBox.Text = staffingDataRecord.Beds.ToString(); //OptimumStaffingRN RN_OptimumStaffing_TextBox.Text = staffingDataRecord.OptimumRN.ToString(); //OptimumStaffingHCA HCA_OptimumStaffing_TextBox.Text = staffingDataRecord.OptimumHCA.ToString(); //SafeStaffingRN RN_SafeStaffing_TextBox.Text = staffingDataRecord.SafeRN.ToString(); //SafeStaffingHCA HCA_SafeStaffing_TextBox.Text = staffingDataRecord.SafeHCA.ToString(); } SetEntryAreaBckground(); }
public void RefreshPeriodData() { StaffingDateRangeDA stfda = new StaffingDateRangeDA(); AllStaffingDateRanges = stfda.GetAllStaffingDateRanges(); }