public static TransactionFormViewModel Create(EnumTransactionStatus enumTransactionStatus, ITTransRepository transRepository, IMWarehouseRepository mWarehouseRepository, IMSupplierRepository mSupplierRepository, IMUnitTypeRepository mUnitTypeRepository, IMJobTypeRepository mJobTypeRepository)
        {
            TransactionFormViewModel viewModel = new TransactionFormViewModel();
            TTrans trans = SetNewTrans(enumTransactionStatus);

            viewModel.Trans = trans;
            Helper.CommonHelper.SetViewModelByStatus(viewModel, enumTransactionStatus);

            viewModel.TransFactur   = trans.TransFactur;
            viewModel.TransDate     = trans.TransDate;
            viewModel.TransId       = trans.Id;
            viewModel.TransStatus   = trans.TransStatus;
            viewModel.WarehouseId   = trans.WarehouseId;
            viewModel.WarehouseIdTo = trans.WarehouseIdTo;
            viewModel.UnitTypeId    = trans.UnitTypeId;
            viewModel.JobTypeId     = trans.JobTypeId;
            viewModel.TransDesc     = trans.TransDesc;

            IList <MWarehouse> list       = mWarehouseRepository.GetAll();
            MWarehouse         mWarehouse = new MWarehouse();

            mWarehouse.WarehouseName = "-Pilih Gudang-";
            list.Insert(0, mWarehouse);
            viewModel.WarehouseList   = new SelectList(list, "Id", "WarehouseName");
            viewModel.WarehouseToList = new SelectList(list, "Id", "WarehouseName");

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

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

            IList <MUnitType> listUnitType = mUnitTypeRepository.GetAll();
            MUnitType         mUnitType    = new MUnitType();

            mUnitType.UnitTypeName = "-Pilih Unit-";
            listUnitType.Insert(0, mUnitType);
            viewModel.UnitTypeList = new SelectList(listUnitType, "Id", "UnitTypeName");

            IList <MJobType> listJobType = mJobTypeRepository.GetAll();
            MJobType         mJobType    = new MJobType();

            mJobType.JobTypeName = "-Pilih Jenis Pekerjaan-";
            listJobType.Insert(0, mJobType);
            viewModel.JobTypeList = new SelectList(listJobType, "Id", "JobTypeName");

            //fill payment method
            var values = from EnumPaymentMethod e in Enum.GetValues(typeof(EnumPaymentMethod))
                         select new { ID = e, Name = e.ToString() };

            viewModel.PaymentMethodList = new SelectList(values, "Id", "Name");

            //viewModel.ViewWarehouseTo = false;
            //viewModel.ViewSupplier = false;
            //viewModel.ViewDate = false;
            //viewModel.ViewFactur = false;

            return(viewModel);
        }
Exemplo n.º 2
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.º 3
0
        public static PaymentViewModel Create(EnumPaymentType paymentType, ITPaymentRepository tPaymentRepository, ITPaymentDetRepository tPaymentDetRepository, IMSupplierRepository mSupplierRepository, IMCustomerRepository mCustomerRepository, IMCostCenterRepository mCostCenterRepository)
        {
            PaymentViewModel viewModel = new PaymentViewModel();

            TPayment p = new TPayment();

            p.SetAssignedIdTo(Guid.NewGuid().ToString());
            p.PaymentDate = DateTime.Today;
            p.PaymentDesc = string.Empty;
            p.PaymentType = paymentType.ToString();

            viewModel.Payment = p;

            viewModel.Title = string.Format("Pembayaran {0}", paymentType.ToString());

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

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

            //get label text
            switch (paymentType)
            {
            case EnumPaymentType.Piutang:
                viewModel.CashAccountLabel = "Deposit ke : ";

                //fill cust
                var values = from MCustomer cust in mCustomerRepository.GetAll()
                             select new { Id = cust.Id, Name = cust.PersonId != null ? cust.PersonId.PersonName : "-Pilih Konsumen-" };
                viewModel.TransByList = new SelectList(values, "Id", "Name");
                break;

            case EnumPaymentType.Hutang:
                viewModel.CashAccountLabel = "Deposit dari : ";

                IList <MSupplier> listAcc  = mSupplierRepository.GetAll();
                MSupplier         supplier = new MSupplier();
                supplier.SupplierName = "-Pilih Supplier-";
                listAcc.Insert(0, supplier);
                viewModel.TransByList = new SelectList(listAcc, "Id", "SupplierName");
                break;
            }
            return(viewModel);
        }