public JsonResult GetSaleOrderItemDetails(int id = 0) { var data = new VehicleInPassRepository().GetSaleOrderItemDetails(id); return(Json(new { SaleOrderRefNo = data.SaleOrderRefNo, WorkDescr = data.WorkDescription, VehicleModelName = data.VehicleModelName, CustomerName = data.CustomerName }, JsonRequestBehavior.AllowGet)); }
public ActionResult Delete(int VehicleInPassId = 0) { try { if (VehicleInPassId == 0) { return(RedirectToAction("Index", "Home")); } string ref_no = new VehicleInPassRepository().DeleteVehicleInPass(VehicleInPassId); TempData["Success"] = "Deleted Successfully! (" + ref_no + ")"; return(RedirectToAction("VehicleInpassList")); } catch (Exception) { TempData["error"] = "Some error occured while deleting. Please try again."; return(RedirectToAction("Edit", new { id = VehicleInPassId })); } }
public ActionResult Edit(int id = 0) { try { if (id != 0) { EmployeeDropdown(); VehicleInPass VehicleInPass = new VehicleInPass(); VehicleInPass = new VehicleInPassRepository().GetVehicleInPassHD(id); return(View(VehicleInPass)); } else { TempData["error"] = "That was an invalid/unknown request. Please try again."; TempData["success"] = ""; } } catch (InvalidOperationException iox) { TempData["error"] = "Sorry, we could not find the requested item. Please try again.|" + iox.Message; } catch (SqlException sx) { TempData["error"] = "Some error occured while connecting to database. Please try again after sometime.|" + sx.Message; } catch (NullReferenceException nx) { TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message; } catch (Exception ex) { TempData["error"] = "Some error occured. Please try again.|" + ex.Message; } TempData["success"] = ""; return(RedirectToAction("VehicleInpassList")); }
public ActionResult LoadQuickView() { if (Session["user"] == null) { return(RedirectToAction("LogOff", "Account")); } QuickView view = new QuickView(); view.PendingDirectPurchaseRequests = true; view.PendingTransQuotations = true; view.PendingProjectQuotations = true; view.PendingSupplyOrders = true; view.PendingWorkshopRequests = true; view.PendingProjectSaleOrdersForJobCard = true; view.PendingTransSaleOrdersForJobCard = true; view.MaterialStockBelowMinLevel = true; view.PendingVechicleInpass = true; view.PendingWRForStoreIssue = true; view.PendingJobcardQC = true; view.PendingMaterialReqPRS = true; if (view.PendingProjectQuotations) { SalesQuotationRepository repo = new SalesQuotationRepository(); var res = repo.GetSalesQuotationApproveList(1, 0, OrganizationId); view.NoOfProjectQuotations = res.Count; } if (view.PendingTransQuotations) { SalesQuotationRepository repo = new SalesQuotationRepository(); var res = repo.GetSalesQuotationApproveList(0, 0, OrganizationId); view.NoOfTransQuotations = res.Count; } if (view.PendingSupplyOrders) { var repo = new GRNRepository(); var res = repo.GetGRNPendingList(0); view.NoOfSupplyOrders = res.Count(); } if (view.PendingDirectPurchaseRequests) { var res = new DirectPurchaseRepository().GetUnApprovedRequests(UserID); view.NoOfPurchaseRequests = res.Count; } if (view.PendingWorkshopRequests) { var rep = new SaleOrderRepository(); var slist = rep.GetSaleOrdersPendingWorkshopRequest(OrganizationId, 0); view.NoOfWorkShopRequests = slist.Count; } if (view.PendingProjectSaleOrdersForJobCard) { var list = new JobCardRepository().GetPendingSO(1, OrganizationId, 0); view.NoOfProjectSaleOrdersForJobCard = list.Count(); } if (view.PendingTransSaleOrdersForJobCard) { var list = new JobCardRepository().GetPendingSO(0, OrganizationId, 0); view.NoOfTransSaleOrdersForJobCard = list.Count(); } if (view.MaterialStockBelowMinLevel) { var list = new ItemRepository().GetCriticalMaterialsBelowMinStock(OrganizationId); view.NoOfMaterialStockBelowMinLevel = list.Count(); //view.NoOfMaterialStockBelowMinLevel = new ItemRepository().GetCriticalMaterialsBelowMinStock(OrganizationId); } if (view.PendingVechicleInpass) { var list = new VehicleInPassRepository().PendingVehicleInpassforAlert(OrganizationId); view.NoOfVechicleInpass = list.Count(); } if (view.PendingWRForStoreIssue) { var list = new WorkShopRequestRepository().PendingWorkshopRequests("", "", "", ""); view.NoOfWRForStoreIssue = list.Count(); } if (view.PendingJobcardQC) { var list = new DeliveryChallanRepository().PendingDelivery(OrganizationId); view.NoOfJobcardQC = list.Count(); } if (view.PendingMaterialReqPRS) { var list = new PurchaseRequestRepository().GetWorkShopRequestPending(OrganizationId, 0, "", "all"); view.NoOfPendingMaterialReqPRS = list.Count(); } IEnumerable <ERPAlerts> Alerts; if (Session["alertpermissions"] == null) { UserRepository repo = new UserRepository(); Alerts = repo.GetAlerts(UserID); Session["alertpermissions"] = Alerts; } else { Alerts = (IEnumerable <ERPAlerts>)Session["alertpermissions"]; Session["alertpermissions"] = Alerts; } AlertPermission alertpermission = new AlertPermission(); foreach (var item in Alerts) { if (item.HasPermission == 1) { switch (item.AlertId) { case 1: alertpermission.ProjectQuotApproval = true; break; case 2: alertpermission.TransportQuotApproval = true; break; case 3: alertpermission.PendingSupplyOrdForGrn = true; break; case 4: alertpermission.DirectPurchaseReqDorApproval = true; break; case 5: alertpermission.PendingSOForWorkshopReq = true; break; //case 6: // alertpermission.PendingProjectSaleOrdersForJobCard = true; // break; //case 7: // alertpermission.PendingTransSaleOrdersForJobCard = true; // break; case 6: alertpermission.MaterialStockBelowMinLevel = true; break; case 7: alertpermission.PendingVechicleInpass = true; break; case 8: alertpermission.PendingWRForStoreIssue = true; break; case 9: alertpermission.PendingJobcardQC = true; break; case 10: alertpermission.PendingMaterialReqPRS = true; break; default: break; } } } ViewBag.AlertPermissions = alertpermission; return(PartialView("_QuickView", view)); }