コード例 #1
0
        public async Task <WrapperSupplierListVM> Update(string id, SupplierVM ViewModel)
        {
            if (id != ViewModel.Id)
            {
                new WrapperSupplierListVM();
            }

            Task <IEnumerable <Supplier> > itemsDB = _repositoryWrapper.Supplier.FindByConditionAsync(x => x.Id == id && x.FactoryId == ViewModel.FactoryId);
            await Task.WhenAll(itemsDB);

            var itemUpdated = _utilService.GetMapper().Map <SupplierVM, Supplier>(ViewModel, itemsDB.Result.ToList().FirstOrDefault());

            _repositoryWrapper.Supplier.Update(itemUpdated);

            Task <int> t1 = _repositoryWrapper.Supplier.SaveChangesAsync();
            await Task.WhenAll(t1);

            this._utilService.Log("Successful In Updating Data");

            var dataParam = new GetDataListVM()
            {
                FactoryId  = ViewModel.FactoryId,
                PageNumber = 1,
                PageSize   = 10,
                TotalRows  = 0
            };
            WrapperSupplierListVM data = await GetListPaged(dataParam, true);

            return(data);
        }
コード例 #2
0
        public ActionResult AddSupplier(SupplierVM model)
        {
            if (ModelState.IsValid)
            {
                Supplier supplier = new Supplier();
                supplier.CompanyName  = model.CompanyName;
                supplier.ContactName  = model.ContactName;
                supplier.ContactTitle = model.ContactTitle;
                supplier.Address      = model.Address;
                supplier.City         = model.City;
                supplier.Region       = model.Region;
                supplier.PostalCode   = model.PostalCode;
                supplier.Country      = model.Country;
                supplier.Phone        = model.Phone;
                supplier.Fax          = model.Fax;
                supplier.HomePage     = model.HomePage;


                db.Suppliers.Add(supplier);
                db.SaveChanges();

                ViewBag.IslemDurum = EnumIslemDurum.Success;
                return(View());
            }
            else
            {
                ViewBag.Islemdurum = EnumIslemDurum.ValidationError;
                return(View());
            }
        }
コード例 #3
0
        public void CreateTest()
        {
            PartialViewResult rv = (PartialViewResult)_controller.Create();

            Assert.IsInstanceOfType(rv.Model, typeof(SupplierVM));

            SupplierVM vm = rv.Model as SupplierVM;
            Supplier   v  = new Supplier();

            v.SupplierName  = "bem";
            v.Contract      = "uQte8AWkm";
            v.ContractPhone = "OX9Psxo";
            vm.Entity       = v;
            _controller.Create(vm);

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                var data = context.Set <Supplier>().FirstOrDefault();

                Assert.AreEqual(data.SupplierName, "bem");
                Assert.AreEqual(data.Contract, "uQte8AWkm");
                Assert.AreEqual(data.ContractPhone, "OX9Psxo");
                Assert.AreEqual(data.CreateBy, "user");
                Assert.IsTrue(DateTime.Now.Subtract(data.CreateTime.Value).Seconds < 10);
            }
        }
コード例 #4
0
        public ActionResult Delete(string id, int productId)
        {
            SupplierVM supplierVM = new SupplierVM();

            supplierVM.AllowDelete = true;

            Supplier supplier = new Supplier();

            supplier = supplierRepository.GetSupplier(id, productId);

            //Check Exists
            if (supplier == null)
            {
                ViewData["ActionMethod"] = "ViewGet";
                return(View("RecordDoesNotExistError"));
            }

            supplierVM.Supplier = supplier;

            //Attached Items
            List <SupplierReference> supplierReferences = supplierRepository.GetSupplierReferences(supplier.SupplierCode, supplier.ProductId);

            if (supplierReferences.Count > 0)
            {
                supplierVM.AllowDelete        = false;
                supplierVM.SupplierReferences = supplierReferences;
            }

            supplierRepository.EditItemForDisplay(supplier);

            return(View(supplierVM));
        }
コード例 #5
0
        public ActionResult Index()
        {
            //int year = DateTime.Now.Year;
            //int month = DateTime.Now.Month;
            //int day = DateTime.Now.Day;


            List <SupplierVM> model = new List <SupplierVM>();

            List <Supplier> suppliers = supplierrepo.GetAll();


            foreach (var item in suppliers)
            {
                //new CultureInfo("en-US")
                SupplierVM svm = new SupplierVM();
                svm.ID      = item.ID;
                svm.AddDate = item.AddDate.ToString("dd MMMM yyyy dddd", new CultureInfo("tr-TR"));
                // svm.AddDate = item.AddDate.ToString("dddd, dd MMMM yyyy");
                svm.Aciklama = item.Description;
                svm.SirketAd = item.CompanyName;

                model.Add(svm);
            }


            return(View(model));
        }
