protected void btnSaveThongTinChung_Click(object sender, EventArgs e) { try { DateTime?dtNopDon = null; if (txtNgayNopDon.Text.Trim() != "") { dtNopDon = DateTime.Parse(txtNgayNopDon.Text.Trim(), ci); } DateTime?dtUuTien = null; if (txtNgayUuTien.Text.Trim() != "") { dtUuTien = DateTime.Parse(txtNgayUuTien.Text.Trim(), ci); } DateTime?dtChungNhan = null; if (txtNgayChungNhan.Text.Trim() != "") { dtChungNhan = DateTime.Parse(txtNgayChungNhan.Text.Trim(), ci); } DateTime?dtCongBo = null; if (txtNgayCongBo.Text.Trim() != "") { dtCongBo = DateTime.Parse(txtNgayCongBo.Text.Trim(), ci); } DateTime?dtQuyetDinh = null; if (txtNgayQuyetDinh.Text.Trim() != "") { dtQuyetDinh = DateTime.Parse(txtNgayQuyetDinh.Text.Trim(), ci); } DateTime dt = DateTime.Now; if (hdNhanHieuID.Value == "0") { if (UserInfo.IsSuperUser || UserInfo.IsInRole("Administrators") || cont.HasRole(UserInfo.Roles, "QuanLy")) { cont.NhanHieu_Insert(txtTenNhanHieu.Text, int.Parse(ddlNuocDangKy.SelectedValue), txtSoDon.Text, dtNopDon, dtUuTien, txtSoChungNhan.Text, dtChungNhan, dtCongBo, txtSoQuyetDinh.Text, dtQuyetDinh, dt, UserId, website, dt, UserId, website, txtNote.Text, int.Parse(ddlNhanHieuGoc.SelectedValue), "", out ID); } else { cont.NhanHieu_Insert(txtTenNhanHieu.Text, int.Parse(ddlNuocDangKy.SelectedValue), txtSoDon.Text, dtNopDon, dtUuTien, txtSoChungNhan.Text, dtChungNhan, dtCongBo, txtSoQuyetDinh.Text, dtQuyetDinh, dt, UserId, website, dt, UserId, website, txtNote.Text, int.Parse(ddlNhanHieuGoc.SelectedValue), website, out ID); } if (ID == -1) { ID = 0; } SetNhanHieuID(ID.ToString()); hdUnit.Value = website; } else { cont.NhanHieu_Update(int.Parse(hdNhanHieuID.Value), txtTenNhanHieu.Text, int.Parse(ddlNuocDangKy.SelectedValue), txtSoDon.Text, dtNopDon, dtUuTien, txtSoChungNhan.Text, dtChungNhan, dtCongBo, txtSoQuyetDinh.Text, dtQuyetDinh, dt, UserId, website, txtNote.Text, int.Parse(ddlNhanHieuGoc.SelectedValue)); SetNhanHieuID(ID.ToString()); } SetButtonStatus(); } catch (Exception ex) { } }