protected void btnCapNhatThanhToan_Click(object sender, EventArgs e) { if (cmbKyThuat.Text != "" && txtTienThanhToan.Text != "") { string IDKyThuat = cmbKyThuat.Value.ToString(); double SoTienThanhToan = double.Parse(txtTienThanhToan.Text); string NoiDung = txtNoiDung.Text == null ? "" : txtNoiDung.Text; DateTime NgayThanhToan = DateTime.Parse(dateNgayThanhToan.Text); if (double.Parse(txtNoHienTai.Text.ToString()) < double.Parse(txtTienThanhToan.Text.ToString())) { txtTienThanhToan.Text = ""; txtTienThanhToan.Focus(); Response.Write("<script language='JavaScript'> alert('Số tiền trả vượt quá số tiền nợ.'); </script>"); } else { data = new dtNhanVienKyThuat(); object ID = data.ThemChiTietCongNo(IDKyThuat, SoTienThanhToan, NoiDung, NgayThanhToan); if (ID != null) { data.CapNhatCongNo(IDKyThuat, SoTienThanhToan); Response.Redirect("CongNoKyThuat.aspx"); } } } else { Response.Write("<script language='JavaScript'> alert('Vui lòng nhập đủ thông tin.'); </script>"); } }
protected void gridDanhSach_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { string ID = e.Keys[0].ToString(); data = new dtNhanVienKyThuat(); data.Xoa(ID); e.Cancel = true; gridDanhSach.CancelEdit(); LoadGrid(); }
protected void gridDanhSach_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { string TenKyThuat = e.NewValues["TenKyThuat"].ToString(); string IDChietKhau = e.NewValues["IDChietKhau"].ToString(); string DiaChi = e.NewValues["DiaChi"] == null ? "" : e.NewValues["DiaChi"].ToString(); string DienThoai = e.NewValues["DienThoai"] == null ? "" : e.NewValues["DienThoai"].ToString(); string GhiChu = e.NewValues["GhiChu"] == null ? "" : e.NewValues["GhiChu"].ToString(); data = new dtNhanVienKyThuat(); data.Them(TenKyThuat, IDChietKhau, DiaChi, DienThoai, GhiChu); e.Cancel = true; gridDanhSach.CancelEdit(); LoadGrid(); }
private void LoadGrid() { data = new dtNhanVienKyThuat(); gridDanhSach.DataSource = data.DanhSach(); gridDanhSach.DataBind(); }