public void FillBay1(int JobCardId) { JobCardRepository repo = new JobCardRepository(); var result = repo.GetBayList1(JobCardId); ViewBag.BayList = new SelectList(result, "BayId", "BayName"); }
public void FillTaks(int workId) { JobCardRepository repo = new JobCardRepository(); var result = repo.GetWorkVsTask(workId); ViewBag.TaskList = new SelectList(result, "JobCardTaskMasterId", "JobCardTaskName"); }
public void FillFreezerUnit() { JobCardRepository repo = new JobCardRepository(); var result = repo.GetFreezerUnits(); ViewBag.FreezerUnits = new SelectList(result, "FreezerUnitId", "FreezerUnitName"); }
public ActionResult Release(int?jobcard) { try { if (jobcard == null) { TempData["error"] = "That was an invalid/unknown request. Please try again."; return(RedirectToAction("Index", "Home")); } bool success = new JobCardRepository().ReleaseJobCard(jobcard ?? 0, UserID); if (success) { TempData["success"] = "Job Card released successfully"; } else { TempData["error"] = "Another Job Card exists in the bay. Please complete it to continue."; } } catch (Exception) { TempData["error"] = "Some error occurred. Please try again."; } return(RedirectToAction("JobCardsOnHold")); }
public void FillBox() { JobCardRepository repo = new JobCardRepository(); var result = repo.GetBoxes(); ViewBag.Boxes = new SelectList(result, "BoxId", "BoxName"); }
public void FillBay(int isService) { JobCardRepository repo = new JobCardRepository(); var result = repo.GetBayList(isService); ViewBag.BayList = new SelectList(result, "BayId", "BayName"); }
public void FillEmployee() { JobCardRepository repo = new JobCardRepository(); var result = repo.GetEmployeeList(); ViewBag.EmployeeList = new SelectList(result, "EmployeeId", "EmployeeName"); }
public ActionResult Create(int Id) { JobCardRepository jcRepo = new JobCardRepository(); EmployeeRepository emRepo = new EmployeeRepository(); JobCard jc = jcRepo.GetDetailsById(Id, null); //FillTaks(jc.WorkDescriptionId); JobCardDailyActivity model = new JobCardDailyActivity(); if (jc.isProjectBased == 1) { model.JobCardDailyActivityRefNo = DatabaseCommonRepository.GetNextDocNo(38, OrganizationId); //FillTasks(); FillTasks(jc.isProjectBased); FillEmployees(); } else { model.JobCardDailyActivityRefNo = DatabaseCommonRepository.GetNextDocNo(27, OrganizationId); } model.CreatedDate = DateTime.Now; model.JobCardDailyActivityDate = DateTime.Now; model.isProjectBased = jc.isProjectBased; model.CustomerName = jc.CustomerName; if (model.isProjectBased == 0) { model.JobCardDailyActivityTask = new JobCardDailyActivityRepository().GetJobCardTasksForDailyActivity(Id, OrganizationId); } else { model.JobCardDailyActivityTask = new List <JobCardDailyActivityTask>(); model.JobCardDailyActivityTask.Add(new JobCardDailyActivityTask { TaskStartDate = model.JobCardDailyActivityDate, TaskEndDate = model.JobCardDailyActivityDate }); } //if (model.JobCardDailyActivityTask.Count > 0) //{ // foreach (var item in model.JobCardDailyActivityTask) // { // item.StartTime = "00:00"; item.EndTime = "00.00"; // } //} //model.JobCardDailyActivityTask = new List<JobCardDailyActivityTask>(); //model.JobCardDailyActivityTask.Add(new JobCardDailyActivityTask() { TaskStartDate = DateTime.Now, TaskEndDate = DateTime.Now}); Employee emp = emRepo.GetEmployee(jc.EmployeeId); model.EmployeeId = jc.EmployeeId; model.EmployeeName = emp.EmployeeName; model.JobCardNo = jc.JobCardNo; model.JobCardId = Id; ViewBag.isTxnPending = true; return(View(model)); }
//public ActionResult ConsumptionGrid() //{ // return PartialView("_ConsumptionGrid"); //} public JsonResult JobCardDetails(int jobCardId) { Consumption j = new JobCardRepository().GetJobCardDetails1(jobCardId); return(Json(new { JobCardDate = j.JobCardDate, SONoDate = j.SONoDate, FreezerUnitName = j.FreezerUnitName, BoxName = j.BoxName }, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(int?Id, int?isProjectBased) //SaleOrderItemId is received here { try { FillEmployee(); JobCardRepository repo = new JobCardRepository(); SaleOrderRepository soRepo = new SaleOrderRepository(); isProjectBased = soRepo.IsProjectOrVehicle(Id ?? 0); JobCard model = repo.GetJobCardDetails(Id ?? 0, isProjectBased ?? 0); model.JobCardNo = DatabaseCommonRepository.GetNextDocNo( model.isService == 1 ? (isProjectBased ?? 0) == 1 ? 40 : 34 : (isProjectBased ?? 0) == 1 ? 39 : 16, OrganizationId); model.isProjectBased = isProjectBased ?? 0; model.JobCardTasks = new List <JobCardTask>(); model.JobCardTasks.Add(new JobCardTask() { TaskDate = DateTime.Now }); model.JobCardDate = DateTime.Now; model.RequiredDate = DateTime.Now; FillBay(model.isService); //FillAllTasks(); FillTasks(model.isProjectBased); //if (model.isService == 1) // FillTaks(model.WorkDescriptionId); //else // FillFreezerAndBoxTasks(Id); //FillTaks(model.WorkDescriptionId); //FillFreezerUnit(); //FillBox(); //FillVehicleRegNo(); return(View(model)); } catch (Exception ex) { string ErrorMessage = ex.Message.ToString(); if (ex.InnerException != null) { if (ex.InnerException.Message != null) { ErrorMessage = ErrorMessage + ex.InnerException.Message.ToString(); } } ViewData["Error"] = ErrorMessage; return(View("ShowError")); } }
public ActionResult Edit(int id = 0)//JobCardId is received here { if (id == 0) { return(RedirectToAction("Index", "Home")); } JobCard model = new JobCardRepository().GetJobCardDetails2(id, OrganizationId); FillBay1(model.JobCardId); FillEmployee(); //FillAllTasks(); FillTasks(model.isProjectBased); //FillTaks(model.WorkDescriptionId); //if (model.isService == 1) // FillTaks(model.WorkDescriptionId); //else // FillFreezerAndBoxTasks(model.SaleOrderItemId); return(View(model)); }
public ActionResult Delete(int JobCardId = 0, int isProjectBased = 0) { try { if (JobCardId == 0) { return(RedirectToAction("Index", "Home")); } //JobCard model = new JobCardRepository().GetJobCardDetails2(JobCardId, OrganizationId); JobCard model = new JobCardRepository().DeleteJobCard(JobCardId); TempData["success"] = "Deleted Successfully (" + model.JobCardNo + ")"; return(RedirectToAction("Index", new { ProjectBased = model.isProjectBased, service = model.isService })); } catch (Exception) { TempData["error"] = "Some error occured while deleting. Please try again."; return(RedirectToAction("Edit", new { id = JobCardId })); } }
public UnitOfWork(ApplicationDbContext context) { _context = context; StockItems = new StockRepository(_context); Invoices = new InvoiceRepository(_context); JobCards = new JobCardRepository(_context); JobStatuses = new JobStatusRepository(_context); Suppliers = new SupplierRepository(_context); JobTypes = new JobTypeRepository(_context); Customers = new CustomerRepository(_context); ServiceContracts = new ServiceContractRepository(_context); MaintenanceContracts = new MaintenanceContractRepository(_context); Areas = new AreaRepository(_context); PurchaseOrders = new PurchaseOrderRepository(_context); PurchaseOrderItems = new PurchaseOrderItemRepository(_context); ApplicationUserSignatures = new ApplicationUserSignatureRepository(_context); CustomerSignatures = new CustomerSignatureRepository(_context); JobStatusHistory = new JobStatusHistoryRepository(_context); Quotes = new QuotationRepository(_context); StockItemQuantities = new StockItemQuantityRepository(_context); }
public ActionResult View(int Id) { Item objItem = new JobCardRepository().GetItem(Id); return(View("Create", objItem)); }
public ActionResult ProjectStatusReport(int id = 0) { ReportDocument rd = new ReportDocument(); rd.Load(Path.Combine(Server.MapPath("~/Reports"), "ProjectStatusReport.rpt")); DataSet ds = new DataSet(); ds.Tables.Add("OrganizationDtls"); ds.Tables.Add("ProjectDtls"); ds.Tables.Add("RoomDtls"); ds.Tables.Add("DailyActivityDtls"); ds.Tables.Add("DelieveryStatus"); //-------Organization Dtls ds.Tables["OrganizationDtls"].Columns.Add("OrganizationName"); ds.Tables["OrganizationDtls"].Columns.Add("Image1"); //-------Project Dtls ds.Tables["ProjectDtls"].Columns.Add("JobCardNo"); ds.Tables["ProjectDtls"].Columns.Add("JobCardDate"); ds.Tables["ProjectDtls"].Columns.Add("Customer"); ds.Tables["ProjectDtls"].Columns.Add("ProjectName"); ds.Tables["ProjectDtls"].Columns.Add("ContactPerson"); ds.Tables["ProjectDtls"].Columns.Add("ContactNumber"); ds.Tables["ProjectDtls"].Columns.Add("InCharge"); ds.Tables["ProjectDtls"].Columns.Add("CostingAmount"); ds.Tables["ProjectDtls"].Columns.Add("QuerySheetRefNo"); //-------Room Dtls ds.Tables["RoomDtls"].Columns.Add("RoomDetails"); ds.Tables["RoomDtls"].Columns.Add("RoomSize"); ds.Tables["RoomDtls"].Columns.Add("TempRequired"); ds.Tables["RoomDtls"].Columns.Add("Door"); ds.Tables["RoomDtls"].Columns.Add("Floor"); //-------Daily Activity Dtls ds.Tables["DailyActivityDtls"].Columns.Add("JobCardDailyActivityDate"); ds.Tables["DailyActivityDtls"].Columns.Add("JobCardTaskName"); ds.Tables["DailyActivityDtls"].Columns.Add("EmployeeName"); ds.Tables["DailyActivityDtls"].Columns.Add("StartTime"); ds.Tables["DailyActivityDtls"].Columns.Add("EndTime"); ds.Tables["DailyActivityDtls"].Columns.Add("EstHours"); ds.Tables["DailyActivityDtls"].Columns.Add("OverTime"); ds.Tables["DailyActivityDtls"].Columns.Add("ActualHours"); //-------Material Delievery Status ds.Tables["DelieveryStatus"].Columns.Add("ItemName"); ds.Tables["DelieveryStatus"].Columns.Add("IssuedQuantity"); //----------------DATA SET------------------- //--------------------------------Organization Dtls OrganizationRepository repo = new OrganizationRepository(); var OrganizationDtls = repo.GetOrganization(OrganizationId); DataRow dr = ds.Tables["OrganizationDtls"].NewRow(); dr["OrganizationName"] = OrganizationDtls.OrganizationName; dr["Image1"] = Server.MapPath("~/App_images/") + OrganizationDtls.Image1; ds.Tables["OrganizationDtls"].Rows.Add(dr); //--------------------------------Project Dtls JobCardRepository repo1 = new JobCardRepository(); var ProjectDtls = repo1.GetProjectDtls(id); DataRow dr1 = ds.Tables["ProjectDtls"].NewRow(); dr1["JobCardNo"] = ProjectDtls.JobCardNo; dr1["JobCardDate"] = ProjectDtls.JobCardDate.ToString("dd-MMM-yyyy"); dr1["Customer"] = ProjectDtls.Customer; dr1["ProjectName"] = ProjectDtls.ProjectName; dr1["ContactPerson"] = ProjectDtls.ContactPerson; dr1["ContactNumber"] = ProjectDtls.ContactNumber; dr1["InCharge"] = ProjectDtls.InCharge; dr1["CostingAmount"] = ProjectDtls.CostingAmount; dr1["QuerySheetRefNo"] = ProjectDtls.QuerySheetRefNo; ds.Tables["ProjectDtls"].Rows.Add(dr1); //--------------------------------Room Dtls JobCardRepository repo2 = new JobCardRepository(); var RoomDtls = repo2.GetRoomDtls(id); foreach (var item in RoomDtls) { var RDtls = new ProjectStatusReport { RoomDetails = item.RoomDetails, RoomSize = item.RoomSize, TempRequired = item.TempRequired, Door = item.Door, Floor = item.Floor, }; DataRow dr2 = ds.Tables["RoomDtls"].NewRow(); dr2["RoomDetails"] = RDtls.RoomDetails; dr2["RoomSize"] = RDtls.RoomSize; dr2["TempRequired"] = RDtls.TempRequired; dr2["Door"] = RDtls.Door; dr2["Floor"] = RDtls.Floor; ds.Tables["RoomDtls"].Rows.Add(dr2); } //--------------------------------Daily Activity Dtls JobCardRepository repo3 = new JobCardRepository(); var DailyActivityDtls = repo3.GetDailyActivityDtls(id); foreach (var item in DailyActivityDtls) { var DADtls = new ProjectStatusReport { JobCardDailyActivityDate = item.JobCardDailyActivityDate, JobCardTaskName = item.JobCardTaskName, EmployeeName = item.EmployeeName, StartTime = item.StartTime, EndTime = item.EndTime, EstHours = item.EstHours, OverTime = item.OverTime, ActualHours = item.ActualHours, }; DataRow dr3 = ds.Tables["DailyActivityDtls"].NewRow(); dr3["JobCardDailyActivityDate"] = DADtls.JobCardDailyActivityDate.ToString("dd-MMM-yyyy"); dr3["JobCardTaskName"] = DADtls.JobCardTaskName; dr3["EmployeeName"] = DADtls.EmployeeName; dr3["StartTime"] = DADtls.StartTime; dr3["EndTime"] = DADtls.EndTime; dr3["EstHours"] = DADtls.EstHours; dr3["OverTime"] = DADtls.OverTime; dr3["ActualHours"] = DADtls.ActualHours; ds.Tables["DailyActivityDtls"].Rows.Add(dr3); } //--------------------------------Material Delievery Status JobCardRepository repo4 = new JobCardRepository(); var DelieveryStatus = repo4.GetDelieveryStatusDtls(id); foreach (var item in DelieveryStatus) { var DSDtls = new ProjectStatusReport { ItemName = item.ItemName, IssuedQuantity = item.IssuedQuantity, }; DataRow dr4 = ds.Tables["DelieveryStatus"].NewRow(); dr4["ItemName"] = DSDtls.ItemName; dr4["IssuedQuantity"] = DSDtls.IssuedQuantity; ds.Tables["DelieveryStatus"].Rows.Add(dr4); } ds.WriteXml(Path.Combine(Server.MapPath("~/XML"), "ProjectStatusReport.xml"), XmlWriteMode.WriteSchema); rd.SetDataSource(ds); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); try { Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf")); } catch (Exception ex) { throw; } }
public ActionResult JobCardReport(int Id) { ReportDocument rd = new ReportDocument(); DataSet ds = new DataSet(); ds.Tables.Add("Head"); ds.Tables.Add("Items"); //-------HEAD ds.Tables["Head"].Columns.Add("JobCardNo"); ds.Tables["Head"].Columns.Add("InternalJobCardNo"); ds.Tables["Head"].Columns.Add("JobCardDate"); ds.Tables["Head"].Columns.Add("EDC"); ds.Tables["Head"].Columns.Add("SaleOrderRefNo"); ds.Tables["Head"].Columns.Add("CustomerName"); ds.Tables["Head"].Columns.Add("CustomerPhone"); ds.Tables["Head"].Columns.Add("CustomerContactPerson"); ds.Tables["Head"].Columns.Add("Unit"); ds.Tables["Head"].Columns.Add("Customer"); ds.Tables["Head"].Columns.Add("Technician"); ds.Tables["Head"].Columns.Add("ChasisNo"); ds.Tables["Head"].Columns.Add("TaskDate"); ds.Tables["Head"].Columns.Add("VModel"); ds.Tables["Head"].Columns.Add("DoorNo"); ds.Tables["Head"].Columns.Add("Street"); ds.Tables["Head"].Columns.Add("State"); ds.Tables["Head"].Columns.Add("Country"); ds.Tables["Head"].Columns.Add("Currency"); ds.Tables["Head"].Columns.Add("Phone"); ds.Tables["Head"].Columns.Add("Fax"); ds.Tables["Head"].Columns.Add("Email"); ds.Tables["Head"].Columns.Add("Zip"); ds.Tables["Head"].Columns.Add("OrganizationName"); ds.Tables["Head"].Columns.Add("Image1"); ds.Tables["Head"].Columns.Add("Box"); ds.Tables["Head"].Columns.Add("Complaints"); ds.Tables["Head"].Columns.Add("BoxMake"); ds.Tables["Head"].Columns.Add("BoxNo"); ds.Tables["Head"].Columns.Add("FreezerMake"); ds.Tables["Head"].Columns.Add("FreezerModel"); ds.Tables["Head"].Columns.Add("VehicleMake"); ds.Tables["Head"].Columns.Add("Accessories"); ds.Tables["Head"].Columns.Add("CreatedUser"); ds.Tables["Head"].Columns.Add("CreateSignature"); ds.Tables["Head"].Columns.Add("CreatedDes"); ds.Tables["Head"].Columns.Add("isProjectBased"); ds.Tables["Head"].Columns.Add("isService"); ds.Tables["Head"].Columns.Add("UnitDetails"); //-------DT ds.Tables["Items"].Columns.Add("TaskDate"); ds.Tables["Items"].Columns.Add("Employee"); ds.Tables["Items"].Columns.Add("Description"); //ds.Tables["Items"].Columns.Add("StartTime"); //ds.Tables["Items"].Columns.Add("EndTime"); ds.Tables["Items"].Columns.Add("Hours"); JobCardRepository repo = new JobCardRepository(); var Head = repo.GetJobCardHD(Id, OrganizationId); DataRow dr = ds.Tables["Head"].NewRow(); dr["JobCardNo"] = Head.JobCardNo; dr["InternalJobCardNo"] = Head.InternalJobCardNo; dr["JobCardDate"] = Head.JobCardDate.ToString("dd-MMM-yyyy"); dr["EDC"] = Head.RequiredDate.ToString("dd-MMM-yyyy"); dr["SaleOrderRefNo"] = Head.RegistrationNo; dr["CustomerName"] = Head.CustomerName; dr["CustomerPhone"] = Head.CPhone; dr["CustomerContactPerson"] = Head.ContactPerson; dr["Customer"] = Head.Customer; dr["Unit"] = Head.FreezerUnitName; dr["ChasisNo"] = Head.RegistrationNo; //dr["TaskDate"] = Head.TaskDate; dr["VModel"] = Head.VehicleModelName; dr["Technician"] = Head.Technician; dr["DoorNo"] = Head.DoorNo; dr["Street"] = Head.Street; dr["State"] = Head.State; dr["Country"] = Head.CountryName; dr["Currency"] = Head.CurrencyName; dr["Phone"] = Head.Phone; dr["Fax"] = Head.Fax; dr["Email"] = Head.Email; // dr["ContactPerson"] = Head.ContactPerson; dr["Zip"] = Head.Zip; dr["OrganizationName"] = Head.OrganizationName; dr["Image1"] = Server.MapPath("~/App_images/") + Head.Image1; dr["Box"] = Head.BoxName; dr["Complaints"] = Head.Complaints; dr["BoxMake"] = Head.BoxMake; dr["BoxNo"] = Head.BoxNo; dr["FreezerMake"] = Head.FreezerMake; dr["FreezerModel"] = Head.FreezerModel; dr["VehicleMake"] = Head.VehicleMake; dr["Accessories"] = Head.Accessories; dr["CreatedUser"] = Head.CreatedUser; dr["CreateSignature"] = Server.MapPath("~/App_Images/") + Head.CreatedUsersig; dr["CreatedDes"] = Head.CreatedDes; dr["isProjectBased"] = Head.isProjectBased; dr["isService"] = Head.isService; dr["UnitDetails"] = Head.UnitDetails; ds.Tables["Head"].Rows.Add(dr); JobCardTaskRepository repo1 = new JobCardTaskRepository(); var Items = repo1.GetJobCardDT(Id); foreach (var item in Items) { var JCItem = new JobCardTask { TaskDate = item.TaskDate, Employee = item.Employee, JobCardTaskName = item.JobCardTaskName, //StartTime = item.StartTime, //EndTime = item.EndTime, Hours = item.Hours }; DataRow dri = ds.Tables["Items"].NewRow(); dri["TaskDate"] = JCItem.TaskDate.ToString("dd-MMM-yyyy"); dri["Employee"] = JCItem.Employee; dri["Description"] = JCItem.JobCardTaskName; //dri["StartTime"] = JCItem.StartTime; //dri["EndTime"] = JCItem.EndTime; dri["Hours"] = JCItem.Hours; ds.Tables["Items"].Rows.Add(dri); } if (Items.Count >= 0) { int n = 23 - Items.Count; for (int i = 0; i <= n; i++) { DataRow dri = ds.Tables["Items"].NewRow(); dri["TaskDate"] = ""; dri["Employee"] = ""; dri["Description"] = ""; //dri["StartTime"] = JCItem.StartTime; //dri["EndTime"] = JCItem.EndTime; dri["Hours"] = ""; ds.Tables["Items"].Rows.Add(dri); } } if (Head.isProjectBased == 0) { rd.Load(Path.Combine(Server.MapPath("~/Reports"), "JobCard.rpt")); } else { rd.Load(Path.Combine(Server.MapPath("~/Reports"), "JobCard_Project.rpt")); } ds.WriteXml(Path.Combine(Server.MapPath("~/XML"), "JobCard.xml"), XmlWriteMode.WriteSchema); rd.SetDataSource(ds); Response.Buffer = false; Response.ClearContent(); Response.ClearHeaders(); try { Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/pdf"));//, String.Format("JobCard{0}.pdf", Id.ToString())); } catch (Exception ex) { throw ex; } }
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)); }
public ActionResult Create(JobCard model) { try { model.OrganizationId = OrganizationId; model.CreatedBy = UserID.ToString(); if (model.isProjectBased == 1) { bool isexists = repo.IsFieldExists(repo.ConnectionString(), "JobCard", "InternalJobCardNo", model.InternalJobCardNo, null, null); if (!isexists) { var data = new JobCardRepository().SaveJobCard(model); if (data.Length > 0) { TempData["success"] = "Saved Successfully. Reference No. is " + data; return(RedirectToAction("PendingJobCard", new { isProjectBased = model.isProjectBased, service = model.isService })); } } else { TempData["error"] = "This Internal JobCard No already exists!"; FillBay(model.isService); FillTasks(model.isProjectBased); FillEmployee(); return(View(model)); } TempData["error"] = "Some error occured while saving. Please try again."; FillBay(model.isService); //FillAllTasks(); FillTasks(model.isProjectBased); FillEmployee(); return(View(model)); } else { var data = new JobCardRepository().SaveJobCard(model); if (data.Length > 0) { TempData["success"] = "Saved Successfully. Reference No. is " + data; return(RedirectToAction("PendingJobCard", new { isProjectBased = model.isProjectBased, service = model.isService })); } TempData["error"] = "Some error occured while saving. Please try again."; FillBay(model.isService); //FillAllTasks(); FillTasks(model.isProjectBased); FillEmployee(); return(View(model)); } } catch (Exception ex) { string ErrorMessage = ex.Message.ToString(); if (ex.InnerException != null) { if (ex.InnerException.Message != null) { ErrorMessage = ErrorMessage + ex.InnerException.Message.ToString(); } } ViewData["Error"] = ErrorMessage; return(View("ShowError")); } }
public JobCardController() { repo = new JobCardRepository(); }
private void FillFreezerAndBoxTasks(int?SaleOrderItemId) { var result = new JobCardRepository().GetTasksForFreezerAndBox(SaleOrderItemId); ViewBag.TaskList = new SelectList(result, "JobCardTaskMasterId", "JobCardTaskName"); }