Example #1
0
        /// <summary>
        /// In forms constructor the not necessarily labels, tetxboxes and comboboxes are hiding
        /// from the form. Then the combobox for work hours(CmbWorkHours) is filling with the ID of work hours.
        /// </summary>
        public EditWorkHours()
        {
            InitializeComponent();

            LblDays.Hide();
            LblEndTime.Hide();
            LblStartTime.Hide();
            DtpEndTime.Hide();
            DtpStartTime.Hide();
            CmbDays.Hide();
            BtnEdit.Hide();

            CmbWorkHours.DataSource    = DCom.GetData("SELECT * FROM work_hours");
            CmbWorkHours.DisplayMember = "ID";
            CmbWorkHours.ValueMember   = "ID";
        }
Example #2
0
        /// <summary>
        /// When the client select the work hour that wants to edit the not necessarily labels, tetxboxes and comboboxes are hiding
        /// from the form and then the neccesarily labels, tetxboxes and comboboxes are pop up. Then fills all the fields with
        /// the data of the selected work hour.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSelect_Click(object sender, EventArgs e)
        {
            LblDays.Show();
            LblEndTime.Show();
            LblStartTime.Show();
            DtpEndTime.Show();
            DtpStartTime.Show();
            CmbDays.Show();
            BtnEdit.Show();

            label1.Hide();
            CmbWorkHours.Hide();
            BtnSelect.Hide();

            SelectedData      = DCom.GetData(String.Format(SqlExec, CmbWorkHours.SelectedValue));
            DtpEndTime.Text   = SelectedData.Rows[0]["End_Time"].ToString();
            DtpStartTime.Text = SelectedData.Rows[0]["Start_Time"].ToString();

            CmbDays.DataSource    = DCom.GetData("SELECT * FROM days");
            CmbDays.DisplayMember = "NAME";
            CmbDays.ValueMember   = "NAME";
            CmbDays.Text          = SelectedData.Rows[0]["Day"].ToString();
        }