public void grdList_EditCommand(object source, DataGridCommandEventArgs e) { #region GhiLog Lichsu_Thaotac_HethongDAL actionDAL = new Lichsu_Thaotac_HethongDAL(); T_Lichsu_Thaotac_Hethong action = new T_Lichsu_Thaotac_Hethong(); action.Ma_Nguoidung = _user.UserID; action.TenDaydu = _user.UserFullName; action.HostIP = IpAddress(); action.NgayThaotac = DateTime.Now; #endregion HPCBusinessLogic.DAL.YeucauDAL objDAL = new HPCBusinessLogic.DAL.YeucauDAL(); if (e.CommandArgument.ToString().ToLower() == "edit") { int cusID = Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString()); Response.Redirect("~/Phathanh/YeucauPHEdit.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + cusID); } if (e.CommandArgument.ToString().ToLower() == "isstatus") { double _ID = Convert.ToDouble(this.grdList.DataKeys[e.Item.ItemIndex].ToString()); Int16 _check = objDAL.GetOneFromT_YeuCauByID(_ID).Trangthai; if (_check == 0) { objDAL.UpdateinfoT_Yeucau(" [Trangthai] = 1 where ID = " + _ID.ToString()); action.Thaotac = "[Cập nhật trạng thái bảng T_Yeucau][ID:" + _ID.ToString() + " ][Trangthai = 1]"; Danhsach_Yeucau(); } if (_check == 1) { bool _bool; _bool = IsHopdongExsits(Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString())); if (_bool == false) { objDAL.UpdateinfoT_Yeucau(" [Trangthai] = 0 where ID = " + _ID.ToString()); action.Thaotac = "[Cập nhật trạng thái bảng T_Yeucau][ID:" + _ID.ToString() + " ][Trangthai = 0]"; } else { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('Yêu cầu này đã làm hợp đồng!');", true); return; } Danhsach_Yeucau(); } } if (e.CommandArgument.ToString().ToLower() == "delete") { bool _bool; _bool = IsHopdongExsits(Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString())); if (_bool == false) { objDAL.DeleteFromT_YeuCauQCByID(Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString())); action.Thaotac = "[Thao tác Xóa Trong Bảng T_Yeucau][ID:" + this.grdList.DataKeys[e.Item.ItemIndex].ToString() + " ]"; Danhsach_Yeucau(); } else { return; } } }
private void GetItem(double _id) { T_Yeucau _objYeucau = new T_Yeucau(); HPCBusinessLogic.DAL.YeucauDAL _yeucauDAL = new HPCBusinessLogic.DAL.YeucauDAL(); _objYeucau = _yeucauDAL.GetOneFromT_YeuCauByID(_id); if (_id > 0) { this.ddl_TenKH.SelectedIndex = UltilFunc.GetIndexControl(ddl_TenKH, _objYeucau.Ma_Khachhang.ToString()); this.ddl_TenKH.Enabled = false; } this.txt_Tieude.Text = _objYeucau.TenQuangCao; this.ckeNoidung.Text = _objYeucau.NoidungQC; }