public void LoadData() { int id = Request.QueryString["id"].ToInt(0); if (id > 0) { var d = VariableController.GetByID(id); if (d != null) { ViewState["ID"] = id; txtCustomerName.Text = d.VariableName; chkIsHidden.Checked = Convert.ToBoolean(d.IsHidden); } } }
protected void btnLogin_Click(object sender, EventArgs e) { string username = Request.Cookies["userLoginSystem"].Value; var acc = AccountController.GetByUsername(username); if (acc != null) { if (acc.RoleID == 0) { int id = ViewState["ID"].ToString().ToInt(0); if (id > 0) { var d = VariableController.GetByID(id); if (d != null) { VariableController.Update(id, txtCustomerName.Text, "", chkIsHidden.Checked, DateTime.Now, username); PJUtils.ShowMessageBoxSwAlert("Cập nhật thành công", "s", true, Page); } } } } }
protected void btnLogin_Click(object sender, EventArgs e) { DateTime currentDate = DateTime.Now; string username = Request.Cookies["usernameLoginSystem"].Value; int id = Convert.ToInt32(ViewState["ID"]); if (id != 0) { var variname = VariableController.GetByID(id); if (variname != null) { var acc = AccountController.GetByUsername(username); if (acc != null) { if (acc.RoleID == 0) { int ID = id; string variableName = variname.VariableName.Trim(); string VariableValue = txtVariableValue.Text.Trim(); string SKUText = txtSKUText.Text.Trim(); var check = VariableValueController.GetByValueAndSKUText(id, VariableValue, SKUText); if (check != null) { lblError.Text = "Tên thuộc tính hoặc SKUText đã tồn tại vui lòng chọn tên khác."; lblError.Visible = true; } else { lblError.Visible = false; VariableValueController.Insert(ID, variableName, VariableValue, false, currentDate, username, SKUText); PJUtils.ShowMessageBoxSwAlert("Thêm thuộc tính thành công", "s", true, Page); Response.Redirect("quan-ly-thuoc-tinh-san-pham?id=" + id); } } } } } }