コード例 #1
0
        /// <summary>
        /// The insert delivery order.
        /// </summary>
        /// <param name="order">
        /// The order.
        /// </param>
        /// <returns>
        /// The <see cref="Delivery"/>.
        /// </returns>
        public Delivery InsertDeliveryOrder(Delivery order)
        {
            var query =
                "INSERT INTO bezorg (ordernummer, adres, plaats, postcode) VALUES (:ordernr, :adres, :plaats, :postcode) RETURNING ordernummer INTO :lastID";
            var parameters = new List<OracleParameter>
            {
                new OracleParameter("ordernr", order.Id),
                new OracleParameter("adres", order.Address),
                new OracleParameter("plaats", order.City),
                new OracleParameter("postcode", order.Postalcode),
                new OracleParameter("lastID", OracleDbType.Decimal) {Direction = ParameterDirection.ReturnValue}
            };

            string newID;
            if (!Database.ExecuteNonQuery(query, out newID, parameters)) return null;
            return this.GetDeliveryById(Convert.ToInt32(newID));
        }
コード例 #2
0
        /// <summary>
        /// The btn place order delivery_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void btnPlaceOrderDelivery_Click(object sender, EventArgs e)
        {
            if (!this.Page.IsValid)
            {
                return;
            }

            // If other delivery address data change it in current customer
            if (this.txtAlterAddress.Text != this.currentCustomer.Address
                || this.txtAlterCity.Text != this.currentCustomer.City
                || this.txtAlterPostal.Text != this.currentCustomer.Postalcode)
            {
                this.currentCustomer.Address = this.txtAlterAddress.Text;
                this.currentCustomer.City = this.txtAlterCity.Text;
                this.currentCustomer.Postalcode = this.txtAlterPostal.Text;
            }
            else
            {
              // Making order for delivery
              var order = new Order(0, this.currentCustomer, DateTime.Now);
              order = this.transportman.InsertOrder(order);
              var delivery = new Delivery(order.Id, this.currentCustomer.Address, this.currentCustomer.Postalcode, this.currentCustomer.City, order.Customer, order.Date);
              delivery = this.transportman.InsertDeliveryOrder(delivery);
              this.AddingArticlesToDB(order);

                if (delivery == null)
                {
                    this.btnPlaceOrderDelivery.Enabled = false;
                    this.btnPlaceOrderPickUp.Enabled = false;
                    return;
                }

                this.workingman.EmptyCart();
                this.Response.Redirect("~/Succes.aspx");
            }
        }
コード例 #3
0
 /// <summary>
 /// The insert delivery order.
 /// </summary>
 /// <param name="order">
 /// The order.
 /// </param>
 /// <returns>
 /// The <see cref="Delivery"/>.
 /// </returns>
 public Delivery InsertDeliveryOrder(Delivery order)
 {
     return this.contextDeliveryOracleContext.InsertDeliveryOrder(order);
 }