Exemple #1
0
        /// <summary>
        /// convert foundry to view model
        /// </summary>
        /// <param name="foundry"></param>
        /// <returns></returns>
        public FoundryViewModel ConvertToView(PM00200_Foundry foundry)
        {
            FoundryViewModel model = new FoundryViewModel();

            var _paymentTermRepository  = new PaymentTermRepository();
            var _shipmentTermRepository = new ShipmentTermRepository();
            var _stateRepository        = new StateRepository();
            var _countryRepository      = new CountryRepository();

            var state       = _stateRepository.GetState(foundry.STATE);
            var country     = _countryRepository.GetCountry(foundry.COUNTRY);
            var paymentTerm = _paymentTermRepository.GetPaymentTerm(foundry.PYMTRMID);

            model.FoundryId              = foundry.VENDORID;
            model.VendorId               = foundry.VENDORID;
            model.ShortName              = (!string.IsNullOrEmpty(foundry.VENDSHNM.Replace(" ", string.Empty))) ? foundry.VENDSHNM : "N/A";
            model.ContactName            = (!string.IsNullOrEmpty(foundry.VNDCNTCT.Replace(" ", string.Empty))) ? foundry.VNDCNTCT : "N/A";
            model.ContactPhone           = FormattingManager.FormatPhone(foundry.PHNUMBR1);
            model.FaxNumber              = FormattingManager.FormatPhone(foundry.FAXNUMBR);
            model.Address1               = (!string.IsNullOrEmpty(foundry.ADDRESS1.Replace(" ", string.Empty))) ? foundry.ADDRESS1 : "N/A";
            model.Address2               = (!string.IsNullOrEmpty(foundry.ADDRESS2.Replace(" ", string.Empty))) ? foundry.ADDRESS2 : "N/A";
            model.Address3               = (!string.IsNullOrEmpty(foundry.ADDRESS3.Replace(" ", string.Empty))) ? foundry.ADDRESS3 : "N/A";
            model.City                   = (!string.IsNullOrEmpty(foundry.CITY.Replace(" ", string.Empty))) ? foundry.CITY : "N/A";
            model.StateName              = (state != null && !string.IsNullOrEmpty(state.Name)) ? state.Name : "N/A";
            model.PostalCode             = (!string.IsNullOrEmpty(foundry.ZIPCODE.Replace(" ", string.Empty))) ? foundry.ZIPCODE : "N/A";
            model.CountryName            = (country != null && !string.IsNullOrEmpty(country.Name)) ? country.Name : "N/A";
            model.PaymentTermDescription = (paymentTerm != null && !string.IsNullOrEmpty(paymentTerm.Description)) ? paymentTerm.Description : "N/A";
            model.IsActive               = foundry.VENDSTTS != 1 ? false : true;

            if (_paymentTermRepository != null)
            {
                _paymentTermRepository.Dispose();
                _paymentTermRepository = null;
            }

            if (_shipmentTermRepository != null)
            {
                _shipmentTermRepository.Dispose();
                _shipmentTermRepository = null;
            }

            if (_stateRepository != null)
            {
                _stateRepository.Dispose();
                _stateRepository = null;
            }

            if (_countryRepository != null)
            {
                _countryRepository.Dispose();
                _countryRepository = null;
            }

            return(model);
        }
Exemple #2
0
        /// <summary>
        /// convert foundry to list model
        /// </summary>
        /// <param name="foundry"></param>
        /// <returns></returns>
        public FoundryViewModel ConvertToListView(PM00200_Foundry foundry)
        {
            FoundryViewModel model = new FoundryViewModel();

            model.FoundryId   = foundry.VENDORID;
            model.VendorId    = foundry.VENDORID;
            model.ShortName   = (!string.IsNullOrEmpty(foundry.VENDSHNM.Replace(" ", string.Empty))) ? foundry.VENDSHNM : "N/A";
            model.ContactName = (!string.IsNullOrEmpty(foundry.VNDCNTCT.Replace(" ", string.Empty))) ? foundry.VNDCNTCT : "N/A";
            model.IsActive    = foundry.VENDSTTS != 1 ? false : true;

            return(model);
        }
