Esempio n. 1
0
        public static List <SuppliersPO> DOListToPOList(List <SupplierDO> from)
        {
            List <SuppliersPO> toFull = new List <SuppliersPO>();

            for (int i = 0; i < from.Count; i++)
            {
                SuppliersPO to = new SuppliersPO
                {
                    SupplierID   = from[i].SupplierID,
                    CompanyName  = from[i].CompanyName,
                    ContactName  = from[i].ContactName,
                    ContactTitle = from[i].ContactTitle,
                    Address      = from[i].Address,
                    City         = from[i].City,
                    Region       = from[i].Region,
                    PostalCode   = from[i].PostalCode,
                    Country      = from[i].Country,
                    Phone        = from[i].Phone,
                    Fax          = from[i].Fax,
                    HomePage     = from[i].HomePage
                };
                toFull.Add(to);
            }

            return(toFull);
        }
Esempio n. 2
0
        public ActionResult UpdateSupplier(int id)
        {
            ActionResult response;

            try
            {
                SupplierDO  supDO    = dao.ObtainSupplierSingle(id);
                SuppliersPO supplier = Mapper.SupplierDOtoSupplierPO(supDO);
                response = View(supplier);
            }
            catch (SqlException sqlEx)
            {
                response = RedirectToAction("Index", "Suppliers");
            }
            return(response);
        }
Esempio n. 3
0
        public ActionResult UpdateSupplier(SuppliersPO form)
        {
            ActionResult response;

            try
            {
                SupplierDO sup = Mapper.SupplierPOtoSupplierDO(form);
                dao.UpdateInformation(sup);
                response = RedirectToAction("Index", "Suppliers");
            }
            catch (SqlException sqlEx)
            {
                response = View(form);
            }

            return(response);
        }
Esempio n. 4
0
        public static SuppliersPO SupplierDOtoSupplierPO(SupplierDO from)
        {
            SuppliersPO to = new SuppliersPO
            {
                SupplierID   = from.SupplierID,
                CompanyName  = from.CompanyName,
                ContactName  = from.ContactName,
                ContactTitle = from.ContactTitle,
                Address      = from.Address,
                City         = from.City,
                Region       = from.Region,
                PostalCode   = from.PostalCode,
                Country      = from.Country,
                Phone        = from.Phone,
                Fax          = from.Fax,
                HomePage     = from.HomePage
            };

            return(to);
        }
Esempio n. 5
0
        public ActionResult SupplierDetails(int ID)
        {
            SupplierProducts supplierProductInfo = new SupplierProducts();

            try
            {
                SuppliersPO detailedSupplier = Mapper.SupplierDOtoSupplierPO(dao.ObtainSupplierSingle(ID));

                List <ProductDO> products        = prodDAO.ViewBySupplierID(detailedSupplier.SupplierID);
                List <ProductPO> displayProducts = ProductMapper.MapDoListToPo(products);

                supplierProductInfo.supplier = detailedSupplier;
                supplierProductInfo.products = displayProducts;
            }
            catch (SqlException sqlEx)
            {
                Logger.SqlExceptionLog(sqlEx);
            }

            return(View(supplierProductInfo));
        }