protected void btnUpdate_Click(object sender, EventArgs e) { int index = 0; foreach (GridViewRow gvr in GridView1.Rows) { if (index > 0) { TextBox type_vi = ((TextBox)gvr.FindControl("Val")); type_vi.Enabled = false; TextBox type_en = ((TextBox)gvr.FindControl("Description")); type_en.Enabled = false; // Update to SQL t_SysParam entity_vi = new t_SysParam { Val = type_vi.Text, Description = type_en.Text }; string Id = (gvr.FindControl("Id") as HiddenField).Value; bool updateStatus = sysParamBL.Update(entity_vi, int.Parse(Id)); } index++; } }
protected void Page_Load(object sender, EventArgs e) { //ntf.VisibleOnPageLoad = false; if (!IsPostBack) { // Pi-solution developer t_SysParam logo = sysParamBL.FindSingle(s => s.Name == "img_logo"); imgLogo.Src = (logo == null)? "" : logo.Val; t_SysParam companyName = sysParamBL.FindSingle(s => s.Name == "company_name"); lbCompany.Text = (companyName == null) ? "" : companyName.Val; TextBox TextBoxUserName = Login1.FindControl("UserName") as TextBox; TextBoxUserName.Focus(); } }
public bool Update(t_SysParam entity, int id) { try { t_SysParam content = FindSingle(x => x.ID == id); //content.ControlId = entity.ControlId; content.Val = entity.Val; content.Description = entity.Description; context.SaveChanges(); return(true); } catch (Exception) { return(false); } }
protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { ntf.VisibleOnPageLoad = true; t_SysParam system = sysParamBL.FindSingle(x => x.ID == contentId); system.Description = txtDescription.Text; string logoName = imgNewLogo.Value; if (!string.IsNullOrEmpty(logoName)) { system.Val = string.Format("/_imgs/System/{0}", logoName); } bool updateStatus = sysParamBL.Update(system, contentId); imgLogo.ImageUrl = system.Val; string message = (updateStatus) ? "Cập nhật thành công" : "Cập nhật không thành công"; ntf.Text = message; } }
protected void Page_Load(object sender, EventArgs e) { string linkID = string.IsNullOrEmpty(Request.QueryString["Id"]) ? "0" : Request.QueryString["Id"]; if (!IsPostBack) { // Load language contents contentId = int.Parse(linkID); t_SysParam system = sysParamBL.FindSingle(x => x.ID == contentId); // Vietnamese language zone if (system != null) { txtVal.Text = system.Val; txtDescription.Text = system.Description; imgLogo.ImageUrl = system.Val; } // Required messgage warning RequiredFieldValidator1.ErrorMessage = "** Required value"; } }
public bool Update(t_SysParam entity, int id) { return(sysParamRepository.Update(entity, id)); }
public void Remove(t_SysParam entity) { throw new NotImplementedException(); }
public bool Add(t_SysParam entity) { throw new NotImplementedException(); }