Beispiel #1
0
        void Equals(string zipOrdera, Order_Del orderDel, string[] zipForDriver, string ComboDriver)
        {
            foreach (var dr1 in zipForDriver)
            {
                if (dr1.Equals(zipOrdera))
                {
                    orderDel.Driver_ID    = Convert.ToInt32(ComboDriver);
                    orderDel.Order_Status = "InTransite";

                    break;
                }
            }
            try { db.SaveChanges(); } catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Редактирование старой заявки
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        bool EditOldOrder(CallCenter model)
        {
            bool result = false;
            //
            var oldOrderFromDB = db.Order_Del.FirstOrDefault(d => d.Order_ID == model.Order_ID);
            var oldAddress     = oldOrderFromDB.Cust2.Address;
            var oldCustomer    = oldOrderFromDB.Cust2;

            Address address = new Address()
            {
                Address_City              = model.Address_City,
                Address_ZIPCODE           = model.Address_ZIPCODE,
                Address_Numder_Appartment = model.Address_Numder_Appartment,
                Address_Country           = model.Address_Country,
                Address_line1             = model.Address_line1,
                Address_line2             = model.Address_line2,
                Address_Name_Street       = model.Address_Name_Street,
                Address_Number_Street     = model.Address_Number_Street,
                Address_State             = model.Address_State,
            };

            RefreshAddress(address, oldAddress);
            //create customer
            Cust2 cust2 = new Cust2()
            {
                Lname  = model.Client.Lname,
                Fname  = model.Client.Fname,
                Email  = model.Client.Email,
                Phone  = model.Client.Phone,
                Gender = model.Gender
            };

            RefreshCustomer(cust2, oldCustomer);
            //create order
            int id = 0;

            int.TryParse(model.ComboBouqets, out id);
            int quantities = 0;

            int.TryParse(model.ComboQuantities, out quantities);
            decimal summ = 0;

            decimal.TryParse(model.Sum, out summ);

            Order_Del order = new Order_Del()
            {
                Bouquet_ID       = id,
                Bouquet_Quontity = quantities,
                Date_Delived     = DateDelivery,
                Total_Price      = summ,
                Size_Bouquets    = model.ComboSizes,
            };

            RefresOrder(order, oldOrderFromDB);

            try
            {
                db.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(result);
            }
        }