コード例 #1
0
        private void LoadData()
        {
            this.bunifuCustomDataGrid1.Rows.Clear();
            this.lbName.Text     = data.NHANSUs.Find(this.ID).HoVaTen;
            this.lbUserName.Text = data.NHANSUs.Find(this.ID).UserName;
            this.lbMonth.Text    = this.ThangNam.ToString("MM - yyyy");
            fnDisplayWorkingDaysStaffOfMonth_Result temp = data.fnDisplayWorkingDaysStaffOfMonth(this.lbName.Text, this.ThangNam).FirstOrDefault();

            if (temp != null)
            {
                this.lbWFH.Text        = (temp.WFH == null ? "0" : temp.LEAVES.ToString());
                this.lbLeaveHours.Text = (temp.LEAVES == null ? "0" : temp.LEAVES.ToString());
            }
            this.lbOFFDayTakeLeave.Text   = (CalcultDayOFFTakeLeave().ToString() == null ? "0" : CalcultDayOFFTakeLeave().ToString());
            this.lbDayOFFNoTakeLeave.Text = (CalculDayOFFNoTakeLeave().ToString() == null ? "0" : CalculDayOFFNoTakeLeave().ToString());
            this.lbTotalWorkingHours.Text = (((Weekdays(new DateTime(ThangNam.Year, ThangNam.Month, 1), new DateTime(ThangNam.Year, ThangNam.Month, 1).AddMonths(1).AddDays(-1))) * 8) - Convert.ToInt32(this.lbLeaveHours.Text)).ToString();
            try
            {
                this.TitleWorkingDay.DataSource    = data.LOAI_GIO_CONG.SqlQuery("SELECT * FROM LOAI_GIO_CONG").ToList();
                this.TitleWorkingDay.DisplayMember = "LoaiGioCong";
                this.TitleWorkingDay.ValueMember   = "ID";
                this.lstWorkingDayOfAEmployee      = data.fnDisplayInfoStaffWorkingDayInMonth(this.ID, this.ThangNam).ToList();
                int TotalWFH = 0;
                for (int i = 0; i < this.lstWorkingDayOfAEmployee.Count; i++)
                {
                    this.bunifuCustomDataGrid1.Rows.Add(i + 1,
                                                        this.lstWorkingDayOfAEmployee[i].ID_GioCong,
                                                        this.lstWorkingDayOfAEmployee[i].NgayGioBatDau.Value.ToString("dd/MM/yyyy [ HH:mm ]"),
                                                        this.lstWorkingDayOfAEmployee[i].NgayGioKetThuc.Value.ToString("dd/MM/yyyy [ HH:mm ]")
                                                        );
                }
                if (lstWorkingDayOfAEmployee.Count == 0)
                {
                    this.lbNoData.Show();
                }
                else
                {
                    this.lbNoData.Hide();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }