public CascadingDropDownNameValue[] GetCarBrandByParent(string knownCategoryValues, string category, string contextKey) { try { ListCascading = new List<CascadingDropDownNameValue>(); lafien_products_dbEntities db = new lafien_products_dbEntities(); StringDictionary itmsIdList = AjaxControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); var itmId = Convert.ToInt32(itmsIdList["CatID"]); var catList = db.CarCategories.Where(x => x.CatParentID == itmId).OrderBy(x => x.CatName).ToList(); foreach (var itm in catList) { string itemIdString = itm.CatID.ToString(); string nameString = itm.CatName.ToString(); ListCascading.Add(new CascadingDropDownNameValue(nameString, itemIdString)); } return ListCascading.ToArray(); } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { txtError.Visible = false; txtError.Text = string.Empty; //Session.Abandon(); if (IsPostBack) { lafien_products_dbEntities db = new lafien_products_dbEntities(); HashEncryption hasEn = new HashEncryption(); string enPass = hasEn.SHA256Hash(txtPassword.Value); Account obj = db.Accounts.FirstOrDefault(x => x.UserName == txtUsername.Value && x.Password == enPass); if (obj != null) { HttpContext.Current.Session["LoggedAccount"] = obj; Response.Redirect("~/Pages/Default.aspx"); } else { txtError.Visible = true; txtError.Text = "Invalid Username or Password!"; } } }
protected void Page_Load(object sender, EventArgs e) { txtError.Visible = false; txtError.Text = string.Empty; //Session.Abandon(); if (IsPostBack) { lafien_products_dbEntities db = new lafien_products_dbEntities(); HashEncryption hasEn = new HashEncryption(); string enPass = hasEn.SHA256Hash(txtPassword.Value); Account obj = db.Accounts.FirstOrDefault(x => x.UserName == txtUsername.Value && x.Password == enPass); if (obj != null) { HttpContext.Current.Session["LoggedAccount"] = obj; Response.Redirect("~/Pages/Default.aspx"); } else { txtError.Visible = true; txtError.Text = "Invalid Username or Password!"; } } }
public JsonResult GetCarBrandByParent(string knownCategoryValues, string category, string contextKey) { try { ListCascading = new List <CascadingDropDownNameValue>(); lafien_products_dbEntities db = new lafien_products_dbEntities(); StringDictionary itmsIdList = AjaxControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); var itmId = Convert.ToInt32(itmsIdList["undefined"]); var catList = db.CarCategories.Where(x => x.CatParentID == itmId).OrderBy(x => x.CatName).ToList(); foreach (var itm in catList) { string itemIdString = itm.CatID.ToString(); string nameString = itm.CatName.ToString(); ListCascading.Add(new CascadingDropDownNameValue(nameString, itemIdString)); } return(Json(ListCascading.ToArray(), JsonRequestBehavior.AllowGet)); } catch (Exception ex) { throw ex; } }