Ejemplo n.º 1
0
        private void ConvertToJmInventoryMSupplier(JmInventoryMSupplierViewModel vm, JmInventoryMSupplier entity)
        {
            entity.SupplierName       = vm.SupplierName;
            entity.SupplierAddress    = vm.SupplierAddress;
            entity.SupplierPhone      = vm.SupplierPhone;
            entity.SupplierStatus     = vm.SupplierStatus;
            entity.SupplierDesc       = vm.SupplierDesc;
            entity.SupplierNpwp       = vm.SupplierNpwp;
            entity.SupplierNpwpImgUrl = vm.SupplierNpwpImgUrl;

            entity.SupplierNpwpImg = UploadFiles(UploadFolder.Supplier, vm.SupplierNpwpImgUrl);
        }
        public ActionResult InputSN(string EditTransId)
        {
            TStockInputViewModel vm = new TStockInputViewModel();

            if (string.IsNullOrEmpty(EditTransId))
            {
                ///for first load, save first, to handle detail form input
                string           newId  = Guid.NewGuid().ToString();
                JmInventoryTTran entity = new JmInventoryTTran();
                entity.SetAssignedIdTo(newId);
                vm.TransId = newId;
                vm.Stocks  = new List <JmInventoryTStockViewModel>();
                _IJmInventoryTTranTasks.Insert(entity);
            }
            else
            {
                JmInventoryTTran trans = this._IJmInventoryTTranTasks.One(EditTransId);

                vm.SupplierId   = trans.SupplierId != null ? trans.SupplierId.Id : string.Empty;
                vm.SupplierName = trans.SupplierId != null ? trans.SupplierId.SupplierName : string.Empty;

                JmInventoryMSupplierViewModel supplierVm = new JmInventoryMSupplierViewModel();
                if (trans.SupplierId != null)
                {
                    supplierVm.SupplierId   = trans.SupplierId.Id;
                    supplierVm.SupplierName = trans.SupplierId.SupplierName;
                }
                //vm.SupplierIdForEdit = supplierVm;

                vm.TransNo   = trans.TransNo;
                vm.TransDate = trans.TransDate;
                //TransType = entity.TransType;
                vm.TransStatus       = trans.TransStatus;
                vm.TransApprovedBy   = trans.TransApprovedBy;
                vm.TransApprovedDate = trans.TransApprovedDate;
                vm.TransInputBy      = trans.TransInputBy;
                vm.TransInputDate    = trans.TransInputDate;
                vm.InvoiceNo         = trans.InvoiceNo;
                vm.TransDesc         = trans.TransDesc;
                vm.TransId           = trans.Id;
                vm.Stocks            = new List <JmInventoryTStockViewModel>();
            }
            return(View(vm));
        }
Ejemplo n.º 3
0
        public ActionResult JmInventoryMSuppliers_Create([DataSourceRequest] DataSourceRequest request, JmInventoryMSupplierViewModel vm)
        {
            if (vm != null && ModelState.IsValid)
            {
                JmInventoryMSupplier entity = new JmInventoryMSupplier();
                entity.SetAssignedIdTo(Guid.NewGuid().ToString());

                ConvertToJmInventoryMSupplier(vm, entity);

                entity.CreatedDate = DateTime.Now;
                entity.CreatedBy   = User.Identity.Name;
                entity.DataStatus  = EnumDataStatus.New.ToString();

                _tasks.Insert(entity);
            }

            return(Json(new[] { vm }.ToDataSourceResult(request, ModelState)));
        }
Ejemplo n.º 4
0
 public ActionResult JmInventoryMSuppliers_Destroy([DataSourceRequest] DataSourceRequest request, JmInventoryMSupplierViewModel vm)
 {
     if (vm != null)
     {
         var entity = _tasks.One(vm.SupplierId);
         if (entity != null)
         {
             entity.ModifiedDate = DateTime.Now;
             entity.ModifiedBy   = User.Identity.Name;
             entity.DataStatus   = EnumDataStatus.Deleted.ToString();
             _tasks.Update(entity);
         }
     }
     return(Json(ModelState.ToDataSourceResult()));
 }