private void cboCategory_SelectedIndexChanged(object sender, EventArgs e) { if (cboCategory.SelectedIndex != 0) { int categoryid = Convert.ToInt32(cboCategory.SelectedValue.ToString()); List <SubCategoryDetails> lstsubcat = blsc.GetAllSubCategory().Where(s => s.CategoryId == categoryid).ToList(); if (lstsubcat.Count > 0) { cboSubCategory.Enabled = true; SubCategoryDetails scd = new SubCategoryDetails(); scd.SubCategoryName = "Choose Sub-Category"; lstsubcat.Insert(0, scd); cboSubCategory.DataSource = lstsubcat; cboSubCategory.DisplayMember = "SubCategoryName"; cboSubCategory.ValueMember = "SubCatId"; } else { cboSubCategory.Enabled = false; } } else { cboSubCategory.Enabled = false; } }
public ActionResult SubCategoryMaster() { List <SelectListItem> objCategoryList = new List <SelectListItem>(); List <SelectListItem> objChildCategoryList = new List <SelectListItem>(); var result = objProductManager.GetCategoryList("Y"); SubCategoryDetails model = new SubCategoryDetails(); bool f = true; foreach (var item in result) { SelectListItem tempobj = new SelectListItem(); //SelectListItem tempobj1 = new SelectListItem(); tempobj.Text = item.CategoryName; tempobj.Value = item.CategoryId.ToString(); if (f == true) { f = false; model.CategoryId = int.Parse(item.CategoryId.ToString()); //model.SubCatId = int.Parse(item.ToString()); } objCategoryList.Add(tempobj); } ViewBag.ListCategory = objCategoryList; // ViewBag.ListChildCategory = objCategoryList; model.IsAdd = "Add"; model.IsActive = true; return(View(model)); }
public int UpdateSubCategory(SubCategoryDetails scd) { tblSubCategory tsc = _db.tblSubCategories.Where(sc => sc.SubCatId == scd.SubCatId).FirstOrDefault(); tsc.CategoryId = scd.CategoryId; tsc.SubCategoryName = scd.SubCategoryName; return(_db.SaveChanges()); }
public int AddNewSubCategory(SubCategoryDetails scd) { tblSubCategory tsc = new tblSubCategory(); tsc.CategoryId = scd.CategoryId; tsc.SubCategoryName = scd.SubCategoryName; _db.tblSubCategories.Add(tsc); return(_db.SaveChanges()); }
private void DataGridView1_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { subcategoryid = Convert.ToInt32(DataGridView1.CurrentRow.Cells["colSubCatId"].Value.ToString()); SubCategoryDetails scd = blsc.GetAllSubCategory().Where(sc => sc.SubCatId == subcategoryid).FirstOrDefault(); txtSubCategoryName.Text = scd.SubCategoryName; cboCategoryName.SelectedValue = scd.CategoryId; btnAddNewSubCategory.Enabled = false; btnUpdateSubCategory.Enabled = true; btnDeleteSubCategory.Enabled = true; }
public ActionResult SaveSubCategoryMaster(SubCategoryDetails model) { ResponseDetail objResponse = new ResponseDetail(); if (model != null) { if (Session["LoginUser"] != null) { model.UserDetails = Session["LoginUser"] as User; } objResponse = objProductManager.AddSubCategoryDetails(model); } return(Json(objResponse, JsonRequestBehavior.AllowGet)); }
private void btnUpdateSubCategory_Click(object sender, EventArgs e) { if (txtSubCategoryName.Text == "") { MessageBox.Show("Please Enter Sub-Category Name", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtSubCategoryName.Focus(); return; } if (cboCategoryName.SelectedIndex == 0) { MessageBox.Show("Please Select Category", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); cboCategoryName.Focus(); return; } SubCategoryDetails scd = new SubCategoryDetails(); scd.SubCategoryName = txtSubCategoryName.Text; scd.CategoryId = Convert.ToInt32(cboCategoryName.SelectedValue.ToString()); scd.SubCatId = subcategoryid; bool isexists = blsc.CheckSubCategory(txtSubCategoryName.Text); if (isexists) { MessageBox.Show("Sub-Category Name Already Exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtSubCategoryName.Text = ""; txtSubCategoryName.Focus(); } else { int i = blsc.UpdateSubCategory(scd); if (i > 0) { LoadGrid(); MessageBox.Show("Sub-Category Updated Successfully", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information); btnAddNewSubCategory.Enabled = true; btnUpdateSubCategory.Enabled = false; btnDeleteSubCategory.Enabled = false; txtSubCategoryName.Text = ""; txtSubCategoryName.Focus(); cboCategoryName.SelectedIndex = 0; } } }
public ActionResult SubCategoryDropdown() { var subcategorydetail = new SubCategoryDetails(); Dictionary <string, object> uf = new Dictionary <string, object>(); int catId = 1; if (Request.QueryString.Keys.Count > 0) { catId = Convert.ToInt32(Request.QueryString["CateogryId"]); } subcategorydetail.SubCategories = _Repository.GetActiveSubCategoriesByCategoryId(catId); return(View(subcategorydetail)); }
public ActionResult SaveSubCategoryMaster(SubCategoryDetails model) { ResponseDetail objResponse = new ResponseDetail(); if (model != null) { if (Session["LoginUser"] != null) { model.UserDetails = Session["LoginUser"] as User; } objResponse = objProductManager.AddSubCategoryDetails(model); //Added log string hostName = Dns.GetHostName(); string myIP = Dns.GetHostEntry(hostName).AddressList[0].ToString(); string currentDate = DateTime.Now.ToString("yyyyMMddHHmmssfff"); objLogManager.SaveLog(Session["LoginUser"] as User, model.IsAdd + " Sub Category -" + model.subCategoryName, myIP + currentDate); } return(Json(objResponse, JsonRequestBehavior.AllowGet)); }
public ActionResult SubCategoryMaster() { List <SelectListItem> objCategoryList = new List <SelectListItem>(); List <SelectListItem> objChildCategoryList = new List <SelectListItem>(); var result = objProductManager.GetCategoryList("Y"); SubCategoryDetails model = new SubCategoryDetails(); bool f = true; foreach (var item in result) { SelectListItem tempobj = new SelectListItem(); //SelectListItem tempobj1 = new SelectListItem(); tempobj.Text = item.CategoryName; tempobj.Value = item.CategoryId.ToString(); if (f == true) { f = false; model.CategoryId = int.Parse(item.CategoryId.ToString()); //model.SubCatId = int.Parse(item.ToString()); } objCategoryList.Add(tempobj); } ViewBag.ListCategory = objCategoryList; // ViewBag.ListChildCategory = objCategoryList; model.IsAdd = "Add"; model.IsActive = true; var AccessTo = new UserController().UserCanAccess((Session["LoginUser"] as User).UserId, "CategoryMaster"); if (!string.IsNullOrEmpty(AccessTo)) { ViewBag.UserCanAccess = AccessTo; return(View(model)); } else { return(RedirectToAction("Dashboard", "Home")); } }
public ActionResult PartyTargetReport() { try { if (Session["LoginUser"] != null) { string LoginPartyCode = (Session["LoginUser"] as User).PartyCode; } List <SelectListItem> objCategoryList = new List <SelectListItem>(); var result = objProductManager.GetCategoryList("Y"); SubCategoryDetails model = new SubCategoryDetails(); bool f = true; foreach (var item in result) { SelectListItem tempobj = new SelectListItem(); //SelectListItem tempobj1 = new SelectListItem(); tempobj.Text = item.CategoryName; tempobj.Value = item.CategoryId.ToString(); if (f == true) { f = false; model.CategoryId = int.Parse(item.CategoryId.ToString()); //model.SubCatId = int.Parse(item.ToString()); } objCategoryList.Add(tempobj); } ViewBag.ListCategory = objCategoryList; } catch (Exception ex) { } return(View()); }
public ResponseDetail AddSubCategoryDetails(SubCategoryDetails model) { ResponseDetail objResponse = objProductRepository.AddSubCategoryDetails(model); return(objResponse); }