コード例 #6
0
        public async Task <WrapperSupplierListVM> Delete(SupplierVM Temp)
        {
            var Task = await _repositoryWrapper.Supplier.FindByConditionAsync(x => x.Id == Temp.Id && x.FactoryId == Temp.FactoryId);

            var datarow = Task.ToList().FirstOrDefault();

            if (datarow == null)
            {
                return(new WrapperSupplierListVM());
            }
            _repositoryWrapper.Supplier.Delete(datarow);
            await _repositoryWrapper.Supplier.SaveChangesAsync();

            this._utilService.Log("Successful In Deleting Data");
            var dataParam = new GetDataListVM()
            {
                FactoryId  = Temp.FactoryId,
                PageNumber = 1,
                PageSize   = 10,
                TotalRows  = 0
            };
            WrapperSupplierListVM data = await GetListPaged(dataParam, true);

            return(data);
        }
コード例 #7
0
ファイル: Supplier.cs プロジェクト: muhammadrifqi32/Cashier
 public Supplier(SupplierVM supplierVM)
 {
     this.Name       = supplierVM.Name;
     this.JoinDate   = supplierVM.JoinDate;
     this.CreateDate = DateTimeOffset.Now;
     this.IsDelete   = false;
 }
コード例 #8
0
        public void DeleteTest()
        {
            Supplier v = new Supplier();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                v.SupplierName  = "bem";
                v.Contract      = "uQte8AWkm";
                v.ContractPhone = "OX9Psxo";
                context.Set <Supplier>().Add(v);
                context.SaveChanges();
            }

            PartialViewResult rv = (PartialViewResult)_controller.Delete(v.ID.ToString());

            Assert.IsInstanceOfType(rv.Model, typeof(SupplierVM));

            SupplierVM vm = rv.Model as SupplierVM;

            v         = new Supplier();
            v.ID      = vm.Entity.ID;
            vm.Entity = v;
            _controller.Delete(v.ID.ToString(), null);

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                Assert.AreEqual(context.Set <Supplier>().Count(), 1);
            }
        }
コード例 #9
0
 public SupplierVM GetSupplierById(int id)
 {
     try
     {
         var        _supp  = _SupplierRepository.GetById(id);
         SupplierVM suppVM = new SupplierVM();
         suppVM.Address      = _supp.Address;
         suppVM.CST          = _supp.CST;
         suppVM.District     = _supp.District;
         suppVM.Email        = _supp.Email;
         suppVM.IsActive     = (bool)_supp.IsActive;
         suppVM.MobileNo1    = _supp.MobileNo1;
         suppVM.MobileNo2    = _supp.MobileNo2;
         suppVM.Owner        = _supp.Owner;
         suppVM.PinCode      = _supp.PinCode;
         suppVM.State        = _supp.State;
         suppVM.SupplierCode = _supp.SupplierCode;
         suppVM.SupplierId   = _supp.SupplierId;
         suppVM.SupplierName = _supp.SupplierName;
         suppVM.TelePhone1   = _supp.TelePhone1;
         suppVM.TelePhone2   = _supp.TelePhone2;
         suppVM.VAT          = _supp.VAT;
         return(suppVM);
     }
     catch (Exception e) {
         throw e;
     }
 }
コード例 #10
0
        public async Task <bool> Edit(SupplierVM supplierVM)
        {
            Supplier supplier = mapper.Map <Supplier>(supplierVM);

            return(((await supplierRepo.UpdateSupplier(supplier)) != null) ?
                   true : false);
        }
コード例 #11
0
        public async Task <string> AddUpdateUser(SupplierVM supplierVM)
        {
            SupplierDomainModel supplierDM = new SupplierDomainModel();

            AutoMapper.Mapper.Map(supplierVM, supplierDM);
            return(await supplierBusiness.AddUpdateSupplier(supplierDM));
        }
