protected void GVDoituong_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 _ma = (TextBox)GVDoituong.FooterRow.FindControl("txt_MaDoituong"); TextBox _ten = (TextBox)GVDoituong.FooterRow.FindControl("txt_Tendoituong"); TextBox _englishname = (TextBox)GVDoituong.FooterRow.FindControl("txt_EnglishName"); TextBox _stt = (TextBox)GVDoituong.FooterRow.FindControl("txt_STT"); //Label _MaDT = (Label)GVDoituong.FooterRow.FindControl("lblMaDT_Error"); //Label _STT = (Label)GVDoituong.FooterRow.FindControl("lblSTT_Error"); int _return; DoituongDAL _doituongDAL = new DoituongDAL(); if (_doituongDAL.Check_Madoituong(0, _ma.Text.Trim()) > 0) { lblMessError.Text = "Mã đối tượng đã tồn tại"; GVDoituong.ShowFooter = true; BindList_Doituong(); } else if (_doituongDAL.Check_STT(0, Convert.ToInt32(_stt.Text.Trim())) > 0) { lblMessError.Text = "Số thứ tự đã tồn tại"; GVDoituong.ShowFooter = true; BindList_Doituong(); } else { _dt = new T_Doituong(); _dt.ID = 0; _dt.Ma_Doituong = _ma.Text.Trim(); _dt.Ten_Doituong = _ten.Text.Trim(); _dt.EnglishName = _englishname.Text.Trim(); if (!String.IsNullOrEmpty(_stt.Text.Trim())) { _dt.STT = Convert.ToInt32(_stt.Text.Trim()); } _dt.Ngaysua = DateTime.Now; _dt.Nguoitao = _user.UserID; _dt.Ngaytao = DateTime.Now; _dt.Nguoisua = _user.UserID; _return = _doituongDAL.InsertT_Doituong(_dt); action.Thaotac = "[Thêm mới đối tượng]-->[Mã mã đối tượng:" + _return.ToString() + " ]"; actionDAL.InserT_Lichsu_Thaotac_Hethong(action); BindList_Doituong(); } } }
protected void GVDoituong_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(GVDoituong.DataKeys[e.RowIndex].Value.ToString()); TextBox _ma = (TextBox)GVDoituong.Rows[e.RowIndex].FindControl("txt_MaDoituong"); TextBox _ten = (TextBox)GVDoituong.Rows[e.RowIndex].FindControl("txt_Tendoituong"); TextBox _englishname = (TextBox)GVDoituong.Rows[e.RowIndex].FindControl("txt_EnglishName"); TextBox _stt = (TextBox)GVDoituong.Rows[e.RowIndex].FindControl("txt_STT"); Label _MaDT = (Label)GVDoituong.Rows[e.RowIndex].FindControl("lblMaDT_Error"); Label _STT = (Label)GVDoituong.Rows[e.RowIndex].FindControl("lblSTT_Error"); DoituongDAL _dtDAL = new DoituongDAL(); if (_dtDAL.Check_Madoituong(_id, _ma.Text.Trim()) > 0) { _MaDT.Text = "Mã đối tượng đã tồn tại"; return; } else if (_dtDAL.Check_STT(_id, Convert.ToInt32(_stt.Text.Trim())) > 0) { _STT.Text = "Số thứ tự đã tồn tại"; return; } else { _dt = new T_Doituong(); _dt.ID = _id; _dt.Ma_Doituong = _ma.Text.Trim(); _dt.Ten_Doituong = _ten.Text.Trim(); _dt.EnglishName = _englishname.Text.Trim(); if (!String.IsNullOrEmpty(_stt.Text.Trim())) { _dt.STT = Convert.ToInt32(_stt.Text.Trim()); } _dt.Ngaysua = DateTime.Now; _dt.Nguoitao = _user.UserID; _dt.Ngaytao = DateTime.Now; _dt.Nguoisua = _user.UserID; _return = _dtDAL.InsertT_Doituong(_dt); action.Thaotac = "[Sửa đối tượng]-->[Mã đối tượng:" + _return.ToString() + " ]"; actionDAL.InserT_Lichsu_Thaotac_Hethong(action); GVDoituong.EditIndex = -1; BindList_Doituong(); } }
protected void GVDoituong_OnRowCommand(object source, GridViewCommandEventArgs e) { HPCBusinessLogic.Lichsu_Thaotac_HethongDAL actionDAL = new Lichsu_Thaotac_HethongDAL(); T_Lichsu_Thaotac_Hethong action = new T_Lichsu_Thaotac_Hethong(); if (e.CommandName.Equals("AddNew")) { TextBox _ma = (TextBox)GVDoituong.FooterRow.FindControl("txt_MaDoituong"); TextBox _ten = (TextBox)GVDoituong.FooterRow.FindControl("txt_Tendoituong"); TextBox _stt = (TextBox)GVDoituong.FooterRow.FindControl("txt_STT"); int _return; DoituongDAL _doituongDAL = new DoituongDAL(); if (_doituongDAL.Check_Madoituong(0, _ma.Text.Trim()) > 0) { lblMessError.Text = "Mã đối tượng đã tồn tại"; GVDoituong.ShowFooter = true; BindList_Doituong(); } else if (_doituongDAL.Check_STT(0, Convert.ToInt32(_stt.Text.Trim())) > 0) { lblMessError.Text = "Số thứ tự đã tồn tại"; GVDoituong.ShowFooter = true; BindList_Doituong(); } else { _dt = new T_Doituong(); _dt.ID = 0; _dt.Ma_Doituong = _ma.Text.Trim(); _dt.Ten_Doituong = _ten.Text.Trim(); if (!String.IsNullOrEmpty(_stt.Text.Trim())) { _dt.STT = Convert.ToInt32(_stt.Text.Trim()); } _dt.Ngaysua = DateTime.Now; _dt.Nguoitao = _user.UserID; _dt.Ngaytao = DateTime.Now; _dt.Nguoisua = _user.UserID; _return = _doituongDAL.InsertT_Doituong(_dt); action.Thaotac = "[Thêm mới đối tượng]-->[Mã mã đối tượng:" + _return.ToString() + " ]"; actionDAL.InserT_Lichsu_Thaotac_Hethong(action); lblMessError.Text = ""; BindList_Doituong(); BinQuytrinhtheoAnPham(); } UltilFunc.RunJavaScriptCode("$.fx.speeds._default = 10; var dlg = jQuery('#dialog').dialog({draggable: true, resizable: true, hide: 'scale', modal: true, width: 500 }); dlg.parent().appendTo(jQuery('form:first'));"); } }
protected void GVDoituong_RowUpdating(object source, 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(GVDoituong.DataKeys[e.RowIndex].Value.ToString()); TextBox txtMaDT = (TextBox)GVDoituong.Rows[e.RowIndex].FindControl("txt_MaDoituong"); TextBox txtTenDT = (TextBox)GVDoituong.Rows[e.RowIndex].FindControl("txt_Tendoituong"); TextBox txtSTT = (TextBox)GVDoituong.Rows[e.RowIndex].FindControl("txt_STT"); Label _MaDT = (Label)GVDoituong.Rows[e.RowIndex].FindControl("lblMaDT_Error"); Label _STT = (Label)GVDoituong.Rows[e.RowIndex].FindControl("lblSTT_Error"); DoituongDAL _dtDAL = new DoituongDAL(); try { int.Parse(txtSTT.Text); } catch (Exception) { lblMessError.Text = "Nhập lại số thứ tự"; throw; } if (_dtDAL.Check_Madoituong(_id, txtMaDT.Text.Trim()) > 0) { _MaDT.Text = "Mã đối tượng đã tồn tại"; return; } else if (_dtDAL.Check_STT(_id, Convert.ToInt32(txtSTT.Text.Trim())) > 0) { _STT.Text = "Số thứ tự đã tồn tại"; return; } else { _dt = new T_Doituong(); _dt.ID = _id; _dt.Ma_Doituong = txtMaDT.Text.Trim(); _dt.Ten_Doituong = txtTenDT.Text.Trim(); if (!String.IsNullOrEmpty(txtSTT.Text.Trim())) { _dt.STT = Convert.ToInt32(txtSTT.Text.Trim()); } _dt.Ngaysua = DateTime.Now; _dt.Nguoitao = _user.UserID; _dt.Ngaytao = DateTime.Now; _dt.Nguoisua = _user.UserID; _return = _dtDAL.InsertT_Doituong(_dt); action.Thaotac = "[Sửa đối tượng]-->[Mã đối tượng:" + _return.ToString() + " ]"; actionDAL.InserT_Lichsu_Thaotac_Hethong(action); lblMessError.Text = ""; GVDoituong.EditIndex = -1; BindList_Doituong(); BinQuytrinhtheoAnPham(); } UltilFunc.RunJavaScriptCode("$.fx.speeds._default = 10; var dlg = jQuery('#dialog').dialog({draggable: true, resizable: true, hide: 'scale', modal: true, width: 500 }); dlg.parent().appendTo(jQuery('form:first'));"); }