public ActionResult SingleOrderAdd(AddOrder newentry) { List <Product> prlist = AgroExpressDBAccess.GetAllEnabledProduct(); if (prlist != null) { newentry.productlist = prlist.Select(x => new SelectListItem { Value = x.PKProductId.ToString(), Text = x.ProductName }); } if (ModelState.IsValid) { if (AgroExpressDBAccess.AddSingleOrder(newentry)) { ModelState.Clear(); ViewBag.success = "Order has been placed Successfully"; } else { ViewBag.success = "Sorry, Your order is not placed, Please try again"; } } newentry.OrderPlacingDateTime = newentry.OrderPlacingDateTime; return(View(newentry)); }
public ActionResult Add() { AddOrderListView newentry = new AddOrderListView(); List <Product> prlist = AgroExpressDBAccess.GetAllEnabledProduct(); var ProductInf = AgroExpressDBAccess.GetAllEnabledProduct(); List <AddOrder> orders = new List <AddOrder>(); int len = ProductInf.Count; for (int i = 0; i < len; i++) { orders.Add(new AddOrder { productlist = ProductInf.Select(x => new SelectListItem { Value = x.PKProductId.ToString(), Text = x.ProductName }), OrderPlacingDateTime = DateTime.Now.Date, Amount = 0 }); } newentry.orderlist = orders; return(View(newentry)); }
public ActionResult Factory() { FactoryProduction productionInfo = new FactoryProduction(); var ProductInf = AgroExpressDBAccess.GetAllEnabledProduct(); ProductInf = ProductInf.Where(a => a.ProductName.ToLower() != "milk").ToList(); int len = ProductInf.Count; List <ProductionInfo> NewProduction = new List <ProductionInfo>(); for (int i = 0; i < len; i++) { NewProduction.Add(new ProductionInfo { productlist = ProductInf.Select(x => new SelectListItem { Value = x.PKProductId.ToString(), Text = x.ProductName }), Date = System.DateTime.Now, Amount = 0 }); } productionInfo.productionlist = NewProduction; productionInfo.ConsumptionDate = System.DateTime.Now.Date; return(View(productionInfo)); }
public ActionResult FactoryList(FactoryProductionList request) { List <Production> ProductionInfo = AgroExpressDBAccess.ProductionInfoByDate(request.EntryDateMin, request.EntryDateMax); if (request.ProductID != null) { ProductionInfo = ProductionInfo.Where(a => a.ProductId == request.ProductID).ToList(); } if (request.AmountMax != null) { ProductionInfo = ProductionInfo.Where(a => a.Amount <= request.AmountMax).ToList(); } if (request.AmountMin != null) { ProductionInfo = ProductionInfo.Where(a => a.Amount >= request.AmountMin).ToList(); } var ProductInf = AgroExpressDBAccess.GetAllEnabledProduct(); ProductInf = ProductInf.Where(a => a.ProductName.ToLower() != "milk").ToList(); request.ProductList = ProductInf.Select(x => new SelectListItem { Value = x.PKProductId.ToString(), Text = x.ProductName }); request.SearchResult = ProductionInfo; return(View(request)); }
public ActionResult Login(LoginView login, string ReturnUrl = "") { if (ModelState.IsValid) { var user = AgroExpressDBAccess.IsEnableUserExist(login.UserName); if (!user) { ModelState.AddModelError("UserName", "User name not found!!"); return(View()); } //var pass = Cryptography.Hash(login.Password); var pass = login.Password; var u = AgroExpressDBAccess.IsUserPassValid(login.UserName, pass); if (u == null) { ModelState.AddModelError("Password", "User name and password not matched!!!"); return(View()); } int timeout = login.RememberMe ? 525600 : 60; // 525600 min = 1 year var ticket = new FormsAuthenticationTicket(login.UserName, login.RememberMe, timeout); string encrypted = FormsAuthentication.Encrypt(ticket); var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encrypted); cookie.Expires = DateTime.Now.AddMinutes(timeout); cookie.HttpOnly = true; Response.Cookies.Add(cookie); return(RedirectToAction("Index", "Administrator")); } return(View()); }
public ActionResult TransactionHistory(int?id) { if (id == null) { string name = HttpContext.User.Identity.Name; id = AgroExpressDBAccess.GetCustomerIdByUserId(name); if (id == 0) { return(RedirectToAction("ResourceNotFound", "Home")); } } var customer = AgroExpressDBAccess.GetCustomerByID((int)id); if (customer != null) { List <CustomerTransactionDetails> li = new List <CustomerTransactionDetails>(); CustomerTransactionDate tem = new CustomerTransactionDate(); tem.ID = customer.PKCustomerId; tem.Name = customer.FullName; tem.transactiondetails = li; tem.EndDate = DateTime.Now.AddDays(1).Date; tem.StartDate = tem.EndDate.AddDays(-30); var cus = AgroExpressDBAccess.GetCustomerTransectionHistory(tem.StartDate, tem.EndDate, (int)id); List <CustomerTransactionDetails> transactions = new List <CustomerTransactionDetails>(); tem.transactiondetails = cus; return(View(tem)); } return(Redirect(Request.UrlReferrer.ToString())); }
public ActionResult Add(SalePoint newentry) { if (ModelState.IsValid) { var salepoint = AgroExpressDBAccess.IsSalePointExist(newentry.SalePointName); if (salepoint != null) { ModelState.AddModelError("SalePointName", "Sale Point already exist"); return(View(newentry)); } var salepointt = new SalePoint(); salepointt.SalePointName = newentry.SalePointName; salepointt.SalePointAddress = newentry.SalePointAddress; salepointt.IsDeleted = false; if (AgroExpressDBAccess.AddSalePoint(salepointt)) { ViewBag.success = "Sale Point Add Successsfull"; ModelState.Clear(); SalePoint registration = new SalePoint(); return(View(registration)); } } return(View(newentry)); }
public ActionResult TransferList() { SalePointProductAddList request = new SalePointProductAddList(); List <SalePoint> SalePointList = new List <SalePoint>(); SalePointList = AgroExpressDBAccess.GetallEnabledSalePoint(); request.salepointlist = SalePointList.Select(x => new SelectListItem { Value = x.PKSalePointID.ToString(), Text = x.SalePointName }); var ProductInf = AgroExpressDBAccess.GetAllEnabledProduct(); request.product = ProductInf.Select(x => new SelectListItem { Value = x.PKProductId.ToString(), Text = x.ProductName }); request.EntryDateMax = System.DateTime.Now; request.EntryDateMin = request.EntryDateMax.AddMonths(-1); request.SearchResult = AgroExpressDBAccess.GetSellPointProductAdd(request.EntryDateMin, request.EntryDateMax).OrderBy(a => a.Date).ToList(); return(View(request)); }
public ActionResult Edit(EditArea narea) { List <SalePoint> salepointlist = AgroExpressDBAccess.GetallEnabledSalePoint(); if (salepointlist != null) { narea.salepointlist = salepointlist.Select(x => new SelectListItem { Value = x.PKSalePointID.ToString(), Text = x.SalePointName }); } if (ModelState.IsValid) { //if (AgroExpressDBAccess.isAreaExist(narea.AreaName)) //{ // ModelState.AddModelError("AreaName", "Area name already exist!!!"); // return View(narea); //} //else //{ if (AgroExpressDBAccess.UpdateArea(narea)) { return(RedirectToAction("EnabledArea")); } //} } return(View(narea)); }
private void GetUserPermissionList() { UserLogin _user = AgroExpressDBAccess.IsUserExist(this.Username); if (_user != null) { this.UserType = _user.UserType; PermissionAssign UserPermission = new PermissionAssign(); if (this.UserType == 1) { this.Permission = UserPermission.Admin; } else if (this.UserType == 2) { this.Permission = UserPermission.Manager; } else if (this.UserType == 3) { this.Permission = UserPermission.DeliveryBoy; } else if (this.UserType == 4) { this.Permission = UserPermission.Customer; } else if (this.UserType == 5) { this.Permission = UserPermission.FirmManager; } else if (this.UserType == 6) { this.Permission = UserPermission.Partner; } } }
public ActionResult Stock() { SalePointProductStockList request = new SalePointProductStockList(); List <SalePoint> SalePointList = new List <SalePoint>(); SalePointList = AgroExpressDBAccess.GetallEnabledSalePoint(); request.salepointlist = SalePointList.Select(x => new SelectListItem { Value = x.PKSalePointID.ToString(), Text = x.SalePointName }); var ProductInf = AgroExpressDBAccess.GetAllEnabledProduct(); request.product = ProductInf.Select(x => new SelectListItem { Value = x.PKProductId.ToString(), Text = x.ProductName }); List <SalePointProductStock> productStock = new List <SalePointProductStock>(); productStock = AgroExpressDBAccess.GetSalePointProductStock(); request.SearchResult = productStock.OrderBy(o => o.SalePointId).ToList(); return(View(request)); }
public ActionResult Add() { string name = HttpContext.User.Identity.Name; List <SalePoint> salePointList = new List <SalePoint>(); salePointList = AgroExpressDBAccess.GetSalePointListForUSer(name); SalePointProductAdd salePointProductTransfer = new SalePointProductAdd(); salePointProductTransfer.salepointlist = salePointList.Select(x => new SelectListItem { Value = x.PKSalePointID.ToString(), Text = x.SalePointName }); List <ProductTransferInfo> PTI = new List <ProductTransferInfo>(); var MilkInfo = AgroExpressDBAccess.IsProductExist("Milk"); if (MilkInfo != null) { PTI.Add(new ProductTransferInfo { ProductId = MilkInfo.PKProductId, Amount = null }); } else { Product MilkInfoAdd = new Product { ProductName = "Milk", SellingUnit = "Ltr", Stock = 0 }; AgroExpressDBAccess.AddProduct(MilkInfoAdd); MilkInfo = AgroExpressDBAccess.IsProductExist("Milk"); PTI.Add(new ProductTransferInfo { ProductId = MilkInfo.PKProductId, Amount = null }); } // Product dropdown list var ProductInf = AgroExpressDBAccess.GetAllEnabledProduct(); ProductInf = ProductInf.Where(a => a.ProductName.ToLower() != "milk").ToList(); salePointProductTransfer.product = ProductInf.Select(x => new SelectListItem { Value = x.PKProductId.ToString(), Text = x.ProductName }); // int len = ProductInf.Count; for (int i = 0; i < len; i++) { PTI.Add(new ProductTransferInfo { ProductId = null, Amount = null }); } salePointProductTransfer.TransferedProductInfo = PTI; salePointProductTransfer.Date = System.DateTime.Now.Date; return(View(salePointProductTransfer)); }
public ActionResult Edit(EditSubArea narea) { List <Area> arealist = AgroExpressDBAccess.GetallEnabledArea(); if (arealist != null) { narea.arealist = arealist.Select(x => new SelectListItem { Value = x.PKAreaId.ToString(), Text = x.AreaName }); } if (ModelState.IsValid) { //if (AgroExpressDBAccess.isSubAreaExist(narea.SubAreaName)) //{ // ModelState.AddModelError("SubAreaName", "Sub Area Name name already exist!!!"); // return View(narea); //} //else //{ if (AgroExpressDBAccess.UpdateSubArea(narea)) { return(RedirectToAction("EnabledList")); } //} } return(View(narea)); }
public ActionResult CustomerDueList() { var customerlist = AgroExpressDBAccess.GetallEnabledCustomer(); List <CustomerDues> customerdueList = new List <CustomerDues>(); foreach (var due in customerlist) { var subarea = AgroExpressDBAccess.GetSubAreaById(due.SubAreaId); double bill; if (due.TotalPaid >= due.TotalBill) { bill = 0; } else { bill = due.TotalBill - due.TotalPaid; customerdueList.Add(new CustomerDues { CustomerName = due.FullName, Mobile = due.Mobile, SubAreaName = subarea.SubAreaName, TotalDue = bill }); } } return(View(customerdueList)); }
public ActionResult Index([Bind(Exclude = "ProductSearchResult")] ProductListView SerchCriteria) { var ProductList = AgroExpressDBAccess.GetAllEnabledProduct(); ProductListView ProductListV = new ProductListView(); ProductListV.ProductList = ProductList.Select(x => new SelectListItem { Value = x.PKProductId.ToString(), Text = x.ProductName, Selected = x.PKProductId == SerchCriteria.SelectedProductID ? true : false }); var SearchResult = AgroExpressDBAccess.SearchProduct(SerchCriteria.SelectedProductID, SerchCriteria.MinimumStock, SerchCriteria.MaximumStock); if (SearchResult != null) { ProductListV.ProductSearchResult = SearchResult; } else { ProductListV.ProductSearchResult = new List <Product>(); } ProductListV.MaximumStock = SerchCriteria.MaximumStock; ProductListV.MinimumStock = SerchCriteria.MinimumStock; ModelState.Clear(); return(View(ProductListV)); }
public ActionResult Edit(FirmManagerEdit editentry) { List <SalePoint> salepointlist = AgroExpressDBAccess.GetallEnabledSalePoint(); if (salepointlist != null) { editentry.salepointlist = salepointlist.Select(x => new SelectListItem { Value = x.PKSalePointID.ToString(), Text = x.SalePointName }); } if (ModelState.IsValid) { var userinfo = AgroExpressDBAccess.IsUserExist(editentry.UserName); if (userinfo != null) { if (userinfo.PkUserID != editentry.LoginUserID) { ModelState.AddModelError("UserName", "User Name Already Exists!!!"); return(View(editentry)); } } if (AgroExpressDBAccess.UpdateFirmManager(editentry)) { ViewBag.success = "Firm Manager has been updated successfully"; return(RedirectToAction("EnabledList")); } } return(View(editentry)); }
public ActionResult Edit(CustomerEdit customeredit) { List <SalePoint> salepointlist = AgroExpressDBAccess.GetallEnabledSalePoint(); if (salepointlist != null) { customeredit.salepointlist = salepointlist.Select(x => new SelectListItem { Value = x.PKSalePointID.ToString(), Text = x.SalePointName }); } List <Area> arealist = AgroExpressDBAccess.GetallEnabledArea(); if (arealist != null) { customeredit.arealist = arealist.Select(x => new SelectListItem { Value = x.PKAreaId.ToString(), Text = x.AreaName }); } List <SubArea> sarealist = AgroExpressDBAccess.GetallEnabledSubArea(); if (sarealist != null) { customeredit.subarealist = sarealist.Select(x => new SelectListItem { Value = x.PKSubAreaId.ToString(), Text = x.SubAreaName }); } if (ModelState.IsValid) { var userinfo = AgroExpressDBAccess.IsUserExist(customeredit.UserName); if (userinfo != null) { if (userinfo.PkUserID != customeredit.LoginUserID) { ModelState.AddModelError("UserName", "User Name Already Exists!!!"); return(View(customeredit)); } } if (AgroExpressDBAccess.UpdateCustomer(customeredit)) { ViewBag.success = "Customer added successfully"; return(RedirectToAction("EnabledCustomer")); } } return(View(customeredit)); }
public ActionResult Delete(int id) { var area = AgroExpressDBAccess.isAreaExistById(id); if (area) { AgroExpressDBAccess.DisableArea(id); } return(RedirectToAction("EnabledArea")); }
public ActionResult CustomerChangePassword() { ChangePassword updatep = new ChangePassword(); string name = HttpContext.User.Identity.Name; var user = AgroExpressDBAccess.IsUserExist(name); updatep.LoginUserID = user.PkUserID; updatep.UserName = user.UserName; return(View(updatep)); }
public ActionResult Edit(int ID) { var Product = AgroExpressDBAccess.GetProductByID(ID); if (Product != null) { return(View(Product)); } return(View()); }
public ActionResult Update() { SMSConfiguration sms = new SMSConfiguration(); var smsdata = AgroExpressDBAccess.GetSMSPrivacyInformation(); sms.APIKey = smsdata.APIKey; sms.Masking = smsdata.Masking; sms.ID = smsdata.ID; return(View(sms)); }
public ActionResult Edit(Product product) { if (AgroExpressDBAccess.UpdateProduct(product)) { return(RedirectToAction(nameof(Index))); } else { ViewBag.Message = "Unable to update"; return(View(product)); } }
public ActionResult Add(AddOrderListView newentry) { List <Order> neworder = new List <Order>(); for (int i = 0; i < newentry.orderlist.Count; i++) { if (newentry.orderlist[i].PKProductId != 0 && newentry.orderlist[i].Amount != 0 && newentry.orderlist[i].OrderPlacingDateTime != null) { neworder.Add(new Order { CustomerId = 1, ProductId = newentry.orderlist[i].PKProductId, OrderPlacingDateTime = newentry.orderlist[i].OrderPlacingDateTime, OrderDateTime = System.DateTime.Now.Date, Amount = newentry.orderlist[i].Amount }); } } if (AgroExpressDBAccess.AddOrder(neworder)) { ViewBag.success("Order Successful"); } else { ViewBag.success("Sorry, Your order is not placed, Please try again"); } List <Product> prlist = AgroExpressDBAccess.GetAllEnabledProduct(); var ProductInf = AgroExpressDBAccess.GetAllEnabledProduct(); List <AddOrder> orders = new List <AddOrder>(); int len = ProductInf.Count; for (int i = 0; i < len; i++) { orders.Add(new AddOrder { productlist = ProductInf.Select(x => new SelectListItem { Value = x.PKProductId.ToString(), Text = x.ProductName }), OrderPlacingDateTime = System.DateTime.Now.Date, Amount = 0 }); } newentry.orderlist = orders; return(View(newentry)); }
public ActionResult MilksummaryEdit(MilkSummeryEdit newentry) { if (ModelState.IsValid) { if (AgroExpressDBAccess.EditMilkSummary(newentry)) { return(RedirectToAction("Index", "Administrator")); } } return(View(newentry)); }
//[AcceptVerbs(HttpVerbs.Post)] public ActionResult Factory(FactoryProduction productionInfo) { List <Production> ProductionList = new List <Production>(); string name = HttpContext.User.Identity.Name; string operatorName = AgroExpressDBAccess.GetFullNamebyUserID(name); foreach (var production in productionInfo.productionlist) { if (production.PKProductId != null && production.Amount != null) { ProductionList.Add(new Production { ProductId = (int)production.PKProductId, Amount = (double)production.Amount, Date = production.Date, OperatorName = operatorName }); } } if (productionInfo.ConsumptionDate != null && productionInfo.MilkConsumption != null) { AgroExpressDBAccess.AddFactoryMilkConsumption((DateTime)productionInfo.ConsumptionDate, (double)productionInfo.MilkConsumption); } string message = AgroExpressDBAccess.AddPoductionList(ProductionList); if (message == "yes") { return(RedirectToAction(nameof(Factory))); } else { var ProductInf = AgroExpressDBAccess.GetAllEnabledProduct(); int len = ProductInf.Count; List <ProductionInfo> NewProduction = new List <ProductionInfo>(); for (int i = 0; i < len; i++) { NewProduction.Add(new ProductionInfo { productlist = ProductInf.Select(x => new SelectListItem { Value = x.PKProductId.ToString(), Text = x.ProductName }), Date = System.DateTime.Now, Amount = 0 }); } productionInfo.productionlist = NewProduction; ViewBag.message = message; } return(View(productionInfo)); }
public ActionResult EnabledCustomer() { CustomerListView culist = new CustomerListView(); List <SalePoint> salepointlist = AgroExpressDBAccess.GetallEnabledSalePoint(); if (salepointlist != null) { culist.salepointlist = salepointlist.Select(x => new SelectListItem { Value = x.PKSalePointID.ToString(), Text = x.SalePointName }); } List <Area> arealist = AgroExpressDBAccess.GetallEnabledArea(); if (arealist != null) { culist.arealist = arealist.Select(x => new SelectListItem { Value = x.PKAreaId.ToString(), Text = x.AreaName }); } List <SubArea> sarealist = AgroExpressDBAccess.GetallEnabledSubArea(); if (sarealist != null) { culist.subarealist = sarealist.Select(x => new SelectListItem { Value = x.PKSubAreaId.ToString(), Text = x.SubAreaName }); } var customerlist = AgroExpressDBAccess.GetallEnabledCustomer(); culist.customerlist = customerlist; if (customerlist != null) { culist.selectedcustomerlist = customerlist.Select(x => new SelectListItem { Value = x.PKCustomerId.ToString(), Text = x.FullName }); } return(View(culist)); }
public ActionResult Edit(int id) { var salepoint = AgroExpressDBAccess.GetSalePointById(id); EditSalePoint editentry = new EditSalePoint(); if (salepoint != null) { editentry.PKSalePointID = salepoint.PKSalePointID; editentry.SalePointName = salepoint.SalePointName; editentry.SalePointAddress = salepoint.SalePointAddress; } return(View(editentry)); }
public ActionResult Delete(int id) { var fmId = AgroExpressDBAccess.GetFirmManagerByID(id); if (fmId.IsDeleted == false) { AgroExpressDBAccess.DisableFirmManager(fmId.PKFirmManagerId); return(RedirectToAction("EnabledList")); } else { return(RedirectToAction("EnabledList")); } }
public ActionResult Delete(int id) { var cId = AgroExpressDBAccess.GetCustomerByID(id); if (cId.IsDeleted == false) { AgroExpressDBAccess.DisableCustomer(cId.PKCustomerId); return(RedirectToAction("EnabledCustomer")); } else { return(RedirectToAction("EnabledCustomer")); } }
public JsonResult CustomerInfo(int CustomerID) { var customerinfo = AgroExpressDBAccess.GetCustomerByID(CustomerID); var returnResult = new CustomerViewInfo { Mobile = customerinfo.Mobile, Adress = customerinfo.Address, Rate = customerinfo.Rate, ServiceCharge = customerinfo.ServiceCharge }; return(Json(returnResult, JsonRequestBehavior.AllowGet)); }