Пример #1
0
        private void Timesheet_Load(object sender, EventArgs e)
        {
            dtShift = objSch.GetStartEndShift(Form1.user);
            start   = TimeSpan.Parse(objSch.startShift);
            end     = TimeSpan.Parse(objSch.endShift);

            if ((now > start) && (now < end))
            {
                stripStatus.Text = "                         Open Timesheet";
            }
            else
            {
                stripStatus.Text = "                        Timesheet Closed";

                foreach (Control item in this.Controls)
                {
                    item.Enabled = false;
                }

                btnClose.Enabled = true;
            }


            cbJobCode.DisplayMember = "Code";
            cbJobCode.ValueMember   = "ID";
            cbJobCode.DataSource    = jobCode.GetJobCode();
            cbJobCode.SelectedIndex = -1;

            cbAccount.SelectedIndex = -1;

            cbActivity.DisplayMember = "Name";
            cbActivity.ValueMember   = "ID";
            cbActivity.DataSource    = activityName.GetActivityName();
            cbActivity.SelectedIndex = -1;

            txtJobAdmin.AutoCompleteMode   = AutoCompleteMode.Suggest;
            txtJobAdmin.AutoCompleteSource = AutoCompleteSource.CustomSource;
            AutoCompleteStringCollection name = new AutoCompleteStringCollection();

            name.AddRange(empName.GetEmployeeFullName().ToArray());
            txtJobAdmin.AutoCompleteCustomSource = name;

            dt                = empName.GetEmpNameByUsername(Form1.user);
            employee          = empName.ConvertDataTableToString(dt);
            stripEmpName.Text = employee + "        ";

            dt2   = nextShift.GetShiftDetails(Form1.user);
            shift = nextShift.ConvertDataTableToString(dt2);
            DateTime date = nextShift.dateTime;

            stripNextShift.Spring = true;
            stripNextShift.Text   = "Next Shift:  " + date.ToShortDateString() + "   " + nextShift.nextShift;
        }