Ejemplo n.º 1
0
        private void TinhLuong(int date)
        {
            //timenow = int.Parse(dtp_print.Value.ToString("yyyyMM"));
            bll = new BLLuong();
            bool a = true;

            dsluong = new List <Luong>();
            ds      = bll.Calculate_salaries();
            blPC.Update(4, out string stri);//trả về hệ số sau khi tính
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                DataRow row   = ds.Tables[0].Rows[i];
                var     x     = row.ItemArray.ToList();
                Luong   salar = new Luong()
                {
                    MaNV         = int.Parse(x[0].ToString()),
                    NgayTraLuong = date,
                    TienLuong    = int.Parse(x[1].ToString())
                };
                //dsluong.Add(salar);
                a = bll.Insert(salar, out err);
            }
            if (!a)
            {
                MessageBox.Show("Đã Tính Lương tháng này");
            }
        }
Ejemplo n.º 2
0
        private void fmLogin_Load(object sender, EventArgs e)
        {
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            try
            {
                //đoạn này dùng để khởi tạo record thống kê, lương
                //nhân viên login => không có quyền truy cập thống kê => không tạo được tk
                // khi chưa có thống kê tuownwng ứng => hóa đơn được tạo sẽ không được cập nhật vào thống kê
                // trigger on hóa đơn => update thống kê
                // TH xảy ra:
                //  Đầu tháng: nhân viên đăng nhập => không có quyền tạo tk => không có thống kê tương ứng với tháng mới
                //  nhân viên đặt hóa đơn => không được cộng vào thống kê tương ứng
                // do windows
                Global.global_datacontext = new QLBH_FastFoodDataContext();
                Global.global_datacontext.Connection.Open();
                int        month = DateTime.Now.Month;
                int        year  = DateTime.Now.Year;
                BLLThongKe bltk  = new BLLThongKe();
                string     err;
                bltk.Insert(year, month, out err);
                BLLuong           bLLuong    = new BLLuong();
                BLNhanVien        bLNhanvien = new BLNhanVien();
                List <v_NhanVien> dsnv       = bLNhanvien.dsVNhanVien();
                foreach (v_NhanVien nv in dsnv)
                {
                    bLLuong.Insert(DateTime.Now, nv.MaNV, out err);
                }

                Global.global_datacontext.Connection.Close();
            }
            catch
            {
                MessageBox.Show("Data error (from fmLogin.cs line 42)");
            }
        }
Ejemplo n.º 3
0
 public void Prestart()
 {
     try
     {
         int        month = DateTime.Now.Month;
         int        year  = DateTime.Now.Year;
         BLLThongKe bltk  = new BLLThongKe();
         string     err;
         bltk.Insert(year, month, out err);
         BLLuong           bLLuong    = new BLLuong();
         BLNhanVien        bLNhanvien = new BLNhanVien();
         List <v_NhanVien> dsnv       = bLNhanvien.dsVNhanVien();
         foreach (v_NhanVien nv in dsnv)
         {
             bLLuong.Insert(DateTime.Now, nv.MaNV, out err);
         }
     }
     catch
     {
         MessageBox.Show("Data error (from Form1.cs line 156)");
     }
 }