Exemplo n.º 1
0
        public static ReportParamViewModel CreateReportParamViewModel(IMCostCenterRepository mCostCenterRepository, IMWarehouseRepository mWarehouseRepository, IMSupplierRepository mSupplierRepository, ITRecPeriodRepository tRecPeriodRepository, IMItemRepository mItemRepository)
        {
            ReportParamViewModel viewModel = new ReportParamViewModel();

            IList <MCostCenter> list       = mCostCenterRepository.GetAll();
            MCostCenter         costCenter = new MCostCenter();

            costCenter.CostCenterName = "-Semua Cost Center-";
            list.Insert(0, costCenter);
            viewModel.CostCenterList = new SelectList(list, "Id", "CostCenterName");

            IList <MWarehouse> listWarehouse = mWarehouseRepository.GetAll();
            MWarehouse         account       = new MWarehouse();

            account.WarehouseName = "-Semua Gudang-";
            listWarehouse.Insert(0, account);
            viewModel.WarehouseList = new SelectList(listWarehouse, "Id", "WarehouseName");

            IList <MSupplier> listSupplier = mSupplierRepository.GetAll();
            MSupplier         supplier     = new MSupplier();

            supplier.SupplierName = "-Semua Supplier-";
            listSupplier.Insert(0, supplier);
            viewModel.SupplierList = new SelectList(listSupplier, "Id", "SupplierName");

            IList <TRecPeriod> listRecPeriod = tRecPeriodRepository.GetAll();

            //TRecPeriod recPeriod = new TRecPeriod();
            //recPeriod.PeriodDesc = "-Pilih Period-";
            //listRecPeriod.Insert(0, recPeriod);
            viewModel.RecPeriodList = new SelectList(listRecPeriod, "Id", "PeriodDesc");

            IList <MItem> listItem = mItemRepository.GetAll();
            MItem         item     = new MItem();

            item.ItemName = "-Semua Item-";
            listItem.Insert(0, item);
            viewModel.ItemList = new SelectList(listItem, "Id", "ItemName");

            ArrayList arr = new ArrayList();

            for (int i = 1; i <= 5; i++)
            {
                var sel = new { Id = i };
                arr.Add(sel);
            }
            viewModel.ShiftNoList = new SelectList(arr, "Id", "Id");

            viewModel.DateFrom = DateTime.Today;
            viewModel.DateTo   = DateTime.Today;
            return(viewModel);
        }
Exemplo n.º 2
0
        public virtual ActionResult GetList()
        {
            var           items = _mItemRepository.GetAll();
            StringBuilder sb    = new StringBuilder();
            MItem         mItem = new MItem();

            sb.AppendFormat("{0}:{1};", string.Empty, "-Pilih Produk-");
            for (int i = 0; i < items.Count; i++)
            {
                mItem = items[i];
                sb.AppendFormat("{0}:{1}", mItem.Id, mItem.ItemName);
                if (i < items.Count - 1)
                {
                    sb.Append(";");
                }
            }
            return(Content(sb.ToString()));
        }
Exemplo n.º 3
0
        private ReportDataSource GetItemViewModel()
        {
            IList <MItem> listItems = _mItemRepository.GetAll();

            var list = from det in listItems
                       select new
            {
                det.Id,
                det.ItemName,
                det.ItemDesc,
                ItemCatId = det.ItemCatId.Id,
                det.ItemCatId.ItemCatName,
                det.ItemUoms[0].ItemUomPurchasePrice
            }
            ;

            ReportDataSource reportDataSource = new ReportDataSource("ItemViewModel", list.ToList());

            return(reportDataSource);
        }