Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Delivery"/> class.
 /// </summary>
 /// <param name="orderid">
 /// The orderid.
 /// </param>
 /// <param name="address">
 /// The address.
 /// </param>
 /// <param name="postal">
 /// The postal.
 /// </param>
 /// <param name="city">
 /// The city.
 /// </param>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <param name="date">
 /// The date.
 /// </param>
 public Delivery(int orderid, string address, string postal, string city, Customer customer, DateTime date)
     : base(orderid, customer, date)
 {
     this.Address = address;
     this.Postalcode = postal;
     this.City = city;
 }
        /// <summary>
        /// The insert of an customer.
        /// </summary>
        /// <param name="customer">
        /// The customer.
        /// </param>
        /// <returns>
        /// The <see cref="Customer"/>.
        /// </returns>
        public Customer Insert(Customer customer)
        {
            var query =
                "INSERT INTO klant (klantid, naam, adres, postcode, plaats, telefoonnummer, emailadres, wachtwoord) VALUES (seq_klant.nextval, :naam, :adres, :postcode, :plaats, :telefoonnummer, :emailadres, :pass) RETURNING klantid INTO :lastID";
            var parameters = new List<OracleParameter>
            {
                new OracleParameter("naam", customer.Name),
                new OracleParameter("adres", customer.Address),
                new OracleParameter("postcode", customer.Postalcode),
                new OracleParameter("plaats", customer.City),
                new OracleParameter("telefoonnummer", customer.Telephone),
                new OracleParameter("emailadres", customer.Emailaddress),
                new OracleParameter("pass", customer.Password),
                new OracleParameter("lastID", OracleDbType.Decimal) {Direction = ParameterDirection.ReturnValue}
            };

            string newID;
            if (!Database.ExecuteNonQuery(query, out newID, parameters)) return null;
            return this.GetById(Convert.ToInt32(newID));
        }
        /// <summary>
        /// The update of an customer.
        /// </summary>
        /// <param name="customer">
        /// The customer.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool Update(Customer customer)
        {
            var query = "UPDATE klant SET naam = :name, adres = :address, postcode = :postal, plaats = :city, telefoonnummer = :phone WHERE klantid = :id";

            var parameters = new List<OracleParameter>
            {
                new OracleParameter("id", customer.Id),
                new OracleParameter("name", customer.Name),
                new OracleParameter("address", customer.Address),
                new OracleParameter("postal", customer.Postalcode),
                new OracleParameter("city", customer.City),
                new OracleParameter("phone", customer.Telephone)
            };

            return Database.ExecuteNonQuery(query, parameters);
        }
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.User.Identity.IsAuthenticated)
            {
                this.Response.Redirect("~/Login.aspx");
            }

            // Loading articles
            this.workingman = new ShoppingCartActions();
            this.transportman = new OrderLogic(new DeliveryOracleContext(), new PickupOracleContext(), new OrderOracleContext());

            // Loading user
            var customerLogic = new CustomerLogic(new CustomerOracleContext());
            this.currentCustomer = customerLogic.GetByEmail(HttpContext.Current.User.Identity.Name);

            // Put information in form
            this.HcustomerID.Value = this.currentCustomer.Id.ToString();
            this.txtName.Text = this.currentCustomer.Name;
            this.txtAddress.Text = this.currentCustomer.Address;
            this.txtPostalCode.Text = this.currentCustomer.Postalcode;
            this.txtCity.Text = this.currentCustomer.City;
            this.txtTelePhoneNumber.Text = this.currentCustomer.Telephone;
            this.txtEmailAddress.Text = this.currentCustomer.Emailaddress;

            // Loading list of stores for picking up
            this.storeLogic  = new StoreLogic(new StoreOracleContext());

            foreach (var store in storeLogic.GetAllStores())
            {
                this.drpStores.Items.Add("MyCom - " + store.Address);
            }

            // Loading fields for delivery
            this.txtAlterAddress.Text = this.currentCustomer.Address;
            this.txtAlterCity.Text = this.currentCustomer.City;
            this.txtAlterPostal.Text = this.currentCustomer.Postalcode;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Order"/> class.
 /// </summary>
 /// <param name="id">
 /// The id.
 /// </param>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <param name="date">
 /// The date.
 /// </param>
 public Order(int id, Customer customer, DateTime date)
 {
     this.Id = id;
     this.Customer = customer;
     this.Date = date;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Pickup"/> class.
 /// </summary>
 /// <param name="orderid">
 /// The orderid.
 /// </param>
 /// <param name="store">
 /// The store.
 /// </param>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <param name="date">
 /// The date.
 /// </param>
 public Pickup(int orderid, int store, Customer customer, DateTime date)
     : base(orderid, customer, date)
 {
     this.StoreID = store;
 }
 /// <summary>
 /// The update.
 /// </summary>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 public bool Update(Customer customer)
 {
     return this._context.Update(customer);
 }
 /// <summary>
 /// The insert.
 /// </summary>
 /// <param name="customer">
 /// The customer.
 /// </param>
 /// <returns>
 /// The <see cref="Customer"/>.
 /// </returns>
 public Customer Insert(Customer customer)
 {
     return this._context.Insert(customer);
 }