コード例 #12
0
        public ActionResult Delete(SupplierVM supplierVM, HttpPostedFileBase image)
        {
            //fileName = Path.GetFileNameWithoutExtension(image.FileName);
            //string extension = Path.GetExtension(image.FileName);
            //fileName = supplierVM.Name + fileName + DateTime.Now.ToString("yymmssfff") + extension;
            //supplierVM.Image = "~/images/SupplierImage/" + fileName;
            var supplier = Mapper.Map <Supplier>(supplierVM);

            if (ModelState.IsValid)
            {
                //fileName = Path.Combine(Server.MapPath("~/images/SupplierImage/"), fileName);
                if (_supplierManager.Delete(supplier))
                {
                    ViewBag.SuccessMsg = "Deleted";
                    TempData["SuccessDeleteMessage"] = "Record Delete Successfully";
                    return(RedirectToAction("Show"));
                }
                else
                {
                    ViewBag.FailMsg = "Failed";
                }
            }
            else
            {
                ViewBag.FailMsg = "Validation Error";
            }

            return(View(supplierVM));
        }
コード例 #13
0
        public async Task <SupplierVM> Paging(string keyword, int pageNumber, int pageSize)
        {
            var result = new SupplierVM();

            try
            {
                using (var conn = new SqlConnection(_connectionString.Value))
                {
                    DynamicParameters parameters = new DynamicParameters();
                    parameters.Add("@pageSize", pageSize);
                    parameters.Add("@pageNumber", pageNumber);
                    parameters.Add("@paramKeyword", keyword);
                    parameters.Add("@length", dbType: DbType.Int32, direction: ParameterDirection.Output);
                    parameters.Add("@filterLength", dbType: DbType.Int32, direction: ParameterDirection.Output);
                    result.data = await conn.QueryAsync <SupplierVM>("SP_FilterDataSupplier", parameters, commandType : CommandType.StoredProcedure);

                    int filterlength = parameters.Get <int>("@filterLength");
                    result.filterLength = filterlength;
                    int length = parameters.Get <int>("@length");
                    result.length = length;
                    return(result);

                    //var result = conn.Query<ToDoListVM>("SP_FilterData", parameters, commandType: CommandType.StoredProcedure);
                    //return result;
                }
            }
            catch (Exception e) { }
            return(result);
        }
コード例 #14
0
        public ActionResult Edit(SupplierVM model)
        {
            if (ModelState.IsValid)
            {
                if (rpsupplier.Any(x => x.CompanyName.ToLower() == model.CompanyName.ToLower() && x.ID != model.ID))
                {
                    ViewBag.IslemDurum = EnumIslemDurum.IsimMevcut;
                }
                else
                {
                    Supplier entity = rpsupplier.Find(model.ID);
                    entity.CompanyName = model.CompanyName;
                    entity.Address     = model.Address;
                    entity.Phone       = model.Phone;
                    entity.Email       = model.Email;
                    entity.WebSite     = model.WebSite;
                    entity.CityID      = model.CityID;
                    entity.RegionID    = model.RegionID;

                    entity.UpdateDate = DateTime.Now;
                    rpsupplier.SaveChanges();
                    ViewBag.IslemDurum = EnumIslemDurum.Basarili;
                }
            }
            else
            {
                ViewBag.IslemDurum = EnumIslemDurum.ValidationHata;
            }
            GetAllCitiesforEditing(model.CityID);
            return(View(model));
        }
コード例 #15
0
 public ActionResult Add(SupplierVM model)
 {
     if (ModelState.IsValid)
     {
         if (rpsupplier.Any(x => x.CompanyName.ToLower() == model.CompanyName.ToLower()))
         {
             ViewBag.IslemDurum = EnumIslemDurum.IsimMevcut;
         }
         else
         {
             Supplier entity = new Supplier
             {
                 CompanyName = model.CompanyName,
                 Address     = model.Address,
                 Phone       = model.Phone,
                 Email       = model.Email,
                 WebSite     = model.WebSite,
                 CityID      = model.CityID,
                 RegionID    = model.RegionID
             };
             rpsupplier.Add(entity);
             ViewBag.IslemDurum = EnumIslemDurum.Basarili;
         }
     }
     else
     {
         ViewBag.IslemDurum = EnumIslemDurum.ValidationHata;
     }
     GetAllCitiesforAdding();
     return(View(model));
 }
コード例 #16
0
        public HttpResponseMessage Delete(HttpRequestMessage request, SupplierVM supplierVM)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                if (!ModelState.IsValid)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest,
                                                      ModelState.Keys.SelectMany(k => ModelState[k].Errors)
                                                      .Select(m => m.ErrorMessage).ToArray());
                }
                else
                {
                    supplierVM.IsDeleted = true;
                    Supplier _supplier = _suppliersRepository.GetSingleBySupplierID(supplierVM.ID);
                    _supplier.UpdateSupplier(supplierVM);

                    _suppliersRepository.Commit();

                    response = request.CreateResponse(HttpStatusCode.OK);
                }

                return response;
            }));
        }
