public ActionResult Details(int RequisitionMasId) { ViewBag.RequisitionMasId = RequisitionMasId; var newProj = (from procRequisitionMas in db.Proc_RequisitionMas join procProject in db.ProcProject on procRequisitionMas.ProcProjectId equals procProject.Id join site in db.ProjectSite on procProject.ProjectSiteId equals site.Id join project in db.Project on site.ProjectId equals project.Id where procRequisitionMas.Id == RequisitionMasId select project).SingleOrDefault(); //foreach (var i in newProj) //{ // ViewBag.ProjectId = i.Id; // ViewBag.ProjectName = i.Name; //} ViewBag.ProjectId = newProj.Id; ViewBag.ProjectName = newProj.Name; var projectResources = db.ProjectResource.SingleOrDefault(x => x.ProjectId == newProj.Id); ViewBag.ProjectManager = NullHelper.ObjectToString(projectResources.CompanyResource.Name); var newSite = (from procRequisitionMas in db.Proc_RequisitionMas join procProject in db.ProcProject on procRequisitionMas.ProcProjectId equals procProject.Id join site in db.ProjectSite on procProject.ProjectSiteId equals site.Id where procRequisitionMas.Id == RequisitionMasId select site).SingleOrDefault(); //foreach (var i in newSite) //{ // ViewBag.SiteId = i.Id; // ViewBag.SiteName = i.Name; //} ViewBag.SiteId = newSite.Id; ViewBag.SiteName = newSite.Name; var projectSiteResources = db.ProjectSiteResource.SingleOrDefault(x => x.ProjectSiteId == newSite.Id); ViewBag.SiteEngineer = NullHelper.ObjectToString(projectSiteResources.CompanyResource.Name); var master = db.Proc_RequisitionMas.SingleOrDefault(x => x.Id == RequisitionMasId); ViewBag.ItemName = new SelectList(db.Item, "Id", "Name"); ViewBag.Unit = new SelectList(db.Unit, "Id", "Name"); var Req = db.Proc_RequisitionMas.SingleOrDefault(x => x.Id == RequisitionMasId); VMRequisitionMasterDetail vm = new VMRequisitionMasterDetail(); vm.requisitionMaster = db.Proc_RequisitionMas.SingleOrDefault(x => x.Id == RequisitionMasId); var Details = db.Proc_RequisitionDet.Where(x => x.Proc_RequisitionMasId == RequisitionMasId).ToList(); List <Proc_RequisitionDet> dt = new List <Proc_RequisitionDet>(); foreach (var detail in Details) { dt.Add(detail); } vm.requisitionDetail = dt; return(View(vm)); }
public JsonResult GetSiteEngineer(int SiteId, int ProjectId) { List <SelectListItem> ItemList = new List <SelectListItem>(); var items = (from procProjectItem in db.ProcProjectItem join procproject in db.ProcProject on procProjectItem.ProcProjectId equals procproject.Id join site in db.ProjectSite on procproject.ProjectSiteId equals site.Id join project in db.Project on site.ProjectId equals project.Id where project.Id == ProjectId && site.Id == SiteId select procProjectItem).Distinct().ToList(); foreach (var x in items.Distinct()) { var itemName = db.Item.SingleOrDefault(m => m.Id == x.ItemId); ItemList.Add(new SelectListItem { Text = itemName.Name, Value = x.ItemId.ToString() }); } var projectSiteResources = db.ProjectSiteResource.SingleOrDefault(x => x.ProjectSiteId == SiteId); var siteEngineer = NullHelper.ObjectToString(projectSiteResources.CompanyResource.Name); var result = new { siteEngineer = siteEngineer, Items = ItemList }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult GetVendorContactPerson(int VendorId) { var vendorContactPerson = db.Vendor.SingleOrDefault(x => x.Id == VendorId); var vContactPerson = NullHelper.ObjectToString(vendorContactPerson.ContactPerson); var items = (from tenderMas in db.Proc_TenderMas join tenderDet in db.Proc_TenderDet on tenderMas.Id equals tenderDet.Proc_TenderMasId join requisitionDet in db.Proc_RequisitionDet on tenderDet.Proc_RequisitionDetId equals requisitionDet.Id join requisitionMas in db.Proc_RequisitionMas on requisitionDet.Proc_RequisitionMasId equals requisitionMas.Id join procProject in db.ProcProject on requisitionMas.ProcProjectId equals procProject.Id join procProjectItem in db.ProcProjectItem on procProject.Id equals procProjectItem.ProcProjectId join item in db.Item on procProjectItem.ItemId equals item.Id where tenderDet.VendorId == VendorId && requisitionDet.ItemId == item.Id select item).Distinct().ToList(); List <SelectListItem> itemList = new List <SelectListItem>(); foreach (var x in items) { //var itemName = db.Proc_TenderMas.SingleOrDefault(m => m.Id == x.Id); itemList.Add(new SelectListItem { Text = x.Name, Value = x.Id.ToString() }); } var result = new { ItemList = itemList, vContactPerson = vContactPerson }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Details(int purchaseOrderId, int tenderMasId) { var procPurchaseMasterId = db.Proc_PurchaseOrderMas.FirstOrDefault(x => x.Id == purchaseOrderId && x.Proc_TenderMasId == tenderMasId); ViewBag.ProcPurchaseMasterId = procPurchaseMasterId.Id; var procPurchaseDetId = db.Proc_PurchaseOrderDet.FirstOrDefault(x => x.Proc_PurchaseOrderMasId == purchaseOrderId); ViewBag.ProcPurchaseDetId = procPurchaseDetId.Id; ViewBag.PurchaseMasId = purchaseOrderId; ViewBag.TenderMasId = tenderMasId; var purchaseItemDet = (from purchaseDet in db.Proc_PurchaseOrderDet join purchaseMas in db.Proc_PurchaseOrderMas on purchaseDet.Proc_PurchaseOrderMasId equals purchaseMas.Id join tenderMas in db.Proc_TenderMas on purchaseMas.Proc_TenderMasId equals tenderMas.Id join reqDet in db.Proc_RequisitionDet on purchaseDet.ItemId equals reqDet.ItemId join reqMas in db.Proc_RequisitionMas on reqDet.Proc_RequisitionMasId equals reqMas.Id join procItem in db.ProcProjectItem on reqMas.ProcProjectId equals procItem.ProcProjectId join procProj in db.ProcProject on procItem.ProcProjectId equals procProj.Id join projSite in db.ProjectSite on procProj.ProjectSiteId equals projSite.Id join proj in db.Project on projSite.ProjectId equals proj.Id where purchaseMas.Id == purchaseOrderId select reqMas).FirstOrDefault(); if (purchaseItemDet != null) { ViewBag.ProjectName = purchaseItemDet.ProcProject.ProjectSite.Project.Name; ViewBag.SiteName = purchaseItemDet.ProcProject.ProjectSite.Name; } //ViewBag.ProjectId = new SelectList(db.Project, "Id", "Name"); ViewBag.SiteId = new SelectList(db.ProjectSite, "Id", "Name"); var vendorAndTenderId = (from purchaseOrderMas in db.Proc_PurchaseOrderMas join vendors in db.Vendor on purchaseOrderMas.VendorId equals vendors.Id where purchaseOrderMas.Id == purchaseOrderId select purchaseOrderMas).FirstOrDefault(); ViewBag.VendorId = new SelectList(db.Vendor, "Id", "Name", vendorAndTenderId.VendorId); ViewBag.TenderId = new SelectList(db.Proc_TenderMas.Where(x => x.Id == tenderMasId), "Id", "TNo", vendorAndTenderId.Proc_TenderMasId); ViewBag.PurchaseAddress = purchaseItemDet.ProcProject.ProjectSite.Location; ViewBag.ItemName = new SelectList(db.Item, "Id", "Name"); ViewBag.UnitName = new SelectList(db.Unit, "Id", "Name"); var puchaseOrders = db.Proc_PurchaseOrderMas.FirstOrDefault(x => x.Id == purchaseOrderId); if (puchaseOrders != null) { ViewBag.PONo = NullHelper.ObjectToString(puchaseOrders.PONo); ViewBag.PODate = NullHelper.DateToString(puchaseOrders.PODate); ViewBag.VendorAttention = NullHelper.ObjectToString(puchaseOrders.Attention); ViewBag.AttnManager = NullHelper.ObjectToString(puchaseOrders.OrderTo); ViewBag.AttnCell = NullHelper.ObjectToString(puchaseOrders.AttnCell); ViewBag.Email = NullHelper.ObjectToString(puchaseOrders.AttnEmail); ViewBag.Subject = NullHelper.ObjectToString(puchaseOrders.Subject); ViewBag.LeadTime = NullHelper.ObjectToString(puchaseOrders.LeadTime); ViewBag.Content = NullHelper.ObjectToString(puchaseOrders.Content); ViewBag.RcvConcernPerson = NullHelper.ObjectToString(puchaseOrders.RecvConcernPerson); ViewBag.RcvConcernPersonCell = NullHelper.ObjectToString(puchaseOrders.RecvConcernPersonCell); } return(View()); }
public JsonResult GetSiteEngineer(int SiteId) { var projectSiteResources = db.ProjectSiteResource.SingleOrDefault(x => x.ProjectSiteId == SiteId); var siteEngineer = NullHelper.ObjectToString(projectSiteResources.CompanyResource.Name); var result = new { siteEngineer = siteEngineer }; return(Json(result, JsonRequestBehavior.AllowGet)); }
// GET: Projects/Details/5 public ActionResult Details(int?id) { var pId = db.Project.FirstOrDefault(x => x.Id == id); ViewBag.Proj = pId.Id; ViewBag.PId = id; var projectData = db.Project.Where(x => x.Id == id).FirstOrDefault(); ViewBag.ProjectName = projectData.Name; var prMan = (from projRes in db.ProjectResource join comRes in db.CompanyResource on projRes.CompanyResourceId equals comRes.Id where projRes.ProjectId == id select comRes).FirstOrDefault(); ViewBag.ProjectManager = new SelectList(db.CompanyResource, "Id", "Name", prMan.Id); var startDate = NullHelper.DateToString(projectData.StartDate); ViewBag.StartDate = startDate; var endDate = NullHelper.DateToString(projectData.EndDate); ViewBag.EndDate = endDate; var remarks = projectData.Remarks; ViewBag.ProjectRemarks = NullHelper.ObjectToString(remarks); var status = new SelectList(new List <SelectListItem> { new SelectListItem { Text = "Active", Value = "A" }, new SelectListItem { Text = "Inactive", Value = "I" }, }, "Value", "Text"); ViewBag.Statuses = status; ViewBag.RName = new SelectList(db.CompanyResource, "Id", "Name"); return(View()); }
public JsonResult GetSiteLocation(int SiteId) { var tenders = (from tenderMas in db.Proc_TenderMas join tenderDet in db.Proc_TenderDet on tenderMas.Id equals tenderDet.Proc_TenderMasId join requisitionDet in db.Proc_RequisitionDet on tenderDet.Proc_RequisitionDetId equals requisitionDet.Id join requisitionMas in db.Proc_RequisitionMas on requisitionDet.Proc_RequisitionMasId equals requisitionMas.Id join procProject in db.ProcProject on requisitionMas.ProcProjectId equals procProject.Id join site in db.ProjectSite on procProject.ProjectSiteId equals site.Id where site.Id == SiteId && tenderMas.isApproved == "A" select tenderMas).Distinct().ToList(); List <SelectListItem> tenderList = new List <SelectListItem>(); foreach (var x in tenders) { tenderList.Add(new SelectListItem { Text = x.TNo, Value = x.Id.ToString() }); } var projectSiteLocations = db.ProjectSite.SingleOrDefault(x => x.Id == SiteId); var siteAddress = NullHelper.ObjectToString(projectSiteLocations.Location); var projectSiteResources = db.ProjectSiteResource.SingleOrDefault(x => x.ProjectSiteId == SiteId); var siteEngineer = NullHelper.ObjectToString(projectSiteResources.CompanyResource.Name); var result = new { TenderList = tenderList, sitesLoc = siteAddress, siteEngineer = siteEngineer }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(int RequisitionMasId) { ViewBag.RequisitionMasId = RequisitionMasId; var newProj = (from procRequisitionMas in db.Proc_RequisitionMas join procProject in db.ProcProject on procRequisitionMas.ProcProjectId equals procProject.Id join site in db.ProjectSite on procProject.ProjectSiteId equals site.Id join project in db.Project on site.ProjectId equals project.Id where procRequisitionMas.Id == RequisitionMasId select project).FirstOrDefault(); ViewBag.ProjectId = newProj.Id; ViewBag.ProjectName = newProj.Name; var projectResources = db.ProjectResource.SingleOrDefault(x => x.ProjectId == newProj.Id); ViewBag.ProjectManager = NullHelper.ObjectToString(projectResources.CompanyResource.Name); var newSite = (from procRequisitionMas in db.Proc_RequisitionMas join procProject in db.ProcProject on procRequisitionMas.ProcProjectId equals procProject.Id join site in db.ProjectSite on procProject.ProjectSiteId equals site.Id where procRequisitionMas.Id == RequisitionMasId select site).FirstOrDefault(); ViewBag.SiteId = newSite.Id; ViewBag.SiteName = newSite.Name; var projectSiteResources = db.ProjectSiteResource.SingleOrDefault(x => x.ProjectSiteId == newSite.Id); ViewBag.SiteEngineer = NullHelper.ObjectToString(projectSiteResources.CompanyResource.Name); var master = db.Proc_RequisitionMas.SingleOrDefault(x => x.Id == RequisitionMasId); List <SelectListItem> ItemList = new List <SelectListItem>(); var items = (from procProjectItem in db.ProcProjectItem join procproject in db.ProcProject on procProjectItem.ProcProjectId equals procproject.Id join site in db.ProjectSite on procproject.ProjectSiteId equals site.Id join project in db.Project on site.ProjectId equals project.Id where project.Id == newProj.Id && site.Id == newSite.Id select procProjectItem).ToList(); foreach (var x in items) { var itemName = db.Item.SingleOrDefault(m => m.Id == x.ItemId); ItemList.Add(new SelectListItem { Text = itemName.Name, Value = x.ItemId.ToString() }); } ViewBag.ItemName = ItemList; //ViewBag.ItemName = new SelectList(db.Item, "Id", "Name"); ViewBag.Unit = new SelectList(db.Unit, "Id", "Name"); var Req = db.Proc_RequisitionMas.SingleOrDefault(x => x.Id == RequisitionMasId); VMRequisitionMasterDetail vm = new VMRequisitionMasterDetail(); vm.requisitionMaster = db.Proc_RequisitionMas.SingleOrDefault(x => x.Id == RequisitionMasId); var Details = db.Proc_RequisitionDet.Where(x => x.Proc_RequisitionMasId == RequisitionMasId).ToList(); List <Proc_RequisitionDet> dt = new List <Proc_RequisitionDet>(); foreach (var detail in Details) { dt.Add(detail); } vm.requisitionDetail = dt; return(View(vm)); }
public ActionResult Edit(int?projectId, int?siteId) { ViewBag.PId = projectId; ViewBag.SId = siteId; var procProjectId = db.ProcProject.FirstOrDefault(x => x.Id == projectId && x.ProjectSiteId == siteId); ViewBag.ProcProjectId = procProjectId.Id; ViewBag.ProcProjectIdEditForm = procProjectId.ProjectSite.Project.Name; ViewBag.ProjectId = new SelectList(db.Project, "Id", "Name"); ViewBag.SiteId = new SelectList(db.ProjectSite, "Id", "Name"); ViewBag.ItemName = new SelectList(db.Item, "Id", "Name"); ViewBag.Unit = new SelectList(db.Unit, "Id", "Name"); var projectTypeStatus = new SelectList(new List <SelectListItem> { new SelectListItem { Text = "Government", Value = "Government" }, new SelectListItem { Text = "Non-Government", Value = "Non-Government" }, }, "Value", "Text"); ViewBag.ProjectType = projectTypeStatus; ViewBag.PrManId = new SelectList(db.CompanyResource, "Id", "Name"); ViewBag.StEngId = new SelectList(db.CompanyResource, "Id", "Name"); var projectIdFinder = db.ProjectSite.SingleOrDefault(x => x.Id == siteId); var projects = db.Project.SingleOrDefault(x => x.Id == projectIdFinder.ProjectId); ViewBag.StartDate = NullHelper.DateToString(projects.StartDate); ViewBag.EndDate = NullHelper.DateToString(projects.EndDate); var procProjects = db.ProcProject.SingleOrDefault(x => x.Id == projectId && x.ProjectSiteId == siteId); ViewBag.BOQDate = NullHelper.DateToString(procProjects.BOQDate); ViewBag.NOADate = NullHelper.DateToString(procProjects.NOADate); ViewBag.BOQNo = NullHelper.ObjectToString(procProjects.BOQNo); ViewBag.NOANo = NullHelper.ObjectToString(procProjects.NOANo); //ViewBag.PType = NullHelper.ObjectToString(procProjects.ProjectType); var projectType = new SelectList(new List <SelectListItem> { new SelectListItem { Text = "Government", Value = "Government" }, new SelectListItem { Text = "Non-Government", Value = "Non-Government" }, }, "Value", "Text", procProjects.ProjectType); ViewBag.ProjectType = projectType; ViewBag.PStatus = NullHelper.ObjectToString(procProjects.Status); ViewBag.PRemarks = NullHelper.ObjectToString(procProjects.Remarks); var projectRes = db.ProjectResource.SingleOrDefault(x => x.ProjectId == projectIdFinder.ProjectId); ViewBag.PrMan = NullHelper.ObjectToString(projectRes.CompanyResource.Name); var projectSiteRes = db.ProjectSiteResource.SingleOrDefault(x => x.ProjectSiteId == siteId); ViewBag.StEng = NullHelper.ObjectToString(projectSiteRes.CompanyResource.Name); VMProjectItem vmProjectItem = new VMProjectItem(); vmProjectItem.ProcProjectItem = db.ProcProjectItem.Where(x => x.ProcProjectId == projectId /*&& x.ProjectSiteId == siteId*/).ToList(); if (projectId == null || siteId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProcProject procProject = db.ProcProject.Where(x => x.Id == projectId && x.ProjectSiteId == siteId).FirstOrDefault(); Project project = db.Project.Where(x => x.Id == projectId).FirstOrDefault(); ProcProjectItem procProjectItem = db.ProcProjectItem.Where(x => x.ProcProjectId == projectId /*&& x.ProjectSiteId == siteId*/).FirstOrDefault(); if (procProject == null) { return(HttpNotFound()); } return(View(vmProjectItem)); }
public ActionResult Edit(int purchaseOrderId, int tenderMasId) { //var procPurchaseMasterId = db.Proc_PurchaseOrderMas.FirstOrDefault(x => x.Id == purchaseOrderId && x.Proc_TenderMasId == tenderMasId); var procPurchaseMasterId = db.Proc_PurchaseOrderMas.FirstOrDefault(x => x.Id == purchaseOrderId); ViewBag.ProcPurchaseMasterId = procPurchaseMasterId.Id; // var procPurchaseDetId = db.Proc_PurchaseOrderDet.FirstOrDefault(x => x.Proc_PurchaseOrderMasId == purchaseOrderId); // ViewBag.ProcPurchaseDetId = procPurchaseDetId.Id; ViewBag.PurchaseMasId = purchaseOrderId; ViewBag.TenderMasId = tenderMasId; var purchaseItemDet = (from purchaseDet in db.Proc_PurchaseOrderDet join purchaseMas in db.Proc_PurchaseOrderMas on purchaseDet.Proc_PurchaseOrderMasId equals purchaseMas.Id join tenderMas in db.Proc_TenderMas on purchaseMas.Proc_TenderMasId equals tenderMas.Id join reqDet in db.Proc_RequisitionDet on purchaseDet.ItemId equals reqDet.ItemId join reqMas in db.Proc_RequisitionMas on reqDet.Proc_RequisitionMasId equals reqMas.Id join procItem in db.ProcProjectItem on reqMas.ProcProjectId equals procItem.ProcProjectId join procProj in db.ProcProject on procItem.ProcProjectId equals procProj.Id join projSite in db.ProjectSite on procProj.ProjectSiteId equals projSite.Id join proj in db.Project on projSite.ProjectId equals proj.Id where purchaseMas.Id == purchaseOrderId select reqMas).FirstOrDefault(); var vendorAndTenderId = (from purchaseOrderMas in db.Proc_PurchaseOrderMas join vendors in db.Vendor on purchaseOrderMas.VendorId equals vendors.Id where purchaseOrderMas.Id == purchaseOrderId select purchaseOrderMas).FirstOrDefault(); // if (purchaseItemDet != null) // { ViewBag.ProjectName = purchaseItemDet.ProcProject.ProjectSite.Project.Name; ViewBag.SiteName = purchaseItemDet.ProcProject.ProjectSite.Name; ViewBag.PONoId = purchaseOrderId; ViewBag.ProjectId = purchaseItemDet.ProcProject.ProjectSite.ProjectId; ViewBag.SiteId = purchaseItemDet.ProcProject.ProjectSiteId; //ViewBag.VendorId = vendorAndTenderId.VendorId; // ViewBag.VendorId = new SelectList(db.Vendor, "Id", "Name", vendorAndTenderId.VendorId); // } //ViewBag.ProjectId = new SelectList(db.Project, "Id", "Name"); // ViewBag.SiteId = new SelectList(db.ProjectSite, "Id", "Name"); //var vendorAndTenderId = (from purchaseOrderMas in db.Proc_PurchaseOrderMas // join vendors in db.Vendor on purchaseOrderMas.VendorId equals vendors.Id // where purchaseOrderMas.Id == purchaseOrderId // select purchaseOrderMas).FirstOrDefault(); ViewBag.VendorId = new SelectList(db.Vendor, "Id", "Name", vendorAndTenderId.VendorId); ViewBag.TenderId = new SelectList(db.Proc_TenderMas.Where(x => x.Id == tenderMasId), "Id", "TNo", vendorAndTenderId.Proc_TenderMasId); ViewBag.PurchaseAddress = purchaseItemDet.ProcProject.ProjectSite.Location; var items = (from tenderMas in db.Proc_TenderMas join tenderDet in db.Proc_TenderDet on tenderMas.Id equals tenderDet.Proc_TenderMasId join requisitionDet in db.Proc_RequisitionDet on tenderDet.Proc_RequisitionDetId equals requisitionDet.Id join requisitionMas in db.Proc_RequisitionMas on requisitionDet.Proc_RequisitionMasId equals requisitionMas.Id join procProject in db.ProcProject on requisitionMas.ProcProjectId equals procProject.Id join procProjectItem in db.ProcProjectItem on procProject.Id equals procProjectItem.ProcProjectId join item in db.Item on procProjectItem.ItemId equals item.Id where tenderDet.VendorId == vendorAndTenderId.VendorId && requisitionDet.ItemId == item.Id select item).Distinct().ToList(); List <SelectListItem> itemList = new List <SelectListItem>(); foreach (var x in items) { //var itemName = db.Proc_TenderMas.SingleOrDefault(m => m.Id == x.Id); itemList.Add(new SelectListItem { Text = x.Name, Value = x.Id.ToString() }); } //ViewBag.ItemName = new SelectList(db.Item, "Id", "Name"); ViewBag.ItemName = itemList.Distinct(); ViewBag.UnitName = new SelectList(db.Unit, "Id", "Name"); var puchaseOrders = db.Proc_PurchaseOrderMas.FirstOrDefault(x => x.Id == purchaseOrderId); if (puchaseOrders != null) { ViewBag.PONo = NullHelper.ObjectToString(puchaseOrders.PONo); ViewBag.PODate = NullHelper.DateToString(puchaseOrders.PODate); ViewBag.VendorAttention = NullHelper.ObjectToString(puchaseOrders.Attention); ViewBag.AttnManager = NullHelper.ObjectToString(puchaseOrders.OrderTo); ViewBag.AttnCell = NullHelper.ObjectToString(puchaseOrders.AttnCell); ViewBag.Email = NullHelper.ObjectToString(puchaseOrders.AttnEmail); ViewBag.Subject = NullHelper.ObjectToString(puchaseOrders.Subject); ViewBag.LeadTime = NullHelper.ObjectToString(puchaseOrders.LeadTime); ViewBag.Content = NullHelper.ObjectToString(puchaseOrders.Content); ViewBag.RcvConcernPerson = NullHelper.ObjectToString(puchaseOrders.RecvConcernPerson); ViewBag.RcvConcernPersonCell = NullHelper.ObjectToString(puchaseOrders.RecvConcernPersonCell); } //new 7feb 18 return(View()); }