protected void GVKichthuoc_RowUpdating(object sender, GridViewUpdateEventArgs 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 int _return; int _id = Convert.ToInt32(GVKichthuoc.DataKeys[e.RowIndex].Value.ToString()); TextBox _ten = (TextBox)GVKichthuoc.Rows[e.RowIndex].FindControl("txt_Kichthuoc"); TextBox _mota = (TextBox)GVKichthuoc.Rows[e.RowIndex].FindControl("txt_mota"); DropDownList _ddlAnpham = (DropDownList)GVKichthuoc.Rows[e.RowIndex].FindControl("ddl_AnPham"); KichthuocDAL _ktDAL = new KichthuocDAL(); _kt = new T_Kichthuoc(); _kt.Ma_Kichthuoc = _id; _kt.Ten_Kichthuoc = _ten.Text.Trim(); _kt.Mota = _mota.Text.Trim(); if (Convert.ToInt32(_ddlAnpham.SelectedValue.ToString()) > 0) { _kt.Ma_Anpham = Convert.ToInt32(_ddlAnpham.SelectedValue.ToString()); } else { _kt.Ma_Anpham = 0; } _kt.Ngaysua = DateTime.Now; _kt.Nguoitao = _user.UserID; _kt.Ngaytao = DateTime.Now; _kt.Nguoisua = _user.UserID; _return = _ktDAL.InsertT_Kichthuoc(_kt); action.Thaotac = "[Sửa kích thước]-->[Mã kích thước:" + _return.ToString() + " ]"; actionDAL.InserT_Lichsu_Thaotac_Hethong(action); GVKichthuoc.EditIndex = -1; BindList_Kichthuoc(); }
protected void GVKichthuoc_OnRowCommand1(object sender, GridViewCommandEventArgs 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 if (e.CommandName.Equals("AddNew")) { TextBox _ten = (TextBox)GVKichthuoc.FooterRow.FindControl("txt_Kichthuoc"); TextBox _mota = (TextBox)GVKichthuoc.FooterRow.FindControl("txt_mota"); DropDownList _ddlAnpham = (DropDownList)GVKichthuoc.FooterRow.FindControl("ddl_AnPham"); int _return; KichthuocDAL _kichthuocDAL = new KichthuocDAL(); _kt = new T_Kichthuoc(); _kt.Ma_Kichthuoc = 0; _kt.Ten_Kichthuoc = _ten.Text.Trim(); _kt.Mota = _mota.Text.Trim(); if (Convert.ToInt32(_ddlAnpham.SelectedValue.ToString()) > 0) { _kt.Ma_Anpham = Convert.ToInt32(_ddlAnpham.SelectedValue.ToString()); } else { _kt.Ma_Anpham = 0; } _kt.Ngaysua = DateTime.Now; _kt.Nguoitao = _user.UserID; _kt.Ngaytao = DateTime.Now; _kt.Nguoisua = _user.UserID; _return = _kichthuocDAL.InsertT_Kichthuoc(_kt); action.Thaotac = "[Thêm mới kích thước]-->[Mã kích thước:" + _return.ToString() + " ]"; actionDAL.InserT_Lichsu_Thaotac_Hethong(action); BindList_Kichthuoc(); } }