コード例 #17
0
        public HttpResponseMessage Create(HttpRequestMessage request, SupplierVM supplierVM)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest,
                                                      ModelState.Keys.SelectMany(k => ModelState[k].Errors).Select(m => m.ErrorMessage).ToArray());
                }
                else
                {
                    if (_suppliersRepository.SupplierExists(supplierVM.Email, supplierVM.Name))
                    {
                        ModelState.AddModelError("Invalid user", "Email or Name already exists");
                        response = request.CreateResponse(HttpStatusCode.BadRequest,
                                                          ModelState.Keys.SelectMany(k => ModelState[k].Errors).Select(m => m.ErrorMessage).ToArray());
                    }
                    else
                    {
                        Supplier newSupplier = new Supplier();
                        newSupplier = AutoMapper.Map <SupplierVM, Supplier>(supplierVM);

                        _suppliersRepository.Insert(newSupplier);
                        _suppliersRepository.Commit();

                        // Update view model
                        supplierVM = AutoMapper.Map <Supplier, SupplierVM>(newSupplier);
                        response = request.CreateResponse <SupplierVM>(HttpStatusCode.Created, supplierVM);
                    }
                }
                return response;
            }));
        }
コード例 #18
0
ファイル: PurchaseVM.cs プロジェクト: armohamm/PJSM.ERP
        private void SetEditMode(PurchaseTransaction transaction)
        {
            Model           = transaction;
            TransactionDOID = transaction.DOID;

            IsTransactionNotPaid             = transaction.Paid == 0;
            IsTransactionTaxCheckBoxSelected = Model.Tax > 0;

            UpdateSuppliers();
            _transactionSupplier = Suppliers.Single(supplier => supplier.ID.Equals(transaction.Supplier.ID));
            OnPropertyChanged("TransactionSupplier");

            TransactionDate    = transaction.Date;
            TransactionDueDate = transaction.DueDate;
            TransactionNote    = transaction.Note;

            DisplayedLines.Clear();
            foreach (var line in transaction.PurchaseTransactionLines.OrderBy(e => e.Item.Name).ThenBy(e => e.Warehouse.Name).ThenBy(e => e.PurchasePrice).ThenBy(e => e.Discount).ToList())
            {
                DisplayedLines.Add(new PurchaseTransactionLineVM {
                    Model = line
                });
            }

            OnPropertyChanged("TransactionGrossTotal"); // Updates transaction's net total too
            TransactionDiscount = transaction.Discount;
            TransactionTax      = transaction.Tax;
        }
コード例 #19
0
 public MasterInventoryEditAddSupplierVM(ObservableCollection <SupplierVM> editSuppliers)
 {
     _editSuppliers = editSuppliers;
     SuppliersAvailableForAddition = new ObservableCollection <SupplierVM>();
     LoadSuppliersAvailableForAddition();
     _selectedSupplierForAddition = SuppliersAvailableForAddition.First();
 }
コード例 #20
0
 public bool AddSupplier(SupplierVM _SupplierVM)
 {
     try
     {
         tblSupplier supplier = new tblSupplier();
         supplier.Address      = _SupplierVM.Address;
         supplier.CST          = _SupplierVM.CST;
         supplier.District     = _SupplierVM.District;
         supplier.Email        = _SupplierVM.Email;
         supplier.IsActive     = _SupplierVM.IsActive;
         supplier.MobileNo1    = _SupplierVM.MobileNo1;
         supplier.MobileNo2    = _SupplierVM.MobileNo2;
         supplier.Owner        = _SupplierVM.Owner;
         supplier.PinCode      = _SupplierVM.PinCode;
         supplier.State        = _SupplierVM.State;
         supplier.SupplierCode = _SupplierVM.SupplierCode;
         supplier.SupplierName = _SupplierVM.SupplierName;
         supplier.TelePhone1   = _SupplierVM.TelePhone1;
         supplier.TelePhone2   = _SupplierVM.TelePhone2;
         supplier.VAT          = _SupplierVM.VAT;
         supplier.IsDeleted    = false;
         _SupplierRepository.Add(supplier);
         _unitOfWork.Complete();
         return(true);
     }
     catch (Exception e) {
         throw e;
     }
 }
