public ActionResult AddNewVendors(int?id) { objVendorsProperty = new Vendors_Property(); objVendorsProperty.idx = Convert.ToInt32(id); //objVendorsProperty.branchIdx = 1;//It will have the value of session branchIdx objVendorsBLL = new Vendors_BLL(objVendorsProperty); DataTable categories = objVendorsBLL.ddlCategory(); List <Vendor_Category_Property> catLST = new List <Vendor_Category_Property>(); DataTable VendorTypes = objVendorsBLL.ddlVendorsType(); List <VendorType_Property> VendorTypeLST = new List <VendorType_Property>(); foreach (DataRow dr in categories.Rows) { Vendor_Category_Property objVendorsCat = new Vendor_Category_Property(); objVendorsCat.vendorCategory = dr["vendorCategory"].ToString(); objVendorsCat.idx = Convert.ToInt32(dr["idx"].ToString()); catLST.Add(objVendorsCat); } ViewBag.catLST = catLST; foreach (DataRow dr in VendorTypes.Rows) { VendorType_Property objVendorsCat = new VendorType_Property(); objVendorsCat.vendorType = dr["vendorType"].ToString(); objVendorsCat.idx = Convert.ToInt32(dr["idx"].ToString()); VendorTypeLST.Add(objVendorsCat); } ViewBag.VendorsTypeLST = VendorTypeLST; if (id != null && id != 0) { var dt = objVendorsBLL.GetById(id); //objVendorsProperty.companyIdx = 1; objVendorsProperty.idx = int.Parse(dt.Rows[0]["idx"].ToString()); objVendorsProperty.vendorTypeIdx = int.Parse(dt.Rows[0]["vendorTypeIdx"].ToString()); objVendorsProperty.vendorCatIdx = int.Parse(dt.Rows[0]["vendorCatIdx"].ToString()); objVendorsProperty.contact = (dt.Rows[0]["contact"].ToString()); objVendorsProperty.vendorCode = (dt.Rows[0]["vendorCode"].ToString()); objVendorsProperty.vendorName = (dt.Rows[0]["vendorName"].ToString()); objVendorsProperty.address = (dt.Rows[0]["address"].ToString()); return(PartialView("_AddNewVendors", objVendorsProperty)); } else { objVendorsProperty.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objVendorsBLL = new Vendors_BLL(); LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "vendors"; objtrans.Identityfieldname = "idx"; objtrans.userid = Session["UID"].ToString(); objVendorsProperty.vendorCode = objVendorsBLL.GenerateSO(objtrans); return(PartialView("_AddNewVendors", objVendorsProperty)); } }
public ActionResult AddNewVendors(int?id) { objVendorsProperty = new Vendors_Property(); objVendorsProperty.idx = Convert.ToInt32(id); //objVendorsProperty.branchIdx = 1;//It will have the value of session branchIdx objVendorsBLL = new Vendors_BLL(objVendorsProperty); DataTable categories = objVendorsBLL.ddlCategory(); List <Vendor_Category_Property> catLST = new List <Vendor_Category_Property>(); DataTable VendorTypes = objVendorsBLL.ddlVendorsType(); List <VendorType_Property> VendorTypeLST = new List <VendorType_Property>(); foreach (DataRow dr in categories.Rows) { Vendor_Category_Property objVendorsCat = new Vendor_Category_Property(); objVendorsCat.vendorCategory = dr["vendorCategory"].ToString(); objVendorsCat.idx = Convert.ToInt32(dr["idx"].ToString()); catLST.Add(objVendorsCat); } ViewBag.catLST = catLST; foreach (DataRow dr in VendorTypes.Rows) { VendorType_Property objVendorsCat = new VendorType_Property(); objVendorsCat.vendorType = dr["vendorType"].ToString(); objVendorsCat.idx = Convert.ToInt32(dr["idx"].ToString()); VendorTypeLST.Add(objVendorsCat); } ViewBag.VendorsTypeLST = VendorTypeLST; if (id != null && id != 0) { var dt = objVendorsBLL.GetById(id); //objVendorsProperty.companyIdx = 1; objVendorsProperty.idx = int.Parse(dt.Rows[0]["idx"].ToString()); objVendorsProperty.vendorTypeIdx = int.Parse(dt.Rows[0]["vendorTypeIdx"].ToString()); objVendorsProperty.vendorCatIdx = int.Parse(dt.Rows[0]["vendorCatIdx"].ToString()); //objVendorsProperty.unitIdx = int.Parse(dt.Rows[0]["unitIdx"].ToString()); objVendorsProperty.contact = (dt.Rows[0]["contact"].ToString()); objVendorsProperty.vendorCode = (dt.Rows[0]["vendorCode"].ToString()); objVendorsProperty.vendorName = (dt.Rows[0]["vendorName"].ToString()); objVendorsProperty.address = (dt.Rows[0]["address"].ToString()); //objVendorsProperty.Vendors_catIdx = int.Parse(dt.Rows[0]["Vendors_catIdx"].ToString()); //objVendorsProperty.subCategory = dt.Rows[0]["subCategory"].ToString(); //objVendorsProperty.HS_CodeSub = dt.Rows[0]["HS_CodeSub"].ToString(); ////objVendorsProperty.firstName = dt.Rows[0]["firstName"].ToString(); //objVendorsProperty.lastName = dt.Rows[0]["lastName"].ToString(); //objVendorsProperty.CNIC = (dt.Rows[0]["CNIC"].ToString()); //objVendorsProperty.cellNumber = (dt.Rows[0]["cellNumber"].ToString()); //objVendorsProperty.loginId = (dt.Rows[0]["loginId"].ToString()); //objVendorsProperty.password = dt.Rows[0]["password"].ToString(); } return(PartialView("_AddNewVendors", objVendorsProperty)); }
public JsonResult DeleteVendorCat(int?id) { if (Session["LOGGEDIN"] != null) { try { if (id > 0) { Vendor_Category_Property branchProperty = new Vendor_Category_Property(); branchProperty.idx = int.Parse(id.ToString()); objVendorCategoryBLL = new Vendor_Category_BLL(id); Vendor_Category_BLL branhcBll = new Vendor_Category_BLL(branchProperty); var flag1 = branhcBll.Delete(id); //if (flag1.Rows.Count > 0) //{ if (true) { bool flag = objVendorCategoryBLL.Delete(id); return(Json(new { data = "Deleted", success = flag, statuscode = 200 }, JsonRequestBehavior.AllowGet)); } //else //{ // return Json(new { data = "Mian Branch Cannot be Delete ", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet); //} //} // return Json(new { data = "Process Completed ", success = true, statuscode = 200 }, JsonRequestBehavior.AllowGet); } else { return(Json(new { data = "Error Occur", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { data = "Session Expired", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } }
public JsonResult AddUpdate(Vendor_Category_Property objVendorCategory) { if (Session["LOGGEDIN"] != null) { try { if (objVendorCategory.idx > 0) { objVendorCategory.lastModifiedByUserIdx = Convert.ToInt32(Session["UID"].ToString()); objVendorCategory.lastModificationDate = DateTime.Now.ToString("dd/MM/yyyy"); objVendorCategoryBLL = new Vendor_Category_BLL(objVendorCategory); bool flag = objVendorCategoryBLL.Update(); return(Json(new { data = "Updated", success = flag, statuscode = 200 }, JsonRequestBehavior.AllowGet)); } else { //objVendorCategory.companyIdx = 1; objVendorCategory.createdByUserIdx = Convert.ToInt32(Session["UID"].ToString()); objVendorCategoryBLL = new Vendor_Category_BLL(objVendorCategory); //if (objVendorCategory.isMainBranch == 1) //{ // var check = objVendorCategory.MainBranch(); // if (check.Rows.Count > 0) // { // return Json(new { data = "Main Branch Already Exist", success = false, statuscode = 500 }, JsonRequestBehavior.AllowGet); // } //} bool flag = objVendorCategoryBLL.Insert(); return(Json(new { data = "Inserted", success = flag, statuscode = 200 }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { data = "Session Expired", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddNewVendorCategory(int?id) { if (Session["LOGGEDIN"] != null) { objVendorCategoryProperty = new Vendor_Category_Property(); objVendorCategoryProperty.idx = Convert.ToInt32(id); //objVendorCategoryProperty.branchIdx = 1;//It will have the value of session branchIdx objVendorCategoryBLL = new Vendor_Category_BLL(objVendorCategoryProperty); //DataTable dtt = objVendorCategory.SelectBranch(); //List<Branch_Property> BranchList = new List<Branch_Property>(); //foreach (DataRow dr in dtt.Rows) //{ // Branch_Property objbranch = new Branch_Property(); // objbranch.branchName = dr["branchname"].ToString(); // objbranch.idx = Convert.ToInt32(dr["idx"].ToString()); // BranchList.Add(objbranch); //} //ViewBag.branchList = BranchList; if (id != null && id != 0) { var dt = objVendorCategoryBLL.GetById(id); //objVendorCategoryProperty.companyIdx = 1; objVendorCategoryProperty.idx = int.Parse(dt.Rows[0]["idx"].ToString()); objVendorCategoryProperty.vendorCategory = dt.Rows[0]["vendorCategory"].ToString(); //objVendorCategoryProperty.firstName = dt.Rows[0]["firstName"].ToString(); //objVendorCategoryProperty.lastName = dt.Rows[0]["lastName"].ToString(); //objVendorCategoryProperty.CNIC = (dt.Rows[0]["CNIC"].ToString()); //objVendorCategoryProperty.cellNumber = (dt.Rows[0]["cellNumber"].ToString()); //objVendorCategoryProperty.loginId = (dt.Rows[0]["loginId"].ToString()); //objVendorCategoryProperty.password = dt.Rows[0]["password"].ToString(); } return(PartialView("_AddNewVendorCategory", objVendorCategoryProperty)); } else { return(RedirectToAction("Login", "Account")); } }
public DataTable GetAllVendorsCategory() { if (Session["LOGGEDIN"] != null) { try { Vendor_Category_Property objProperty = new Vendor_Category_Property(); Vendor_Category_BLL objvendorcatbll = new Vendor_Category_BLL(objProperty); return(objvendorcatbll.ViewAll()); } catch (Exception ex) { return(new DataTable()); } } else { return(new DataTable()); } }
public JsonResult GetAllVendorCategories() { if (Session["LOGGEDIN"] != null) { try { objVendorCategoryProperty = new Vendor_Category_Property(); //objVendorCategoryProperty.branchIdx = 1;//user logged in session branchIdx objVendorCategoryBLL = new Vendor_Category_BLL(objVendorCategoryProperty); var Data = JsonConvert.SerializeObject(objVendorCategoryBLL.ViewAll()); return(Json(new { data = Data, success = true, statuscode = 200, count = Data.Length }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { data = ex.Message, success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { data = "Session Expired", success = false, statuscode = 400, count = 0 }, JsonRequestBehavior.AllowGet)); } }
//private ErrorTracer objErrorTrace; public Vendor_Category_DAL(Vendor_Category_Property objVendor_Category) { objVendorCategory = objVendor_Category; }
public Vendor_Category_BLL(Vendor_Category_Property objVendorCategory_Property) { objVendorCategoryProperty = objVendorCategory_Property; }