示例#1
0
        /// <summary>
        /// Метод создания заказа
        /// </summary>
        /// <param name="order"></param>
        public bool CreateOrder(OrdersDTO order)
        {
            try
            {
                Orders OrderDAL = new Orders();
                OrderDAL.CustomerID = order.CustomerID;
                OrderDAL.OrderDate  = order.OrderDate;

                if (Data.CreateOrder(OrderDAL) != true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (ArgumentException ex)
            {
                throw new ValidationException(ex.Message, ex.ParamName);
            }
        }
示例#2
0
        public void CreateWrongOrderTest()
        {
            DALDB db = new DALDB();

            string   CustomerID     = "";
            int      EmployeeID     = 0;
            DateTime OrderDate      = DateTime.MinValue;
            DateTime RequiredDate   = DateTime.MinValue;
            DateTime ShippedDate    = DateTime.MinValue;
            int      ShipVia        = -1;
            float    Freight        = -1;
            string   ShipName       = "Rattlesnake Canyon Grocery";
            string   ShipAddress    = "2817 Milton Dr.";
            string   ShipCity       = "Albuquerque";
            string   ShipRegion     = "NM";
            string   ShipPostalCode = "87110";
            string   ShipCountry    = "USA";

            Orders note = new Orders(CustomerID, EmployeeID, OrderDate,
                                     RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress,
                                     ShipCity, ShipRegion, ShipPostalCode, ShipCountry);

            Assert.AreEqual(false, db.CreateOrder(note));
        }