コード例 #21
0
        public ActionResult Report(SupplierVM supplierVM)
        {
            SupplierReport _supplierReport = new SupplierReport();

            byte[] abytes = _supplierReport.PrepareReport();
            return(File(abytes, "application/pdf"));
        }
コード例 #22
0
        public ActionResult Update(Guid?id)
        {
            if (id == null)
            {
                return(RedirectToAction("List", "Supplier", new { area = "Member" }));
            }

            Supplier   data  = _supplierService.GetById((Guid)id);
            SupplierVM model = new SupplierVM()
            {
                ID           = data.ID,
                SupplierCode = data.SupplierCode,
                Name         = data.Name,
                ContactName  = data.ContactName,
                Address      = data.Address,
                TaxNumber    = data.TaxNumber,
                Tax          = data.Tax,
                Phone        = data.Phone,
                Email        = data.Email,
                District     = data.District,
                City         = data.City,
                Country      = data.Country,
            };

            return(View(model));
        }
コード例 #23
0
        public int Update(int id, SupplierVM supplierVM)
        {
            var update = myContext.Suppliers.Find(id);

            update.Update(supplierVM);
            return(myContext.SaveChanges());
        }
コード例 #24
0
 public Supplier(SupplierVM supplierVM)
 {
     this.Name       = supplierVM.Name;
     this.Email      = supplierVM.Email;
     this.CreateDate = DateTimeOffset.Now;
     this.IsDeleted  = false;
 }
コード例 #25
0
        public async Task <ActionResult> Create(SupplierVM model)
        {
            if (_db.Vendors.IsExistSmsNumber(0, model.SmsNumber))
            {
                ModelState.AddModelError("SmsNumber", "SMS Number Already exist");
            }

            if (!ModelState.IsValid)
            {
                return(View($"_Create", model));
            }

            var vendor = _db.Suppliers.AddCustom(model);
            var task   = await _db.SaveChangesAsync();

            if (task != 0)
            {
                model.SupplierID = vendor.SupplierID;
                var result = new AjaxContent <SupplierVM> {
                    Status = true, Data = model
                };
                return(Json(result));
            }

            ModelState.AddModelError("", "Unable to insert record!");
            return(View($"_Create", model));
        }
コード例 #26
0
        private async Task <WrapperSupplierListVM> SetHistoryOverview(WrapperSupplierListVM vm, string FactoryId)
        {
            var data = new GetDataListHistory();

            //Task<WrapperSupplierHistory>[] listOftask = new Task<WrapperSupplierHistory>[vm.ListOfData.Count];
            WrapperSupplierHistory[] listOftask = new WrapperSupplierHistory[vm.ListOfData.Count];
            for (int i = 0; i < vm.ListOfData.Count; i++)
            {
                SupplierVM temp = vm.ListOfData.ElementAt(i);
                data.ClientId   = temp.Id;
                data.PageNumber = -1;
                data.PageSize   = -1;
                data.FactoryId  = FactoryId;
                listOftask[i]   = await GetSupplierHistory(data);

                int len = listOftask[i].ListOfData.Count - 1;
                vm.ListOfData.ElementAt(i).PaidAmount       = listOftask[i].ListOfData[len].PaidAmount;
                vm.ListOfData.ElementAt(i).RecievableAmount = listOftask[i].ListOfData[len].RecievableAmount;
                vm.ListOfData.ElementAt(i).RecievedAmount   = listOftask[i].ListOfData[len].RecievedAmount;
                vm.ListOfData.ElementAt(i).PayableAmount    = listOftask[i].ListOfData[len].PayableAmount;
            }

            // await Task.WhenAll(listOftask);

            //for (int i = 0; i < vm.ListOfData.Count; i++)
            //{
            //    //SupplierHistory te = GetSupplierHistoryOverview(listOftask[i].Result);
            //    SupplierHistory te = GetSupplierHistoryOverview(listOftask[i]);
            //    vm.ListOfData.ElementAt(i).PaidAmount = te.PaidAmount;
            //    vm.ListOfData.ElementAt(i).RecievableAmount = te.RecievableAmount;
            //    vm.ListOfData.ElementAt(i).RecievedAmount = te.RecievedAmount;
            //    vm.ListOfData.ElementAt(i).PayableAmount = te.PayableAmount;
            //}
            return(vm);
        }
