public ActionResult AddNewVendorBank(int?id) { if (Session["LOGGEDIN"] != null) { objVendorBanksProperty = new LP_VendorBanks_Property(); Bank_BLL objBanlBLL = new Bank_BLL(); Vendors_BLL objVendorBLL = new Vendors_BLL(); objVendorBanksProperty.BankList = Helper.ConvertDataTable <Bank_Property>(objBanlBLL.ViewAll()); objVendorBanksProperty.VendorList = Helper.ConvertDataTable <Vendors_Property>(objVendorBLL.ViewAll()); if (id > 0) { objVendorBanksProperty.idx = Convert.ToInt32(id); objVendorBanksBLL = new LP_VendorBanks_BLL(objVendorBanksProperty); DataTable dt = objVendorBanksBLL.SelectOne(); objVendorBanksProperty.bankIdx = int.Parse(dt.Rows[0]["bankIdx"].ToString()); objVendorBanksProperty.vendorIdx = int.Parse(dt.Rows[0]["vendorIdx"].ToString()); objVendorBanksProperty.accountTitle = dt.Rows[0]["accountTitle"].ToString(); objVendorBanksProperty.accountNumber = dt.Rows[0]["accountNumber"].ToString(); objVendorBanksProperty.ibanNumber = dt.Rows[0]["ibanNumber"].ToString(); return(PartialView("AddNewVendorBank", objVendorBanksProperty)); } else { return(PartialView("AddNewVendorBank", objVendorBanksProperty)); } } else { return(RedirectToAction("Login", "Account")); } }
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 ActionResult AddNewMRN(int?id) { if (Session["LOGGEDIN"] != null) { objMRNVM_Property = new MRNVM_Property(); Vendors_Property vendor = new Vendors_Property(); Product_Property product = new Product_Property(); Vendors_BLL objvendorbll = new Vendors_BLL(); Product_BLL objProductbll = new Product_BLL(); //objMRNVM_Property.VendorLST = Helper.ConvertDataTable<Vendors_Property>(objvendorbll.ViewAll()); objMRNVM_Property.ProductList = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll()); objMRNVM_Property.WareHouseList = Helper.ConvertDataTable <WareHouse_Property>(ViewWareHouses()); objMRNVM_Property.mrnDate = DateTime.Now.ToString("yyyy-MM-dd"); if (id > 0) { //update LP_MRN_Detail_Property objmrndetail; objMRNProperty = new LP_MRN_Master_Property(); objMRNProperty.idx = Convert.ToInt16(id); objMRNBll = new LP_MRN_BLL(objMRNProperty); DataTable dt = objMRNBll.SelectById(); objMRNVM_Property.idx = Convert.ToInt16(dt.Rows[0]["mrnIdx"].ToString()); objMRNVM_Property.description = dt.Rows[0]["description"].ToString(); objMRNVM_Property.WarerHouseID = Convert.ToInt32(dt.Rows[0]["WarerHouseID"].ToString()); objMRNVM_Property.mrNumber = dt.Rows[0]["mrNumber"].ToString(); objMRNVM_Property.mrnDate = DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd"); //foreach(DataRow dr in dt.Rows) //{ // objmrndetail //} ViewBag.DetailData = Helper.ConvertDataTable <MRNVM_Property>(dt); return(View("AddNewMRN", objMRNVM_Property)); } else { objMRNBll = new LP_MRN_BLL(); LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "MRN"; objtrans.Identityfieldname = "idx"; objtrans.userid = Session["UID"].ToString(); objMRNVM_Property.mrNumber = objMRNBll.GenerateMRNNo(objtrans); return(View("AddNewMRN", objMRNVM_Property)); } } else { return(RedirectToAction("Login", "Account")); } }
public JsonResult GetAllVendors() { try { objVendorsProperty = new Vendors_Property(); //objVendorsProperty.branchIdx = 1;//user logged in session branchIdx objVendorsBLL = new Vendors_BLL(objVendorsProperty); var Data = JsonConvert.SerializeObject(objVendorsBLL.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 DataTable GetVendorByVendorCat(int id) { if (Session["LOGGEDIN"] != null) { try { Vendors_BLL objvendorbll = new Vendors_BLL(); return(objvendorbll.GetByCatId(id)); } catch (Exception ex) { return(new DataTable()); } } else { return(new DataTable()); } }
public DataTable GetAllVendors() { if (Session["LOGGEDIN"] != null) { try { Vendors_BLL objvendorbll = new Vendors_BLL(); return(objvendorbll.ViewAll()); } catch (Exception ex) { return(new DataTable()); } } else { return(new DataTable()); } }
public JsonResult Delete(int?id) { try { if (id > 0) { Vendors_Property branchProperty = new Vendors_Property(); branchProperty.idx = int.Parse(id.ToString()); objVendorsBLL = new Vendors_BLL(id); Vendors_BLL branhcBll = new Vendors_BLL(branchProperty); var flag1 = branhcBll.Delete(id); //if (flag1.Rows.Count > 0) //{ if (true) { bool flag = objVendorsBLL.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)); } }
public JsonResult AddUpdate(Vendors_Property objVendorsCategory) { try { if (objVendorsCategory.idx > 0) { objVendorsCategory.lastModifiedByUserIdx = 1; objVendorsCategory.lastModificationDate = DateTime.Now.ToString("dd/MM/yyyy"); objVendorsBLL = new Vendors_BLL(objVendorsCategory); bool flag = objVendorsBLL.Update(); return(Json(new { data = "Updated", success = flag, statuscode = 200 }, JsonRequestBehavior.AllowGet)); } else { //objVendorsCategory.companyIdx = 1; objVendorsCategory.createdByUserIdx = 1; objVendorsBLL = new Vendors_BLL(objVendorsCategory); //if (objVendorsCategory.isMainBranch == 1) //{ // var check = objVendorsCategory.MainBranch(); // if (check.Rows.Count > 0) // { // return Json(new { data = "Main Branch Already Exist", success = false, statuscode = 500 }, JsonRequestBehavior.AllowGet); // } //} bool flag = objVendorsBLL.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 ActionResult AddNewPurchase(int?id) { if (Session["LOGGEDIN"] != null) { objPurchaseVM_Property = new PurchaseVM_Property(); Vendors_Property vendor = new Vendors_Property(); Product_Property product = new Product_Property(); Vendors_BLL objvendorbll = new Vendors_BLL(); Product_BLL objProductbll = new Product_BLL(); LP_MRN_BLL objMRNbll = new LP_MRN_BLL(); objPurchaseVM_Property.MRList = Helper.ConvertDataTable <LP_MRN_Master_Property>(objMRNbll.SelectMRN()); objPurchaseVM_Property.VendorLST = Helper.ConvertDataTable <Vendors_Property>(objvendorbll.ViewAll()); objPurchaseVM_Property.DepartmentList = Helper.ConvertDataTable <Departments_property>(GetAllDepartments()); objPurchaseVM_Property.ProductList = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll()); objPurchaseVM_Property.purchaseDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); //objPurchaseVM_Property.poNumber = "Po-001"; if (id > 0) { LP_Purchase_Detail_Property objmpurchasedetail; objPurchaseProperty = new LP_Purchase_Master_Property(); objPurchaseProperty.idx = Convert.ToInt16(id); objpurchaseBll = new LP_Purchase_BLL(objPurchaseProperty); DataTable dt = objpurchaseBll.SelectOne(); objPurchaseVM_Property.idx = Convert.ToInt16(dt.Rows[0]["purchaseIdx"].ToString()); objPurchaseVM_Property.vendorIdx = Convert.ToInt16(dt.Rows[0]["vendorIdx"].ToString()); objPurchaseVM_Property.poNumber = dt.Rows[0]["poNumber"].ToString(); objPurchaseVM_Property.description = dt.Rows[0]["description"].ToString(); objPurchaseVM_Property.MRNIdx = Convert.ToInt16(dt.Rows[0]["MRNIdx"].ToString()); objPurchaseVM_Property.DepartmentID = Convert.ToInt16(dt.Rows[0]["DepartmentID"].ToString()); objPurchaseVM_Property.totalAmount = Convert.ToDecimal(dt.Rows[0]["totalAmount"].ToString()); string pdate = (dt.Rows[0]["purchaseDate"].ToString()).ToString(); string ndate = DateTime.Parse(pdate).ToString("yyyy-MM-dd"); objPurchaseVM_Property.purchaseDate = Convert.ToDateTime(ndate);// DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd"); //DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd"); //foreach(DataRow dr in dt.Rows) //{ // objmrndetail //} ViewBag.DetailData = Helper.ConvertDataTable <PurchaseVM_Property>(dt); //update return(View("AddNewPurchase", objPurchaseVM_Property)); } else { //objPurchaseProperty = new LP_Purchase_Master_Property(); objPurchaseVM_Property.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objpurchaseBll = new LP_Purchase_BLL(); LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "purchase"; objtrans.Identityfieldname = "idx"; objtrans.userid = Session["UID"].ToString(); objPurchaseVM_Property.poNumber = objpurchaseBll.GeneratePO(objtrans); //objPurchaseProperty.poNumber = ""; //objpurchaseBll = new LP_Purchase_BLL(objPurchaseProperty); //objPurchaseVM_Property.poNumber = objpurchaseBll.GeneratePO();// "PO-001"; // string po = objpurchaseBll.GeneratePO(); return(View("AddNewPurchase", objPurchaseVM_Property)); } } else { return(RedirectToAction("Login", "Account")); } }
public ActionResult AddNewConsigment(int?id) { if (Session["LOGGEDIN"] != null) { objConsigmentVm = new LP_Consigment_ViewModel(); Vendors_Property vendor = new Vendors_Property(); Product_Property product = new Product_Property(); Vendors_BLL objvendorbll = new Vendors_BLL(); Product_BLL objProductbll = new Product_BLL(); objpurchaseBll = new LP_PI_BLL(); // objPurchaseVM_Property.VendorLST = Helper.ConvertDataTable<Vendors_Property>(objvendorbll.ViewAll()); // objPurchaseVM_Property.DepartmentList = Helper.ConvertDataTable<Departments_property>(GetAllDepartments()); // objPurchaseVM_Property.PurchaseType_List = Helper.ConvertDataTable<LP_Purchase_Type>(GetAllPurchaseType()); objConsigmentVm.ProductList = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll()); objConsigmentVm.CIPO = Helper.ConvertDataTable <LP_CI_PurchaseOrder_Property>(objpurchaseBll.SelectAllCIPO()); objConsigmentVm.Invoicedate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); //objPurchaseVM_Property.poNumber = "Po-001"; if (id > 0) { //LP_Purchase_Detail_Property objmpurchasedetail; //objPurchaseProperty = new LP_Performa_Invoice_Property(); //objPurchaseProperty.idx = Convert.ToInt16(id); //objpurchaseBll = new LP_PI_BLL(); //DataTable dt = objpurchaseBll.SelectOne(); //objPurchaseVM_Property.idx = Convert.ToInt16(dt.Rows[0]["purchaseIdx"].ToString()); //objPurchaseVM_Property.vendorIdx = Convert.ToInt16(dt.Rows[0]["vendorIdx"].ToString()); //objPurchaseVM_Property.poNumber = dt.Rows[0]["poNumber"].ToString(); //objPurchaseVM_Property.description = dt.Rows[0]["description"].ToString(); //objPurchaseVM_Property.DepartmentID = Convert.ToInt16(dt.Rows[0]["DepartmentID"].ToString()); //objPurchaseVM_Property.totalAmount = Convert.ToDecimal(dt.Rows[0]["totalAmount"].ToString()); //string pdate = (dt.Rows[0]["purchaseDate"].ToString()).ToString(); //string ndate = DateTime.Parse(pdate).ToString("yyyy-MM-dd"); //objPurchaseVM_Property.purchaseDate = Convert.ToDateTime(ndate);// DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd"); ////DateTime.Parse(dt.Rows[0]["mrnDate"].ToString()).ToString("yyyy-MM-dd"); ////foreach(DataRow dr in dt.Rows) ////{ //// objmrndetail ////} //ViewBag.DetailData = Helper.ConvertDataTable<PurchaseVM_Property>(dt); //update return(View("AddNewConsigment", objConsigmentVm)); } else { //objPurchaseProperty = new LP_Purchase_Master_Property(); objConsigmentVm.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objpurchaseBll = new LP_PI_BLL(); LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "consigment"; objtrans.Identityfieldname = "idx"; objtrans.userid = Session["UID"].ToString(); objConsigmentVm.InvoiceNo = objpurchaseBll.GenerateCINo(objtrans); //objCIPOVm.CDPercntage = 20; //objCIPOVm.RDPercentage = 20; //objCIPOVm.ACDPercentage = 20; //objCIPOVm.STPercentage = 20; //objCIPOVm.ITPercentage = 20; //objCIPOVm.TDTax = 0.00m; //objCIPOVm.CleaningPrice = 0.00m; //objCIPOVm.TotalPrice = 0.00m; //objCIPOVm.ASTPercentage = 20; //objCIPOVm.CleaningPrice = 20; //objPurchaseProperty.poNumber = ""; //objpurchaseBll = new LP_Purchase_BLL(objPurchaseProperty); //objPurchaseVM_Property.poNumber = objpurchaseBll.GeneratePO();// "PO-001"; // string po = objpurchaseBll.GeneratePO(); return(View("AddNewConsigment", objConsigmentVm)); } } else { return(RedirectToAction("Login", "Account")); } }