Пример #1
0
        public RequisitionViewModelBuilder GetViewModelIndex()
        {
            var reViewModelBuilder = new RequisitionViewModelBuilder
            {
                Stores = new SelectList(this.contextSub.V3_GetStoreDDL(), "Id", "sName")
            };

            return(reViewModelBuilder);
        }
Пример #2
0
        public RequisitionViewModelBuilder GetRequisitionDetailModelBuilder(string condition)
        {
            var requisitionDetail = this.contextSub.V3_RequisitionDetail(condition, 1).ToList();

            var totalRecords = requisitionDetail.Count();
            var requisitionViewModelBuilder = new RequisitionViewModelBuilder
            {
                RequisitionDetailResults = requisitionDetail,
                TotalRecords             = totalRecords
            };

            return(requisitionViewModelBuilder);
        }
Пример #3
0
        public RequisitionViewModelBuilder GetRequisitionViewModelBuilder(int page, int size, int store, string mrf, string stock, string status, string fd, string td)
        {
            var output = new ObjectParameter("ItemCount", typeof(int));
            var data   = this.contextSub.V3_Requisition_GetList(page, size, store, mrf, stock, status, fd, td, 1, output).ToList();

            var totalRecord = output.Value;
            var totalTemp   = Convert.ToDecimal(totalRecord) / Convert.ToDecimal(size);
            var totalPages  = Convert.ToInt32(Math.Ceiling(totalTemp));

            var viewModel = new RequisitionViewModelBuilder
            {
                RequisitionGetListResults = data,
                TotalRecords = Convert.ToInt32(totalRecord),
                TotalPages   = totalPages,
                CurrentPage  = page,
                PageSize     = size
            };

            return(viewModel);
        }
Пример #4
0
        //checked later
        public RequisitionViewModelBuilder GetViewModelItemBuilder(string condition)
        {
            if (!string.IsNullOrEmpty(condition))
            {
                //var item = this.contextSub.REQUISITION_MASTER_V.FirstOrDefault(s => s.iEnable == true && s.vMRF == condition);
                //var itemDetailList = this.contextSub.V3_RequisitionDetail(condition, 1).ToList();
                //var totalRecords = itemDetailList.Count();
                var viewModelBuilder = new RequisitionViewModelBuilder
                {
                    //RequisitionMasterV = item,
                    //RequisitionDetailsV = new REQUISITION_DETAILS_V(),
                    //RequisitionDetailsVs = itemDetailList,
                    //TotalRecords = totalRecords,
                    Stores   = new SelectList(this.contextSub.V3_GetStoreDDL(), "Id", "sName"),
                    Projects = new SelectList(this.contextSub.V3_GetProjectDDL(), "Id", "vProjectID"),
                    Mrf      = condition
                };
                return(viewModelBuilder);
            }

            var re = this.contextSub.WAMS_REQUISITION_MASTER.OrderByDescending(u => u.vMRF).FirstOrDefault();

            if (re != null)
            {
                var viewModelBuilder = new RequisitionViewModelBuilder
                {
                    //RequisitionMasterV = new REQUISITION_MASTER_V(),
                    //RequisitionDetailsV = new REQUISITION_DETAILS_V(),
                    Stores   = new SelectList(this.contextSub.V3_GetStoreDDL(), "Id", "sName"),
                    Projects = new SelectList(this.contextSub.V3_GetProjectDDL(), "Id", "vProjectID"),
                    Mrf      = (Convert.ToInt32(re.vMRF) + 1).ToString(CultureInfo.InvariantCulture)
                };
                return(viewModelBuilder);
            }

            return(null);
        }