public JsonResult AddUpdate(Customers_Property objcustomer) { try { if (objcustomer.idx > 0) { objcustomer.lastModifiedByUserIdx = 1;//Session Idx objcustomer.lastModificationDate = DateTime.Now.ToString("yyyy-MM-dd"); objCustomer = new Customers_BLL(objcustomer); bool flag = objCustomer.Update(); return(Json(new { data = "updated", success = flag, statuscode = 200 }, JsonRequestBehavior.AllowGet)); } else { objcustomer.createdByUserIdx = 1;//Session Idx objCustomer = new Customers_BLL(objcustomer); bool flag = objCustomer.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 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 GetAllCustomers() { try { objCustomerProperty = new Customers_Property(); objCustomer = new Customers_BLL(objCustomerProperty); var Data = JsonConvert.SerializeObject(objCustomer.ViewAllCustomers()); 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 ReturnSales(int?id) { if (Session["LOGGEDIN"] != null) { objSalesOrderVM_Property = new SalesOrderVM_Property(); Customers_Property vendor = new Customers_Property(); Product_Property product = new Product_Property(); Customers_BLL objcustomerbll = new Customers_BLL(); Product_BLL objProductbll = new Product_BLL(); LP_Quotation_BLL objQuotationbll = new LP_Quotation_BLL(); WareHouse_BLL objWareHouseBLL = new WareHouse_BLL(); objSalesOrderVM_Property.idx = Convert.ToInt32(id); objSalesOrderVM_Property.QSList = Helper.ConvertDataTable <LP_Quotation_Master_Property>(objQuotationbll.SelectQS()); objSalesOrderVM_Property.CustomerLST = Helper.ConvertDataTable <Customers_Property>(objcustomerbll.ViewAllCustomers()); objSalesOrderVM_Property.ProductList = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll()); objSalesOrderVM_Property.BankList = Helper.ConvertDataTable <Company_Bank_Property>(GetAllCompanyBanks()); objSalesOrderVM_Property.wareHouseList = Helper.ConvertDataTable <WareHouse_Property>(objWareHouseBLL.SelectAll()); objSalesOrderVM_Property.salesorderDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); Taxes_Property obj = new Taxes_Property(); Taxes_BLL objtaxBLL = new Taxes_BLL(obj); ViewBag.TaxList = Helper.ConvertDataTable <Taxes_Property>(objtaxBLL.GetTaxesForCheckBox()); //objPInvoiceVM = new LP_PI_ViewModel(); //objPIProperty = new LP_P_Invoice_Property(); //objPIProperty.idx = Convert.ToInt32(id); //objPIBLL = new LP_PInvoice_BLL(objPIProperty); //objPInvoiceVM.TaxesList = Helper.ConvertDataTable<Taxes_Property>(GetAllTaxes()); //objPInvoiceVM.ProductList = Helper.ConvertDataTable<Product_Property>(ViewAllProducts()); //objPInvoiceVM.BankList = Helper.ConvertDataTable<Company_Bank_Property>(GetAllCompanyBanks()); DataSet DS = objSalesOrderBll.SelectSIWithDetailData(objSalesOrderVM_Property.idx); //DataSet DS = objPIBLL.SelectPIWithDetailData(objPIProperty.idx); if (DS.Tables.Count > 0) { ViewBag.isReturn = 1; objSalesOrderVM_Property.SalesOrderDetailLST = Helper.ConvertDataTable <SalesOrdersDetails_Property>(DS.Tables[0]); if (DS.Tables[1].Rows.Count > 0) { objSalesOrderVM_Property.salesTaxesLST = Helper.ConvertDataTable <LP_salesTaxes_Property>(DS.Tables[1]); } } return(View("AddNewSalesOrder", objSalesOrderVM_Property)); } else { return(RedirectToAction("Login", "Account")); } }
public DataTable GetCustomerByID(int id) { if (Session["LOGGEDIN"] != null) { try { Customers_Property ObjCustomer_Property = new Customers_Property(); ObjCustomer_Property.idx = id; Customers_BLL objvendorbll = new Customers_BLL(ObjCustomer_Property); return(objvendorbll.GetCustomerById()); } catch (Exception ex) { return(new DataTable()); } } else { return(new DataTable()); } }
public JsonResult Delete(int?id) { try { if (id > 0) { Customers_Property branchProperty = new Customers_Property(); branchProperty.idx = int.Parse(id.ToString()); objCustomer = new Customers_BLL(id); Customers_BLL branhcBll = new Customers_BLL(branchProperty); var flag = branhcBll.Delete(id); return(Json(new { data = "Deleted", success = flag, statuscode = 200 }, JsonRequestBehavior.AllowGet)); //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 ActionResult AddQuotaion(int?id) { if (Session["LOGGEDIN"] != null) { objQuotationVM_Property = new QuotationVM_Property(); Customers_Property customer = new Customers_Property(); Product_Property product = new Product_Property(); Customers_BLL objcustomerbll = new Customers_BLL(); Product_BLL objProductbll = new Product_BLL(); objQuotationVM_Property.CustomerLST = Helper.ConvertDataTable <Customers_Property>(objcustomerbll.ViewAllCustomers()); objQuotationVM_Property.ProductList = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll()); Taxes_Property obj = new Taxes_Property(); Taxes_BLL objtaxBLL = new Taxes_BLL(obj); ViewBag.TaxList = Helper.ConvertDataTable <Taxes_Property>(objtaxBLL.GetTaxesForCheckBox()); //objQuotationVM_Property.QuotationDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); ////objQuotationVM_Property.poNumber = "Po-001"; if (id > 0) { LP_Quotation_Detail_Property objmQuotationdetail; objQuotationProperty = new LP_Quotation_Master_Property(); objQuotationProperty.idx = Convert.ToInt16(id); objquotationBll = new LP_Quotation_BLL(objQuotationProperty); DataTable dt = objquotationBll.SelectOne(); objQuotationVM_Property.idx = Convert.ToInt16(dt.Rows[0]["quotationIdx"].ToString()); objQuotationVM_Property.customerIdx = Convert.ToInt16(dt.Rows[0]["customerIdx"].ToString()); objQuotationVM_Property.qsNumber = dt.Rows[0]["qsNumber"].ToString(); objQuotationVM_Property.description = dt.Rows[0]["description"].ToString(); objQuotationVM_Property.totalAmount = Convert.ToDecimal(dt.Rows[0]["totalAmount"].ToString()); string pdate = (dt.Rows[0]["quotationDate"].ToString()).ToString(); string ndate = DateTime.Parse(pdate).ToString("yyyy-MM-dd"); objQuotationVM_Property.quotationDate = 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 <QuotationVM_Property>(dt); //update return(View("AddQuotaion", objQuotationVM_Property));//objQuotationVM_Property } else { objQuotationVM_Property.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objquotationBll = new LP_Quotation_BLL(); LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "quotation"; objtrans.Identityfieldname = "idx"; objtrans.userid = Session["UID"].ToString(); objQuotationVM_Property.qsNumber = objquotationBll.GeneratePO(objtrans); return(View("AddQuotaion", objQuotationVM_Property));//, objQuotationVM_Property } } else { return(RedirectToAction("Login", "Account")); } }
//private ErrorTracer objErrorTrace; public Customers_DAL(Customers_Property obj_Vendors) { objVendors = obj_Vendors; }
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 ActionResult AddNewSalesOrder(int?id) { if (Session["LOGGEDIN"] != null) { objSalesOrderVM_Property = new SalesOrderVM_Property(); Customers_Property vendor = new Customers_Property(); Product_Property product = new Product_Property(); Customers_BLL objcustomerbll = new Customers_BLL(); Product_BLL objProductbll = new Product_BLL(); LP_Quotation_BLL objQuotationbll = new LP_Quotation_BLL(); WareHouse_BLL objWareHouseBLL = new WareHouse_BLL(); objSalesOrderVM_Property.QSList = Helper.ConvertDataTable <LP_Quotation_Master_Property>(objQuotationbll.SelectQS()); objSalesOrderVM_Property.CustomerLST = Helper.ConvertDataTable <Customers_Property>(objcustomerbll.ViewAllCustomers()); objSalesOrderVM_Property.ProductList = Helper.ConvertDataTable <Product_Property>(objProductbll.ViewAll()); objSalesOrderVM_Property.BankList = Helper.ConvertDataTable <Company_Bank_Property>(GetAllCompanyBanks()); objSalesOrderVM_Property.wareHouseList = Helper.ConvertDataTable <WareHouse_Property>(objWareHouseBLL.SelectAll()); objSalesOrderVM_Property.salesorderDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); Taxes_Property obj = new Taxes_Property(); Taxes_BLL objtaxBLL = new Taxes_BLL(obj); ViewBag.TaxList = Helper.ConvertDataTable <Taxes_Property>(objtaxBLL.GetTaxesForCheckBox()); //objSalesOrderVM_Property.poNumber = "Po-001"; if (id > 0) { LP_SalesOrder_Detail_Property objmSalesOrderdetail; objSalesOrderProperty = new LP_SalesOrder_Master_Property(); objSalesOrderProperty.idx = Convert.ToInt16(id); objSalesOrderBll = new LP_SalesOrder_BLL(objSalesOrderProperty); DataTable dt = objSalesOrderBll.SelectOne(); objSalesOrderVM_Property.idx = Convert.ToInt16(dt.Rows[0]["salesorderIdx"].ToString()); objSalesOrderVM_Property.customerIdx = Convert.ToInt32(dt.Rows[0]["customerIdx"].ToString()); objSalesOrderVM_Property.soNumber = dt.Rows[0]["soNumber"].ToString(); objSalesOrderVM_Property.description = dt.Rows[0]["description"].ToString(); objSalesOrderVM_Property.qsIdx = Convert.ToInt16(dt.Rows[0]["qsIdx"].ToString()); objSalesOrderVM_Property.totalAmount = Convert.ToDecimal(dt.Rows[0]["totalAmount"].ToString()); string pdate = (dt.Rows[0]["salesorderdate"].ToString()).ToString(); string ndate = DateTime.Parse(pdate).ToString("yyyy-MM-dd"); objSalesOrderVM_Property.salesorderDate = 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 <SalesOrderVM_Property>(dt); //update return(View("AddNewSalesOrder", objSalesOrderVM_Property)); } else { //objSalesOrderProperty = new LP_SalesOrder_Master_Property(); objSalesOrderVM_Property.createdByUserIdx = Convert.ToInt16(Session["UID"].ToString()); objSalesOrderBll = new LP_SalesOrder_BLL(); LP_GenerateTransNumber_Property objtrans = new LP_GenerateTransNumber_Property(); objtrans.TableName = "SalesOrder"; objtrans.Identityfieldname = "idx"; objtrans.userid = Session["UID"].ToString(); objSalesOrderVM_Property.soNumber = objSalesOrderBll.GenerateSO(objtrans); //objSalesOrderProperty.poNumber = ""; //objSalesOrderBll = new LP_SalesOrder_BLL(objSalesOrderProperty); //objSalesOrderVM_Property.poNumber = objSalesOrderBll.GeneratePO();// "PO-001"; // string po = objSalesOrderBll.GeneratePO(); return(View("AddNewSalesOrder", objSalesOrderVM_Property)); } } else { return(RedirectToAction("Login", "Account")); } }
public Customers_BLL(Customers_Property ObjCustomer_Property) { ObjCustomerProperty = ObjCustomer_Property; }