예제 #1
0
        public virtual ActionResult GetList()
        {
            var           brands = _mCustomerRepository.GetAll();
            StringBuilder sb     = new StringBuilder();
            MCustomer     cust   = new MCustomer();

            sb.AppendFormat("{0}:{1}", string.Empty, "-Pilih Konsumen-");
            for (int i = 0; i < brands.Count; i++)
            {
                cust = brands[i];
                sb.AppendFormat(";{0}:{1}", cust.Id, cust.PersonId.PersonName);
            }
            return(Content(sb.ToString()));
        }
예제 #2
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);
        }
예제 #3
0
        public static UnitSalesFormViewModel CreateUnitSalesFormViewModel(IMCustomerRepository mCustomerRepository, IMCostCenterRepository mCostCenterRepository, ITTransUnitRepository tTransUnitRepository, string unitId)
        {
            UnitSalesFormViewModel viewModel = new UnitSalesFormViewModel();

            TTransUnit t = null;

            if (!string.IsNullOrEmpty(unitId))
            {
                t = tTransUnitRepository.GetByUnitId(unitId);
            }
            if (t == null)
            {
                t = new TTransUnit();
                t.SetAssignedIdTo(Guid.NewGuid().ToString());
                t.TransUnitDate = DateTime.Today;
            }
            viewModel.TransUnit = t;
            IList <MCustomer> listCust = mCustomerRepository.GetAll();
            var vals = from customer in listCust
                       select new { ID = customer.Id, Name = customer.PersonId.PersonName };

            //MCustomer cust = new MCustomer();
            //cust.CustomerDesc = "-Pilih Pembeli-";
            //vals.Union( .Insert(0, cust));
            viewModel.CustomerList = new SelectList(vals, "ID", "Name", t.CustomerId != null ? t.CustomerId.Id : null);

            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", t.CostCenterId != null ? t.CostCenterId.Id : null);

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

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

            return(viewModel);
        }