コード例 #1
0
 private void frm_BangCC_Load(object sender, EventArgs e)
 {
     if (this.admin)
     {
         this.btn_updateMonth_person.Visible = true;
         this.btn_updateMonth_all.Visible    = true;
         this.dataGridView1.Visible          = true;
         this.ccb_manv.Enabled     = true;
         this.bll_bangcc.onMinifrm = true;
         this.mfrm      = new mform(tabpage);
         this.mfrm.Text = "Cập nhật ngày chấm công...";
         this.mfrm.Show();
         foreach (string str in this.ccb_manv.Items)
         {
             this.bll_bangcc.Update_SONGAYCC(bll_nhanvien.get_MABCC(str));
             this.mfrm.Update_ProgessBar(100 / this.ccb_manv.Items.Count);
             this.Validate();
         }
         this.mfrm.Close();
     }
     else
     {
         this.ccb_manv.Items.Clear();
         this.ccb_manv.Items.Add(this.MANV);
         this.ccb_manv.SelectedIndex = 0;
     }
 }
コード例 #2
0
 private void btn_updateMonth_all_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Cập nhật tháng chấm công: " + DateTime.Now.Month + " cho toàn bộ nhân viên?", "Question",
                         MessageBoxButtons.OKCancel,
                         MessageBoxIcon.Question) == DialogResult.Cancel)
     {
         return;
     }
     this.mfrm      = new mform(tabpage);
     this.mfrm.Text = "Cập nhật tháng chấm công: " + DateTime.Now.Month;
     this.mfrm.Show();
     this.bll_bangcc.onMinifrm = true;
     foreach (string str in this.ccb_manv.Items)
     {
         this.bll_bangcc.Update_THANG(bll_nhanvien.get_MABCC(str), DateTime.Now.Month);
         this.mfrm.Update_ProgessBar(100 / this.ccb_manv.Items.Count);
     }
     this.mfrm.Close();
 }
コード例 #3
0
ファイル: frm_QLLich.cs プロジェクト: quanlm271/HRM_Hospital
        private void btn_Insert_Click(object sender, EventArgs e)
        {
            if (!KiemTraDuLieuNhap())
            {
                return;
            }

            //run first
            if (!this.cb_lapthang.Checked && !this.cb_laptuan.Checked)
            {
                this.bll_lich.Insert(this.bll_lich.set_MALICH(), this.cbb_manv.Text, this.tb_maphong.Text,
                                     this.tb_tencv.Text, this.tb_loaicv.Text, this.dtime_ngay.Value.Date,
                                     this.dtime_thoigian.Value.TimeOfDay, this.tb_diadiem.Text, this.cb_codilam.Checked
                                     );
            }

            this.bll_lich.onMinifrm = true;
            if (this.cb_laptuan.Checked)
            {
                int      month = this.dtime_ngay.Value.Month;
                DateTime dt    = this.dtime_ngay.Value.Date;

                this.bll_lich.onMinifrm = true;
                this.mfrm      = new mform(tabpage);
                this.mfrm.Text = "Thêm lịch hàng tuần...";
                this.mfrm.Show();
                int value = ((DateTime.DaysInMonth(dt.Year, dt.Month) - dt.Day) / 7) + 1;

                while (dt.Month == month)
                {
                    if (!this.bll_ngaynghi.isOutDay(dt))
                    {
                        this.mfrm.Update_ProgessBar(100 / value);
                        this.bll_lich.Insert(this.bll_lich.set_MALICH(), this.cbb_manv.Text, this.tb_maphong.Text,
                                             this.tb_tencv.Text, this.tb_loaicv.Text, dt.Date, this.dtime_thoigian.Value.TimeOfDay,
                                             this.tb_diadiem.Text, this.cb_codilam.Checked
                                             );
                    }
                    dt = dt.AddDays(7);
                }

                this.mfrm.Close();
                this.bll_lich.onMinifrm = false;
                this.cb_laptuan.Checked = false;
            }

            if (this.cb_lapthang.Checked)
            {
                DateTime dt    = this.dtime_ngay.Value.Date;
                int      month = dt.Month + 1;

                this.bll_lich.onMinifrm = true;
                this.mfrm      = new mform(tabpage);
                this.mfrm.Text = "Thêm lịch hàng tháng...";
                this.mfrm.Show();
                int value = 12 - month;

                while (month <= 12)
                {
                    if (DateTime.DaysInMonth(dt.Year, month) >= dt.Day)
                    {
                        dt = new DateTime(dt.Year, month, dt.Day);
                        if (!this.bll_ngaynghi.isOutDay(dt) && !dt.DayOfWeek.Equals(DayOfWeek.Sunday))
                        {
                            this.mfrm.Update_ProgessBar(100 / value);
                            this.bll_lich.Insert(this.bll_lich.set_MALICH(), this.cbb_manv.Text, this.tb_maphong.Text,
                                                 this.tb_tencv.Text, this.tb_loaicv.Text, dt.Date, this.dtime_thoigian.Value.TimeOfDay,
                                                 this.tb_diadiem.Text, this.cb_codilam.Checked
                                                 );
                        }
                    }
                    month++;
                }
                this.mfrm.Close();
                this.bll_lich.onMinifrm  = false;
                this.cb_lapthang.Checked = false;
            }
            this.ViewByMANV(cbb_manv.Text);
        }