public ActionResult AddNewItemUnit(int?id) { objItemUnitProperty = new itemUnit_Property(); objItemUnitProperty.idx = Convert.ToInt32(id); //objItemUnitProperty.branchIdx = 1;//It will have the value of session branchIdx objItemUnitBLL = new itemUnit_BLL(objItemUnitProperty); //DataTable dtt = objItemUnitProperty.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 = objItemUnitBLL.GetById(id); //objItemUnitProperty.companyIdx = 1; objItemUnitProperty.idx = int.Parse(dt.Rows[0]["idx"].ToString()); objItemUnitProperty.itemUnit = dt.Rows[0]["itemUnit"].ToString(); //objItemUnitProperty.c = dt.Rows[0]["HSCodeCat"].ToString(); //objItemUnitProperty.firstName = dt.Rows[0]["firstName"].ToString(); //objItemUnitProperty.lastName = dt.Rows[0]["lastName"].ToString(); //objItemUnitProperty.CNIC = (dt.Rows[0]["CNIC"].ToString()); //objItemUnitProperty.cellNumber = (dt.Rows[0]["cellNumber"].ToString()); //objItemUnitProperty.loginId = (dt.Rows[0]["loginId"].ToString()); //objItemUnitProperty.password = dt.Rows[0]["password"].ToString(); } return(PartialView("_AddNewItemUnit", objItemUnitProperty)); }
public JsonResult GetAllItemUnits() { try { objItemUnitProperty = new itemUnit_Property(); //objItemUnitProperty.branchIdx = 1;//user logged in session branchIdx objItemUnitBLL = new itemUnit_BLL(objItemUnitProperty); var Data = JsonConvert.SerializeObject(objItemUnitBLL.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 JsonResult AddUpdate(itemUnit_Property objItemUnitProperty) { try { if (objItemUnitProperty.idx > 0) { objItemUnitProperty.lastModifiedByUserIdx = 1; objItemUnitProperty.lastModificationDate = DateTime.Now.ToString("dd/MM/yyyy"); objItemUnitBLL = new itemUnit_BLL(objItemUnitProperty); bool flag = objItemUnitBLL.Update(); return(Json(new { data = "Updated", success = flag, statuscode = 200 }, JsonRequestBehavior.AllowGet)); } else { //objItemUnitProperty.companyIdx = 1; objItemUnitProperty.createdByUserIdx = 1; objItemUnitBLL = new itemUnit_BLL(objItemUnitProperty); //if (objItemUnitProperty.isMainBranch == 1) //{ // var check = objItemUnitProperty.MainBranch(); // if (check.Rows.Count > 0) // { // return Json(new { data = "Main Branch Already Exist", success = false, statuscode = 500 }, JsonRequestBehavior.AllowGet); // } //} bool flag = objItemUnitBLL.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 JsonResult Delete(int?id) { try { if (id > 0) { itemUnit_Property branchProperty = new itemUnit_Property(); branchProperty.idx = int.Parse(id.ToString()); objItemUnitBLL = new itemUnit_BLL(id); itemUnit_BLL branhcBll = new itemUnit_BLL(branchProperty); var flag1 = branhcBll.Delete(id); //if (flag1.Rows.Count > 0) //{ if (true) { bool flag = objItemUnitBLL.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)); } }
//private ErrorTracer objErrorTrace; public itemUnit_DAL(itemUnit_Property objProduct_Category) { objItemUnit = objProduct_Category; }
public ActionResult AddNewProduct(int?id) { if (Session["LOGGEDIN"] != null) { objProductProperty = new Product_Property(); objProductProperty.idx = Convert.ToInt32(id); //objProductProperty.branchIdx = 1;//It will have the value of session branchIdx objProductBLL = new Product_BLL(objProductProperty); DataTable categories = objProductBLL.ddlCategory(); List <Product_Category_Property> catLST = new List <Product_Category_Property>(); DataTable subCategories = objProductBLL.ddlSubCategory(); List <Product_SubCategory_Property> subCatLST = new List <Product_SubCategory_Property>(); DataTable productTypes = objProductBLL.ddlProductType(); List <Product_Type_Property> productTypeLST = new List <Product_Type_Property>(); DataTable units = objProductBLL.ddlUnit(); List <itemUnit_Property> unitLST = new List <itemUnit_Property>(); foreach (DataRow dr in categories.Rows) { Product_Category_Property objProductCat = new Product_Category_Property(); objProductCat.Category = dr["category"].ToString(); objProductCat.idx = Convert.ToInt32(dr["idx"].ToString()); catLST.Add(objProductCat); } ViewBag.catLST = catLST; foreach (DataRow dr in subCategories.Rows) { Product_SubCategory_Property objProductCat = new Product_SubCategory_Property(); objProductCat.subCategory = dr["subCategory"].ToString(); objProductCat.idx = Convert.ToInt32(dr["idx"].ToString()); subCatLST.Add(objProductCat); } ViewBag.subCatLST = subCatLST; foreach (DataRow dr in productTypes.Rows) { Product_Type_Property objProductCat = new Product_Type_Property(); objProductCat.productType = dr["productType"].ToString(); objProductCat.idx = Convert.ToInt32(dr["idx"].ToString()); productTypeLST.Add(objProductCat); } ViewBag.productTypeLST = productTypeLST; foreach (DataRow dr in units.Rows) { itemUnit_Property objProductCat = new itemUnit_Property(); objProductCat.itemUnit = dr["itemUnit"].ToString(); objProductCat.idx = Convert.ToInt32(dr["idx"].ToString()); unitLST.Add(objProductCat); } ViewBag.unitLST = unitLST; if (id != null && id != 0) { decimal cp, sp, pt; var dt = objProductBLL.GetById(id); //objProductProperty.companyIdx = 1; objProductProperty.idx = int.Parse(dt.Rows[0]["idx"].ToString()); objProductProperty.productTypeIdx = int.Parse(dt.Rows[0]["productTypeIdx"].ToString()); objProductProperty.productCatIdx = int.Parse(dt.Rows[0]["productCatIdx"].ToString()); objProductProperty.productSubCatIdx = int.Parse(dt.Rows[0]["productSubCatIdx"].ToString()); objProductProperty.unitIdx = int.Parse(dt.Rows[0]["unitIdx"].ToString()); objProductProperty.HSCODE = (dt.Rows[0]["HSCODE"].ToString()); objProductProperty.itemCode = (dt.Rows[0]["itemCode"].ToString()); objProductProperty.itemName = (dt.Rows[0]["itemName"].ToString()); objProductProperty.description = (dt.Rows[0]["description"].ToString()); //objProductProperty.costPrice = 0.00m; string costPrice = (dt.Rows[0]["costPrice"].ToString()); decimal.TryParse(costPrice, out cp); objProductProperty.costPrice = cp; string salePrice = (dt.Rows[0]["salePrice"].ToString()); decimal.TryParse(salePrice, out sp); objProductProperty.salePrice = sp; string productTax = (dt.Rows[0]["productTax"].ToString()); decimal.TryParse(productTax, out pt); objProductProperty.productTax = pt; //objProductProperty.product_catIdx = int.Parse(dt.Rows[0]["product_catIdx"].ToString()); //objProductProperty.subCategory = dt.Rows[0]["subCategory"].ToString(); //objProductProperty.HS_CodeSub = dt.Rows[0]["HS_CodeSub"].ToString(); ////objProductProperty.firstName = dt.Rows[0]["firstName"].ToString(); //objProductProperty.lastName = dt.Rows[0]["lastName"].ToString(); //objProductProperty.CNIC = (dt.Rows[0]["CNIC"].ToString()); //objProductProperty.cellNumber = (dt.Rows[0]["cellNumber"].ToString()); //objProductProperty.loginId = (dt.Rows[0]["loginId"].ToString()); //objProductProperty.password = dt.Rows[0]["password"].ToString(); } else { LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "products"; objtrans.Identityfieldname = "idx"; objtrans.userid = Session["UID"].ToString(); objProductProperty.itemCode = objProductBLL.GenerateProductCode(objtrans); } return(PartialView("_AddNewProduct", objProductProperty)); } else { return(RedirectToAction("Login", "Account")); } }
public itemUnit_BLL(itemUnit_Property objItemUnit_Property) { objItemUnitProperty = objItemUnit_Property; }