コード例 #27
0
        public ActionResult Add(SupplierVM supplierVM, HttpPostedFileBase image)
        {
            if (ModelState.IsValid)
            {
                _fileName = Path.GetFileNameWithoutExtension(image.FileName);
                string extension = Path.GetExtension(image.FileName);
                _fileName        = supplierVM.Name + _fileName + DateTime.Now.ToString("yymmssfff") + extension;
                supplierVM.Image = "~/images/SupplierImage/" + _fileName;

                //Supplier supplier = new Supplier();
                var supplier = Mapper.Map <Supplier>(supplierVM);
                if (_supplierManager.Add(supplier))
                {
                    _fileName = Path.Combine(Server.MapPath("~/images/SupplierImage/"), _fileName);
                    image.SaveAs(_fileName);
                    ViewBag.SuccessMsg         = "Saved";
                    TempData["SuccessMessage"] = "Saved Successfully";
                    return(RedirectToAction("Show"));
                }
                else
                {
                    ViewBag.FailMsg = "Save Failed!!";
                }
            }
            else
            {
                ViewBag.FailMsg = "Validation Error!!";
            }

            return(View(supplierVM));
        }
コード例 #28
0
 public MasterInventoryEditAddSupplierVM(ObservableCollection<SupplierVM> editSuppliers)
 {
     _editSuppliers = editSuppliers;
     SuppliersAvailableForAddition = new ObservableCollection<SupplierVM>();
     LoadSuppliersAvailableForAddition();
     _selectedSupplierForAddition = SuppliersAvailableForAddition.First();
 }
コード例 #29
0
        public IActionResult Create(SupplierVM model, IFormFile Logo)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (model.ID == 0)
                    {
                        #region For Create

                        var supplier = _mapper.Map <Supplier>(model);
                        if (Logo != null)
                        {
                            string urlImage = MyTool.UploadImage(Logo, "wwwroot", "Image", "Suppliers");
                            if (!string.IsNullOrEmpty(urlImage))
                            {
                                supplier.Logo = urlImage;
                            }
                        }

                        db.Suppliers.Add(supplier);
                        db.SaveChanges();

                        #endregion For Create
                        TempData["StatusMessage"] = "Successfully created";
                    }
                    else
                    {
                        #region for edit

                        var supplierEdit = _mapper.Map <Supplier>(model);

                        if (Logo != null)
                        {
                            string urlImage = MyTool.UploadImage(Logo, "wwwroot", "Image", "Suppliers");
                            if (!string.IsNullOrEmpty(urlImage))
                            {
                                supplierEdit.Logo = urlImage;
                            }
                        }

                        db.Update(supplierEdit);
                        db.SaveChanges();

                        #endregion for edit
                        TempData["StatusMessage"] = "Successfully updated";
                    }

                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                TempData["StatusMessage"] = ex.Message;

                return(View(model));
            }
            return(View(model));
        }
コード例 #30
0
        public ActionResult Delete(int Id)
        {
            _supplier.Id = Id;
            var supplier = _supplierManager.GetByID(_supplier);

            _supplierVM = Mapper.Map <SupplierVM>(supplier);
            return(View(_supplierVM));
        }
コード例 #31
0
 private void UpdateSelectedSupplier(SupplierVM oldSelectedSupplier)
 {
     if (oldSelectedSupplier == null)
     {
         return;
     }
     SelectedSupplier = Suppliers.FirstOrDefault(supplier => supplier.ID.Equals(oldSelectedSupplier.ID));
 }
コード例 #32
0
        public MasterSuppliersVM()
        {
            Suppliers = new ObservableCollection<SupplierVM>();
            Categories = new ObservableCollection<ItemCategoryVM>();
            CategoryItems = new ObservableCollection<ItemVM>();
            DisplayedSuppliers = new ObservableCollection<SupplierVM>();

            UpdateCategories();
            UpdateSuppliers();
            _selectedSupplier = Suppliers.FirstOrDefault();
            _isActiveChecked = true;
            UpdateDisplayedSuppliers();

            NewEntryVM = new MasterSuppliersNewEntryVM(this);
        }
コード例 #33
0
 public MasterSuppliersEditVM(SupplierVM editingSupplier)
 {
     _editingSupplier = editingSupplier;
     SetDefaultEditProperties();
 }
コード例 #34
0
 private void UpdateSelectedSupplier(SupplierVM oldSelectedSupplier)
 {
     if (oldSelectedSupplier == null) return;
     SelectedSupplier = Suppliers.SingleOrDefault(supplier => supplier.ID.Equals(oldSelectedSupplier.ID));
 }