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()); } }
public override void DataBind() { if (Request["ID"] != null && Request["ID"].ToString() != "" && Request["ID"].ToString() != String.Empty) { if (CommonLib.IsNumeric(Request["ID"]) == true) { HPCBusinessLogic.DAL.T_CustomersDAL dal = new HPCBusinessLogic.DAL.T_CustomersDAL(); int _id = Convert.ToInt32(Request["ID"].ToString()); PopulateItem(_id); } } }
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(); } }