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 BindInitialData()
        {
            ShiftDataEntryFound_HiddenField.Value = "false";

            WardName_DropDownList.DataSource     = DataRepository.Instance.AllWards;
            WardName_DropDownList.DataTextField  = "WardName";
            WardName_DropDownList.DataValueField = "WardCode";
            WardName_DropDownList.DataBind();

            Shift_DropDownList.DataSource     = DataRepository.Instance.AllShiftTypes;
            Shift_DropDownList.DataTextField  = "Name";
            Shift_DropDownList.DataValueField = "ShiftID";
            Shift_DropDownList.DataBind();

            UnSafeMitigation_DropDownList.DataSource = DataRepository.Instance.UnSafeMitigations;
            UnSafeMitigation_DropDownList.DataBind();

            // Inserting the default text to the dropdowns
            if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["DropDownDefaultText"]))
            {
                ListItem defaultItem = new ListItem(ConfigurationManager.AppSettings["DropDownDefaultText"]);

                UnSafeMitigation_DropDownList.Items.Insert(0, defaultItem);
            }
        }
        private void BindWardNames(IList <StaffingData> staffingData)
        {
            List <string> wardNames = staffingData.Select(data => data.WardName).Distinct().ToList();

            if (null != wardNames)
            {
                WardName_DropDownList.DataSource = wardNames;
                WardName_DropDownList.DataBind();
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                PeriodStartDate_TextBox.Attributes.Add("readonly", "readonly");

                WardName_DropDownList.DataSource     = DataRepository.Instance.AllWards;
                WardName_DropDownList.DataTextField  = "WardName";
                WardName_DropDownList.DataValueField = "WardCode";
                WardName_DropDownList.DataBind();
            }

            LoadData();
        }