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); } }
protected void btnDelete_Click(object sender, DirectEventArgs e) { try { CongThucLuongKinhDoanhController controller = new CongThucLuongKinhDoanhController(); SelectedRowCollection selecteds = checkboxSelection.SelectedRows; foreach (var item in selecteds) { controller.Delete(int.Parse(item.RecordID)); } GridCongThucLuongKinhDoanh.Reload(); btnEditCongThuc.Disabled = true; btnXoaCongThuc.Disabled = true; Dialog.ShowNotification("Xóa thành công dữ liệu chọn"); } catch (Exception ex) { Dialog.ShowError("Có lỗi xảy ra: " + ex.Message); } }