Beispiel #1
0
 public void Insert(DAL.CongThucLuongKinhDoanh lkd)
 {
     if (lkd != null)
     {
         dataContext.CongThucLuongKinhDoanhs.InsertOnSubmit(lkd);
         Save();
     }
 }
Beispiel #2
0
 public void Delete(int id)
 {
     DAL.CongThucLuongKinhDoanh temp = dataContext.CongThucLuongKinhDoanhs.SingleOrDefault(t => t.ID == id);
     if (temp != null)
     {
         dataContext.CongThucLuongKinhDoanhs.DeleteOnSubmit(temp);
         Save();
     }
 }
Beispiel #3
0
 protected void btnCapNhat_Click(object sender, DirectEventArgs e)
 {
     try
     {
         CongThucLuongKinhDoanhController controller = new CongThucLuongKinhDoanhController();
         DAL.CongThucLuongKinhDoanh       lkd        = new DAL.CongThucLuongKinhDoanh();
         if (e.ExtraParams["Edit"] == "True")
         {
             lkd = controller.GetById(int.Parse("0" + hdfRecordID.Text));
         }
         lkd.Nhom        = cbx_Nhom.SelectedItem.Value;
         lkd.MaChucVu    = hdfChucVu.Text;
         lkd.PhanTramTu  = double.Parse("0" + txtPhanTramTu.Text.Replace('.', ','));
         lkd.PhanTramDen = double.Parse("0" + txtPhanTramDen.Text.Replace('.', ','));
         lkd.SanLuongTu  = double.Parse("0" + txtSanLuongTu.Text.Replace('.', ','));
         lkd.SanLuongDen = double.Parse("0" + txtSanLuongDen.Text.Replace('.', ','));
         try
         {
             lkd.TienThuong = double.Parse(txtTienThuong.Text.Replace('.', ','));
         }
         catch (Exception)
         {
             lkd.TienThuong = 0;
         }
         if (e.ExtraParams["Edit"] == "True")
         {
             lkd.ID = int.Parse("0" + hdfRecordID.Text);
             controller.Update(lkd);
             Dialog.ShowNotification("Cập nhật công thức lương thành công");
             wdAddWindow.Hide();
         }
         else
         {
             controller.Insert(lkd);
             Dialog.ShowNotification("Thêm mới công thức lương thành công");
             if (e.ExtraParams["Close"] == "True")
             {
                 wdAddWindow.Hide();
             }
             else
             {
                 RM.RegisterClientScriptBlock("rsf", "ResetForm();");
             }
         }
         GridCongThucLuongKinhDoanh.Reload();
     }
     catch (Exception ex)
     {
         Dialog.ShowError("Có lỗi xảy ra: " + ex.Message);
     }
 }
Beispiel #4
0
 public void Update(DAL.CongThucLuongKinhDoanh lkd)
 {
     DAL.CongThucLuongKinhDoanh temp = dataContext.CongThucLuongKinhDoanhs.SingleOrDefault(t => t.ID == lkd.ID);
     if (temp != null)
     {
         temp.Nhom        = lkd.Nhom;
         temp.MaChucVu    = lkd.MaChucVu;
         temp.PhanTramTu  = lkd.PhanTramTu;
         temp.PhanTramDen = lkd.PhanTramDen;
         temp.SanLuongTu  = lkd.SanLuongTu;
         temp.SanLuongDen = lkd.SanLuongDen;
         temp.TienThuong  = lkd.TienThuong;
         Save();
     }
 }