Exemple #3
0
        public JsonResult GetCountryByFoundry(string foundryId)
        {
            var model = new FoundryViewModel();

            var foundry = _foundryDynamicsRepository.GetFoundry(foundryId);

            var country = _countryRepository.GetCountry(foundry.COUNTRY);

            model.CountryName = (country != null && (!string.IsNullOrEmpty(country.Name))) ? country.Name : "N/A";

            model.CountryId = (country != null) ? country.CountryId : Guid.Empty;

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        public JsonResult GetInactiveFoundries()
        {
            var model = new FoundryViewModel();

            var foundries = new List <FoundryViewModel>();

            var tempFoundries = _foundryDynamicsRepository.GetFoundries().Where(x => x.VENDSTTS != 1).ToList();

            foreach (var tempFoundry in tempFoundries)
            {
                FoundryViewModel convertedModel = new FoundryConverter().ConvertToListView(tempFoundry);

                foundries.Add(convertedModel);
            }

            model.Foundries = foundries.OrderBy(x => x.ShortName).ToList();

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Exemple #5
0
        public ActionResult Index()
        {
            var model = new FoundryViewModel();

            var result = new OperationResult();

            //var newPartMaster = new IV00101_Part_Master()
            //{
            //    ITEMNMBR = "COMPSYS",
            //    ITEMDESC = "compsys test",
            //    ITMCLSCD = "STANDARD",
            //    PRICMTHD = 2
            //};

            //var newPartPriceOption = new IV00107_Part_Price_Option()
            //{
            //    ITEMNMBR = "COMPSYS",
            //    PRCLEVEL = "STANDARD",
            //    UOFM = "part",
            //    CURNCYID = string.Empty
            //};

            //var newPartPrice = new IV00108_Part_Price()
            //{
            //    ITEMNMBR = "COMPSYS",
            //    PRCLEVEL = "STANDARD",
            //    UOFM = "part"
            //};

            //result = _partDynamicsRepository.SavePartMaster(newPartMaster);

            //result = _partDynamicsRepository.SavePartPrice(newPartPrice);

            //result = _partDynamicsRepository.SavePartPriceOption(newPartPriceOption);

            //var part = _partDynamicsRepository.GetPartCurrency(newPartMaster.ITEMNMBR);

            //if (part != null)
            //{
            //    part.LISTPRCE = 25.00000m;
            //    result = _partDynamicsRepository.UpdatePartCurrency(part);
            //}

            //var receiptLines = new List<POP10310>();

            //var newReceiptHeader = new POP10300_Receipt_Work()
            //{
            //    POPRCTNM = "PHANTOM201",
            //    POPTYPE = 1,
            //    receiptdate = DateTime.Now.ToShortDateString(),
            //    BACHNUMB = "COMPSYS",
            //    VENDORID = "SUO"
            //};

            //var newReceiptLine1 = new POP10310()
            //{
            //    POPTYPE = 1,
            //    POPRCTNM = "PHANTOM201",
            //    SERLTNUM = "B99999",
            //    ITEMNMBR = "083198-101A",
            //    VENDORID = "SUO",
            //    PONUMBER = "A014007",
            //    VNDITNUM = "083198-101A",
            //    QTYSHPPD = 5
            //};

            //var newReceiptLine2 = new POP10310()
            //{
            //    POPTYPE = 1,
            //    POPRCTNM = "PHANTOM201",
            //    SERLTNUM = "B99999",
            //    ITEMNMBR = "083198-101A",
            //    VENDORID = "SUO",
            //    PONUMBER = "A014007",
            //    VNDITNUM = "083198-101A",
            //    QTYSHPPD = 7
            //};

            //receiptLines.Add(newReceiptLine1);
            //receiptLines.Add(newReceiptLine2);

            //result = _receiptDynamicsRepository.SaveReceipt(newReceiptHeader, receiptLines);

            //var newPayable = new PM10000_Payables_Work()
            //{
            //    BACHNUMB = "B99999",
            //    VCHNUMWK = "99999999999999",
            //    VENDORID = "ITAF",
            //    DOCNUMBR = "DOC999999",
            //    DOCTYPE = 1,
            //    DOCAMNT = 1000.00m,
            //    DOCDATE = DateTime.Now,
            //    MSCCHAMT = 0.00m,
            //    PRCHAMNT = 1000.00m,
            //    CHRGAMNT = 1000.00m,
            //    TAXAMNT = 0.00m,
            //    FRTAMNT = 0.00m,
            //    TRDISAMT = 0.00m,
            //    CASHAMNT = 0.00m,
            //    CHEKAMNT = 0.00m,
            //    CRCRDAMT = 0.00m,
            //    DISTKNAM = 0.00m
            //};

            //result = _payablesDynamicsRepository.SavePayable(newPayable);


            var foundries = new List <FoundryViewModel>();

            var tempFoundries = _foundryDynamicsRepository.GetFoundries().Where(x => x.VENDSTTS == 1).ToList();

            if (tempFoundries != null && tempFoundries.Count > 0)
            {
                foreach (var tempFoundry in tempFoundries)
                {
                    FoundryViewModel convertedModel = new FoundryConverter().ConvertToListView(tempFoundry);

                    foundries.Add(convertedModel);
                }
            }

            model.Foundries = foundries.OrderBy(x => x.ShortName).ToList();

            return(View(model));
        }