protected void linkSave_Click(object sender, EventArgs e) { if (Page.IsValid) { if (txt_Name.Text.Length > 125) { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('Bạn nhập quá độ dài cho phép!');", true); return; } HPCBusinessLogic.DAL.T_CustomersDAL _cateDAL = new HPCBusinessLogic.DAL.T_CustomersDAL(); HPCInfo.T_Customers _catObj = GetObject(); int _return = _cateDAL.InsertT_Customers(_catObj); if (_catObj.ID == 0) { string strLog = "[Thêm mới]-->[Thao tác thêm mới khách hàng]ID:" + _return + " ]"; WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Add News]", Request["Menu_ID"].ToString(), strLog, 0, ConstAction.TSAnh); //System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + Global.RM.GetString("UpdateSuccessfully") + "');", true); } else { string strLog = "[Sửa danh sách KH]-->[Thao tác sửa][ID:" + Page.Request["id"].ToString() + " ]"; WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, "[Update]", Request["Menu_ID"].ToString(), strLog, 0, ConstAction.TSAnh); //System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + Global.RM.GetString("UpdateSuccessfully") + "');", true); } Page.Response.Redirect("~/Quangcao/CustomerList.aspx?Menu_ID=" + this.Page.Request["Menu_ID"].ToString()); } }
private void PopulateItem(int _id) { HPCInfo.T_Customers _cateObj = new HPCInfo.T_Customers(); HPCBusinessLogic.DAL.T_CustomersDAL _cateDAL = new HPCBusinessLogic.DAL.T_CustomersDAL(); _cateObj = _cateDAL.load_T_Customers(_id); if (_cateObj != null) { txt_Name.Text = _cateObj.Name.ToString(); Txt_Address.Text = _cateObj.Address.ToString(); txt_Phone.Text = _cateObj.Phone.ToString(); txt_Email.Text = _cateObj.Email.ToString(); txt_Fax.Text = _cateObj.Fax.ToString(); } }
private HPCInfo.T_Customers GetObject() { HPCInfo.T_Customers _objCate = new HPCInfo.T_Customers(); if (Page.Request.Params["id"] != null) { _objCate.ID = int.Parse(Page.Request["id"].ToString()); } else { _objCate.ID = 0; } _objCate.Name = UltilFunc.CleanFormatTags(txt_Name.Text); _objCate.Address = UltilFunc.CleanFormatTags(Txt_Address.Text); _objCate.Phone = UltilFunc.CleanFormatTags(txt_Phone.Text); _objCate.Fax = UltilFunc.CleanFormatTags(txt_Fax.Text); _objCate.Email = UltilFunc.CleanFormatTags(txt_Email.Text); _objCate.Date_Created = DateTime.Now; _objCate.Date_Modify = DateTime.Now; _objCate.User_Created = _user.UserID; _objCate.User_Modify = _user.UserID; return(_objCate); }