public JsonResult Delete(int?id) { try { if (id > 0) { CustomerType_Property branchProperty = new CustomerType_Property(); branchProperty.idx = int.Parse(id.ToString()); objCustomerTypeBLL = new CustomerType_BLL(id); CustomerType_BLL branhcBll = new CustomerType_BLL(branchProperty); var flag1 = branhcBll.Delete(id); //if (flag1.Rows.Count > 0) //{ //bool flag = objCustomerTypeBLL.Delete(id); return(Json(new { data = "Deleted", success = flag1, 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)); } }
public ActionResult AddNewCustomerType(int?id) { string actionName = this.ControllerContext.RouteData.Values["action"].ToString(); string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); string pagename = @"/" + controllerName + @"/" + actionName; var page = (List <LP_Pages_Property>)Session["PageList"]; if (Session["LoggedIn"] != null && Helper.CheckPageAccess(pagename, page) && Session["ISADMIN"] != null && Convert.ToBoolean(Session["ISADMIN"].ToString()) == true) { objCustomerTypeProperty = new CustomerType_Property(); objCustomerTypeProperty.idx = Convert.ToInt32(id); objCustomerTypeBLL = new CustomerType_BLL(objCustomerTypeProperty); if (id != null && id != 0) { var dt = objCustomerTypeBLL.SelectById(); objCustomerTypeProperty.idx = int.Parse(dt.Rows[0]["idx"].ToString()); objCustomerTypeProperty.customerType = dt.Rows[0]["customerType"].ToString(); } return(PartialView("_AddNewCustomerType", objCustomerTypeProperty)); } else { if (Session["LoggedIn"] == null) { return(RedirectToAction("Login", "Account")); } else { return(RedirectToAction("NotAuthorized", "Account")); } } }
public ActionResult AddNewCustomer(int?id) { int customerTypeIdx; objCustomerProperty = new Customers_Property(); objCustomerProperty.idx = Convert.ToInt32(id); objCustomer = new Customers_BLL(objCustomerProperty); DataTable customerTypes = objCustomer.GetCustomerType(); List <CustomerType_Property> CustomersLST = new List <CustomerType_Property>(); foreach (DataRow dr in customerTypes.Rows) { CustomerType_Property objVendorsCat = new CustomerType_Property(); objVendorsCat.customerType = dr["customerType"].ToString(); objVendorsCat.idx = Convert.ToInt32(dr["idx"].ToString()); CustomersLST.Add(objVendorsCat); } ViewBag.CustomersLST = CustomersLST; if (id != null || id > 0) { var dt = objCustomer.GetCustomerById(); objCustomerProperty.idx = int.Parse(dt.Rows[0]["idx"].ToString()); int.TryParse(dt.Rows[0]["customerTypeIdx"].ToString(), out customerTypeIdx); objCustomerProperty.customerTypeIdx = customerTypeIdx; //objCustomerProperty.vendorCatIdx = int.Parse(dt.Rows[0]["vendorCatIdx"].ToString()); //objVendorsProperty.unitIdx = int.Parse(dt.Rows[0]["unitIdx"].ToString()); objCustomerProperty.contact = (dt.Rows[0]["contact"].ToString()); objCustomerProperty.customerCode = (dt.Rows[0]["customerCode"].ToString()); objCustomerProperty.customerName = (dt.Rows[0]["customerName"].ToString()); objCustomerProperty.address = (dt.Rows[0]["address"].ToString()); } return(View(objCustomerProperty)); }
public JsonResult GetAllCustomerTypes() { try { objCustomerTypeProperty = new CustomerType_Property(); //objProductCategoryProperty.branchIdx = 1;//user logged in session branchIdx objCustomerTypeBLL = new CustomerType_BLL(objCustomerTypeProperty); var Data = JsonConvert.SerializeObject(objCustomerTypeBLL.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)); } }
public ActionResult AddNewCustomerType(int?id) { objCustomerTypeProperty = new CustomerType_Property(); objCustomerTypeProperty.idx = Convert.ToInt32(id); objCustomerTypeBLL = new CustomerType_BLL(objCustomerTypeProperty); if (id != null && id != 0) { var dt = objCustomerTypeBLL.SelectById(); objCustomerTypeProperty.idx = int.Parse(dt.Rows[0]["idx"].ToString()); objCustomerTypeProperty.customerType = dt.Rows[0]["customerType"].ToString(); //objProductCategoryProperty.HSCodeCat = dt.Rows[0]["HSCodeCat"].ToString(); //objProductCategoryProperty.firstName = dt.Rows[0]["firstName"].ToString(); //objProductCategoryProperty.lastName = dt.Rows[0]["lastName"].ToString(); //objProductCategoryProperty.CNIC = (dt.Rows[0]["CNIC"].ToString()); //objProductCategoryProperty.cellNumber = (dt.Rows[0]["cellNumber"].ToString()); //objProductCategoryProperty.loginId = (dt.Rows[0]["loginId"].ToString()); //objProductCategoryProperty.password = dt.Rows[0]["password"].ToString(); } return(PartialView("_AddNewCustomerType", objCustomerTypeProperty)); }
public JsonResult AddUpdate(CustomerType_Property objProductCategory) { try { if (objProductCategory.idx > 0) { objProductCategory.lastModifiedByUserIdx = 1; objProductCategory.lastModificationDate = DateTime.Now.ToString("dd/MM/yyyy"); objCustomerTypeBLL = new CustomerType_BLL(objProductCategory); bool flag = objCustomerTypeBLL.Update(); return(Json(new { data = "Updated", success = flag, statuscode = 200 }, JsonRequestBehavior.AllowGet)); } else { //objProductCategory.companyIdx = 1; objProductCategory.createdByUserIdx = 1; objCustomerTypeBLL = new CustomerType_BLL(objProductCategory); //if (objProductCategory.isMainBranch == 1) //{ // var check = objProductCategory.MainBranch(); // if (check.Rows.Count > 0) // { // return Json(new { data = "Main Branch Already Exist", success = false, statuscode = 500 }, JsonRequestBehavior.AllowGet); // } //} bool flag = objCustomerTypeBLL.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)); } }
public CustomerType_BLL(CustomerType_Property objCustomerType_Property) { objCustomerCategoryProperty = objCustomerType_Property; }
public ActionResult AddNewCustomer(int?id) { string actionName = this.ControllerContext.RouteData.Values["action"].ToString(); string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); string pagename = @"/" + controllerName + @"/" + actionName; var page = (List <LP_Pages_Property>)Session["PageList"]; if (Session["LoggedIn"] != null && Helper.CheckPageAccess(pagename, page) && Session["ISADMIN"] != null && Convert.ToBoolean(Session["ISADMIN"].ToString()) == true) { int customerTypeIdx; objCustomerProperty = new Customers_Property(); objCustomerProperty.idx = Convert.ToInt32(id); objCustomer = new Customers_BLL(objCustomerProperty); DataTable customerTypes = objCustomer.GetCustomerType(); List <CustomerType_Property> CustomersLST = new List <CustomerType_Property>(); foreach (DataRow dr in customerTypes.Rows) { CustomerType_Property objVendorsCat = new CustomerType_Property(); objVendorsCat.customerType = dr["customerType"].ToString(); objVendorsCat.idx = Convert.ToInt32(dr["idx"].ToString()); CustomersLST.Add(objVendorsCat); } ViewBag.CustomersLST = CustomersLST; if (id != null || id > 0) { var dt = objCustomer.GetCustomerById(); objCustomerProperty.idx = int.Parse(dt.Rows[0]["idx"].ToString()); int.TryParse(dt.Rows[0]["customerTypeIdx"].ToString(), out customerTypeIdx); objCustomerProperty.customerTypeIdx = customerTypeIdx; //objCustomerProperty.vendorCatIdx = int.Parse(dt.Rows[0]["vendorCatIdx"].ToString()); //objVendorsProperty.unitIdx = int.Parse(dt.Rows[0]["unitIdx"].ToString()); objCustomerProperty.contact = (dt.Rows[0]["contact"].ToString()); objCustomerProperty.customerCode = (dt.Rows[0]["customerCode"].ToString()); objCustomerProperty.customerName = (dt.Rows[0]["customerName"].ToString()); objCustomerProperty.address = (dt.Rows[0]["address"].ToString()); return(View(objCustomerProperty)); } else { objCustomerProperty.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objCustomer = new Customers_BLL(); LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "customers"; objtrans.Identityfieldname = "idx"; objtrans.userid = Session["UID"].ToString(); objCustomerProperty.customerCode = objCustomer.GenerateSO(objtrans); return(View(objCustomerProperty)); } } else { if (Session["LoggedIn"] == null) { return(RedirectToAction("Login", "Account")); } else { return(RedirectToAction("NotAuthorized", "Account")); } } }
public CustomerType_DAL(CustomerType_Property objVendor_Type) { objVendorType = objVendor_Type; }