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)); }
protected void btnAddCustomer_Click(object sender, EventArgs e) { btnAddCustomer.CausesValidation = true; string custName = txtCustName.Text; string custEmail = txtCustEmail.Text; string custPassword = txtCustPassword.Text; string custDOB = txtCustDOB.Text; string custAddress = txtCustAddress.Text; string custTelephone = txtCustTelephone.Text; if (custName == "") { //lblErrorName.Visible = !lblErrorName.Visible; } else { var objCustomerBLL = new Customers_BLL(); var objAccountsBLL = new Accounts_BLL(); int custID = objCustomerBLL.AddNewCustomer(custName, custEmail, custPassword, custDOB, custTelephone, custAddress); for (int i = 1; i < 4; i++) { objAccountsBLL.AddCustomerAccount(custID, i, 100); } MultiViewLogin.Views.Remove(viewRegister); MultiViewLogin.SetActiveView(viewSuccessRegister); lblSuccessRegister.Text = lblSuccessRegister.Text + custName + ". Your customerID is" + custID + "."; lblSuccessRegister.Visible = true; btnLogin.Enabled = true; } }
protected void btnLogin_Click(object sender, EventArgs e) { string custID = txtCustomerID.Text; string custPassword = txtPassword.Text; bool checkCustID = int.TryParse(custID, out int custIDValue); if (!checkCustID && custPassword.ToString() == null) { lblError.Visible = true; } else { var objCustomerBLL = new Customers_BLL(); bool checkCust = objCustomerBLL.validateCustomer(custIDValue, custPassword); if (checkCust) { customerID = Convert.ToInt32(txtCustomerID.Text); Session["CustomerID"] = customerID; Response.Redirect("Home.aspx"); } else { lblError.Text = "Your customerID and password do not match. Please try again!"; lblError.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["CustomerID"] != null) { var menu = Master.FindControl("HomeMenu") as Menu; foreach (MenuItem mi in menu.Items) { if (mi.Value == "login") { mi.Text = "Log Out"; } else if (mi.Value == "register") { mi.Text = ""; } } } Session["selectedAccountID"] = null; //session verify if it has an ID or not, if not , redirect to the login if (String.IsNullOrEmpty(Session["CustomerID"] + "")) { Response.Redirect("~/Login.aspx"); } else { var objCustomerBLL = new Customers_BLL(); var objTransactionsBLL = new Transactions_BLL(); var objAccountsBLL = new Accounts_BLL(); int selectedCustomerID = (int)Session["CustomerID"]; //List<Transactions> lstAccountBalances; //lstAccountBalances = objTransactionsBLL.GetAllAccountBalances(selectedCustomerID); List <double> lstBalance = new List <double>(); for (int i = 1; i < 4; i++) { lstBalance.Add(objAccountsBLL.GetBalance(selectedCustomerID, i)); } DataTable dt = new DataTable(); dt.Columns.Add("Account Type"); dt.Columns.Add("Balance"); dt.Rows.Add("Checking"); dt.Rows.Add("Savings"); dt.Rows.Add("Loan"); for (int i = 0; i < lstBalance.Count; i++) { dt.Rows[i]["Balance"] = lstBalance[i]; } lblWelcome.Text = "Welcome " + objCustomerBLL.GetCustomerName(selectedCustomerID); gridAccountBalances.DataSource = dt; gridAccountBalances.DataBind(); } }
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 ActionResult AddNewCustomerBank(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) { objCustomerBanksProperty = new LP_CustomerBanks_Property(); Bank_BLL objBanlBLL = new Bank_BLL(); Customers_BLL objVendorBLL = new Customers_BLL(); objCustomerBanksProperty.BankList = Helper.ConvertDataTable <Bank_Property>(objBanlBLL.ViewAll()); objCustomerBanksProperty.CustomerList = Helper.ConvertDataTable <Customers_Property>(objVendorBLL.ViewAllCustomers()); if (id > 0) { objCustomerBanksProperty.idx = Convert.ToInt32(id); objCustomerBanksBLL = new LP_CustomerBanks_BLL(objCustomerBanksProperty); DataTable dt = objCustomerBanksBLL.SelectOne(); objCustomerBanksProperty.bankIdx = int.Parse(dt.Rows[0]["bankIdx"].ToString()); objCustomerBanksProperty.customerIdx = int.Parse(dt.Rows[0]["customerIdx"].ToString()); objCustomerBanksProperty.accountTitle = dt.Rows[0]["accountTitle"].ToString(); objCustomerBanksProperty.accountNumber = dt.Rows[0]["accountNumber"].ToString(); objCustomerBanksProperty.ibanNumber = dt.Rows[0]["ibanNumber"].ToString(); return(PartialView("AddNewCustomerBank", objCustomerBanksProperty)); } else { return(PartialView("AddNewCustomerBank", objCustomerBanksProperty)); } } else { if (Session["LoggedIn"] == null) { return(RedirectToAction("Login", "Account")); } else { return(RedirectToAction("NotAuthorized", "Account")); } } }
public DataTable GetAllCustomers() { if (Session["LOGGEDIN"] != null) { try { Customers_BLL objvendorbll = new Customers_BLL(); return(objvendorbll.ViewAllCustomers()); } catch (Exception ex) { return(new DataTable()); } } else { return(new DataTable()); } }
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)); } }
static void Main(string[] args) { Accounts_BLL accounts = new Accounts_BLL(); Transactions_BLL transactions = new Transactions_BLL(); Customers_BLL customers = new Customers_BLL(); bool bankMenuFlag = true; bool selectAcctMenuFlag = true; bool mainMenuFlag = true; bool accountMenuFlag = true; bool transMenuFlag = true; bool custFlag = true; bool checkCustFlag = true; BankMenu(); //BankMenu starts the application void BankMenu() { try { do { Console.WriteLine("Application Menu:\n1. Login \n2. Register \n3. Exit"); string bankMenuInput = Console.ReadLine(); bool bankMenuInputCheck = int.TryParse(bankMenuInput, out int bankMenuInputInteger); if (bankMenuInputCheck) { switch (bankMenuInputInteger) { case 1: CustomerLoginMenu(); break; case 2: CustomerRegisterMenu(); continue; case 3: bankMenuFlag = false; Console.ReadKey(); break; default: Console.WriteLine("Please choose either 1 or 2 or 3"); break; } } else { Console.WriteLine("Please enter a value from the given options"); } } while (bankMenuFlag); } catch (Exception e) { Console.WriteLine("Exception caught: {0}", e.ToString()); } } //Method for the customer to log into the application void CustomerLoginMenu() { do { Console.WriteLine("Enter your customer ID:"); string custInput = Console.ReadLine(); bool custInputCheck = int.TryParse(custInput, out int custInputInteger); if (custInputCheck) { checkCustFlag = customers.validateCustomer(custInputInteger); if (checkCustFlag) { Console.WriteLine("Welcome to our Banking Application, {0}. You have successfully logged in.", customers.GetCustomerName(custInputInteger)); MainMenu(custInputInteger); custFlag = false; } else { Console.WriteLine("Your customer ID is not found. Please try again."); } } } while (custFlag); } //Method to register new customer into the application void CustomerRegisterMenu() { try { Console.WriteLine("Welcome to our Banking Application. Please enter the following details:\n"); Console.WriteLine("Enter your Full Name"); string userNameInput = Console.ReadLine(); Console.WriteLine("Enter your Address"); string userAddressInput = Console.ReadLine(); Console.WriteLine("Enter your Telephone Number"); string userTelephoneInput = Console.ReadLine(); Console.WriteLine("You have registered successfully. Your customerID is: {0}", customers.AddNewCustomer(userNameInput, userAddressInput, userTelephoneInput)); } catch (Exception e) { Console.WriteLine("Exception caught: {0}", e.ToString()); } } // Main menu after customer logs in. Gives options to select Accounts or transactions or log out. void MainMenu(int custID) { try { do { Console.WriteLine("Main Menu:\n1. Accounts \n2. Transactions \n3. Log Out"); string mainMenuInput = Console.ReadLine(); bool mainMenuInputCheck = int.TryParse(mainMenuInput, out int mainMenuInputInteger); if (mainMenuInputCheck) { switch (mainMenuInputInteger) { case 1: SelectAccountMenu(custID); break; case 2: SelectTransactionMenu(custID); break; case 3: mainMenuFlag = false; transMenuFlag = false; selectAcctMenuFlag = false; selectAcctMenuFlag = false; Console.ReadKey(); break; default: Console.WriteLine("Please choose either 1 or 2 or 3"); break; } } else { Console.WriteLine("Please enter a value from the given options"); } } while (mainMenuFlag); } catch (Exception e) { Console.WriteLine("Exception caught: {0}", e); } } // Gives options to check balance, deposit or withdraw void AccountMenu(int custID, int acctID) { try { do { Console.WriteLine("Account Menu: \n1. Get Balance \n2. Withdraw \n3. Deposit \n4. Select Account Menu \n5. Main Menu"); string accountMenuInput = Console.ReadLine(); bool accountMenuInputCheck = int.TryParse(accountMenuInput, out int accountMenuInputInteger); if (accountMenuInputCheck) { switch (accountMenuInputInteger) { case 1: Console.WriteLine("Your {0} account balance is: {1}", accounts.GetAccountTypeByID(acctID).GetAccountType(), transactions.GetBalance(custID, acctID)); break; case 2: Console.WriteLine("Enter an amount to withdraw:"); string amount = Console.ReadLine(); bool checkAmount = double.TryParse(amount, out double amountValue); if (checkAmount) { if (transactions.GetBalance(custID, acctID) - amountValue < 0) { Console.WriteLine("Please enter an amount within your balance: {0}", transactions.GetBalance(custID, acctID)); } else { transactions.Withdraw(custID, acctID, amountValue); Console.WriteLine("You have successfully withdrawn {0} from your {1} account.", amountValue, accounts.GetAccountTypeByID(acctID).GetAccountType()); Console.WriteLine("Your current balance in your {0} account is: {1}", accounts.GetAccountTypeByID(acctID).GetAccountType(), transactions.GetBalance(custID, acctID)); } } else { Console.WriteLine("Please enter a proper amount value."); } break; case 3: Console.WriteLine("Enter an amount to deposit:"); string depositAmount = Console.ReadLine(); bool checkDepositAmount = double.TryParse(depositAmount, out double depositAmountValue); if (checkDepositAmount) { if (depositAmountValue < 0) { Console.WriteLine("Please enter a valid amount value."); } else { transactions.Deposit(custID, acctID, depositAmountValue); Console.WriteLine("You have successfully deposited {0} in your {1} account.", depositAmountValue, accounts.GetAccountTypeByID(acctID).GetAccountType()); Console.WriteLine("Your current balance in your {0} account is: {1}", accounts.GetAccountTypeByID(acctID).GetAccountType(), transactions.GetBalance(custID, acctID)); } } else { Console.WriteLine("Please enter a proper amount value."); } break; case 4: SelectAccountMenu(custID); break; case 5: accountMenuFlag = false; selectAcctMenuFlag = false; Console.ReadKey(); break; default: Console.WriteLine("Please select a value from 1 to 5."); break; } } else { Console.WriteLine("Please enter a value from the given options"); } } while (accountMenuFlag); } catch (Exception e) { Console.WriteLine("Exception caught: {0}", e); } } // Gives options for customer to select any of his accounts and to check his balances. void SelectAccountMenu(int custID) { do { Console.WriteLine("Select Account Menu: \n1. {0} \n2. {1} \n3. {2} \n4. Get All Account Balances \n5. Main Menu", AccountType.Checking, AccountType.Savings, AccountType.Loan); string selectAcctMenuInput = Console.ReadLine(); bool selectAcctMenuInputCheck = int.TryParse(selectAcctMenuInput, out int selectAcctMenuInputInteger); if (selectAcctMenuInputCheck) { int acctID; switch (selectAcctMenuInputInteger) { case 1: acctID = (int)AccountType.Checking; AccountMenu(custID, acctID); break; case 2: acctID = (int)AccountType.Savings; AccountMenu(custID, acctID); break; case 3: acctID = (int)AccountType.Loan; AccountMenu(custID, acctID); break; case 4: transactions.DisplayAllBalances(transactions.GetAllAccountBalances(custID)); break; case 5: MainMenu(custID); selectAcctMenuFlag = false; break; default: Console.WriteLine("Please enter a value between 1 to 5."); break; } } else { Console.WriteLine("Please enter a value from the given options."); } } while (selectAcctMenuFlag); } // Gives options for the customer to check his transactions made on their accounts. void SelectTransactionMenu(int custID) { do { Console.WriteLine("Select the account to retrieve transactions: \n1. Checking \n2. Savings \n3. Loan \n4. Get All Transactions \n5. Main Menu "); string selectTransInput = Console.ReadLine(); bool selectTransInputCheck = int.TryParse(selectTransInput, out int selectTransInputInteger); if (selectTransInputCheck) { switch (selectTransInputInteger) { case 1: transactions.DisplayTransactions(transactions.GetTransactionsByID(custID, 1)); continue; case 2: transactions.DisplayTransactions(transactions.GetTransactionsByID(custID, 2)); continue; case 3: transactions.DisplayTransactions(transactions.GetTransactionsByID(custID, 3)); continue; case 4: transactions.DisplayTransactions(transactions.GetAllTransaction(custID)); continue; case 5: MainMenu(custID); mainMenuFlag = false; transMenuFlag = false; selectAcctMenuFlag = false; accountMenuFlag = false; break; default: Console.WriteLine("Please enter a value from the given options."); break; } } else { Console.WriteLine("Please select a value from the given options."); } } while (transMenuFlag); } }
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")); } }
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")); } }