public ActionResult Create()
        {
            RequisitionModel requisition = SessionHelper.Requisition;

            if (requisition == null)
            {
                requisition = new RequisitionModel
                {
                    RequisitionDate = DateTime.Now,
                    RequisitionNo   = "New",
                    CompanyId       = AuthenticationHelper.CompanyId.Value,
                    SOBId           = SessionHelper.SOBId
                };
                SessionHelper.Requisition = requisition;
            }

            requisition.Buyers = buyerService.GetAll(AuthenticationHelper.CompanyId.Value, SessionHelper.SOBId, requisition.RequisitionDate, requisition.RequisitionDate).
                                 Select(x => new SelectListItem {
                Text  = x.Name,
                Value = x.Id.ToString()
            }).ToList();

            if (requisition.Buyers != null && requisition.Buyers.Count() > 0)
            {
                requisition.BuyerId = requisition.BuyerId > 0 ? requisition.BuyerId : Convert.ToInt64(requisition.Buyers.FirstOrDefault().Value);
            }

            return(View("Edit", requisition));
        }
        public ActionResult Create()
        {
            PurchaseOrderModel po = SessionHelper.PurchaseOrder;

            if (po == null)
            {
                po = new PurchaseOrderModel
                {
                    CompanyId = AuthenticationHelper.CompanyId.Value,
                    PODate    = DateTime.Now,
                    PONo      = "New",
                    SOBId     = SessionHelper.SOBId
                };
                SessionHelper.PurchaseOrder = po;
            }

            po.Buyers = buyerService.GetAll(AuthenticationHelper.CompanyId.Value, SessionHelper.SOBId, po.PODate, po.PODate).
                        Select(x => new SelectListItem {
                Text  = x.Name,
                Value = x.Id.ToString()
            }).ToList();

            po.Vendors = vendorService.GetAll(AuthenticationHelper.CompanyId.Value, SessionHelper.SOBId, po.PODate, po.PODate).
                         Select(x => new SelectListItem
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            }).ToList();

            if (po.Vendors != null && po.Vendors.Count() > 0)
            {
                po.VendorId    = po.VendorId > 0 ? po.VendorId : Convert.ToInt64(po.Vendors.FirstOrDefault().Value);
                po.VendorSites = vendorService.GetAllSites(po.VendorId, AuthenticationHelper.CompanyId.Value).
                                 Select(x => new SelectListItem
                {
                    Text  = x.Name,
                    Value = x.Id.ToString()
                }).ToList();

                if (po.VendorSites != null && po.VendorSites.Count() > 0)
                {
                    po.VendorSiteId = po.VendorSiteId > 0 ? po.VendorSiteId : Convert.ToInt64(po.VendorSites.FirstOrDefault().Value);
                }
            }

            if (po.Buyers != null && po.Buyers.Count() > 0)
            {
                po.BuyerId = po.BuyerId > 0 ? po.BuyerId : Convert.ToInt64(po.Buyers.FirstOrDefault().Value);
            }

            return(View("Edit", po));
        }
Example #3
0
        public ActionResult Edit(string id)
        {
            RFQModel model = new RFQModel(service.GetSingle(id, AuthenticationHelper.CompanyId.Value));

            model.RFQDetail   = service.GetAllRFQDetail(Convert.ToInt64(id)).Select(x => new RFQDetailModel(x)).ToList();
            SessionHelper.RFQ = model;

            model.Buyers = buyerService.GetAll(AuthenticationHelper.CompanyId.Value, SessionHelper.SOBId, model.RFQDate, model.RFQDate)
                           .Select(x => new SelectListItem
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            }).ToList();
            if (model.Buyers != null && model.Buyers.Count > 0)
            {
                model.BuyerId = model.BuyerId > 0 ? model.BuyerId : Convert.ToInt64(model.Buyers.FirstOrDefault().Value);
            }

            return(View("Edit", model));
        }
Example #4
0
        public ActionResult BuyerList()
        {
            List <Buyer> buyerList = new List <Buyer>();

            foreach (Buyer item in buyerService.GetAll())
            {
                item.AreaName = areaService.Get(item.AreaId).AreaName;
                buyerList.Add(item);
            }

            return(View(buyerList));
        }
Example #5
0
        public Threenine.Data.Paging.IPaginate <Buyer> Get(int PageNumber = 0, int PageSize = 30)
        {
            var watch = System.Diagnostics.Stopwatch.StartNew();

            PagingParams pagingParams = new PagingParams();

            pagingParams.PageNumber = PageNumber;
            pagingParams.PageSize   = PageSize;
            _reqinfo.UserId         = Request.Headers["UserId"].ToString();
            _reqinfo.BranchId       = Request.Headers["BranchId"].ToString();
            _reqinfo.DeviceId       = Request.Headers["DeviceId"].ToString();
            var List = _Service.GetAll(pagingParams);

            watch.Stop();
            var elapsedMs = watch.ElapsedMilliseconds;

            _logger.LogInformation("Fetching Follow up Modes");
            return(List);
        }
Example #6
0
        public IActionResult Get()
        {
            var data = _service.GetAll();

            return(Ok(data.Result));
        }
 public ActionResult BuyerListPartial()
 {
     return(PartialView("_List", service.GetAll(AuthenticationHelper.CompanyId.Value, SessionHelper.SOBId)
                        .Select(x => new BuyerModel(x)).ToList()));
 }