Example #1
0
 private void loadStatuses()
 {
     OrderBL orderBL = new OrderBL();
     cmbStatus.DataSource = orderBL.GetOrderStatuses(true);
     cmbStatus.DataTextField = "name";
     cmbStatus.DataValueField = "orderStatusID";
     cmbStatus.DataBind();
 }
Example #2
0
        protected void dgvOrders_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                OrderBL orderBL = new OrderBL();
                int status = orderBL.DeleteOrder(int.Parse(dgvOrders.DataKeys[e.RowIndex].Values[0].ToString()));
                Response.Redirect("/administrator/orders.aspx");
            }
            catch (BLException ex)
            {

            }
        }
Example #3
0
 private void loadOrders()
 {
     OrderBL orderBL = new OrderBL();
     dgvOrders.DataSource = orderBL.GetOrders(cmbStatus.SelectedIndex > 0 ? int.Parse(cmbStatus.SelectedValue) : -1, DateTime.Parse(txtDateFrom.Text), DateTime.Parse(txtDateTo.Text), null);
     dgvOrders.DataBind();
 }
Example #4
0
        private Order createOrder(int userID)
        {
            Order order = new Order();
            order.Date = DateTime.Now.AddHours(9);
            order.Firstname = txtFirstname.Text;
            order.Lastname = txtLastname.Text;
            order.Address = txtAddress.Text;
            order.City = txtCity.Text;
            order.Phone = txtPhone.Text;
            order.Email = txtEmail.Text;
            order.Items = getItems();
            order.User = new User(userID, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, null, string.Empty, string.Empty);
            order.Name = (rdbUserType.SelectedValue == "2") ? txtCompanyName.Text : string.Empty;
            order.Pib = (rdbUserType.SelectedValue == "2") ? txtPib.Text : string.Empty;
            order.Payment = (order.Name != string.Empty) ? new Payment(int.Parse(rdbPaymentCompany.SelectedValue), rdbPaymentCompany.SelectedItem.Text) : new Payment(int.Parse(rdbPayment.SelectedValue.ToString()), rdbPayment.SelectedItem.Text);
            order.Delivery = new Delivery(int.Parse(rdbDelivery.SelectedValue.ToString()), rdbDelivery.SelectedItem.Text);
            CartBL cartBL = new CartBL();
            order.Coupon = new Coupon(cartBL.GetCartCoupon(Session["cartID"].ToString()), string.Empty, 0, string.Empty);
            order.OrderStatus = new OrderStatus(1, string.Empty);
            order.Zip = txtZip.Text;
            order.Comment = txtRemark.Text;
            order.CartID = Session["cartID"].ToString();

            OrderBL orderBL = new OrderBL();
            orderBL.SaveOrder(order);
            return order;
        }
Example #5
0
        private void loadOrder(int orderID)
        {
            OrderBL orderBL = new OrderBL();
            Order order = orderBL.GetOrder(orderID);

            lblDate.Text = order.Date.ToString();
            lblFirstname.Text = order.Firstname;
            lblLastname.Text = order.Lastname;
            lblUserType.Text = lblName.Text.Length > 0 ? "Pravno lice" : "Fizičko lice";//order.UserType;
            lblName.Text = order.Name.Length > 0 ? order.Name : "-";
            lblPib.Text = order.Pib.Trim().Length > 0 ? order.Pib : "-";
            lblAddress.Text = order.Address;
            lblCity.Text = order.City;
            lblZip.Text = order.Zip;
            lblEmail.Text = order.Email;
            lblPhone.Text = order.Phone;
            lblComment.Text = order.Comment.Trim().Length > 0 ? order.Comment : "-";
            lblPayment.Text = order.Payment.Name;
            lblDelivery.Text = order.Delivery.Name;
            cmbStatus.SelectedValue = order.OrderStatus.OrderStatusID.ToString();
            lblCoupon.Text = order.Coupon.Name;
            lblCode.Text = order.Code;
            this.Title = "Narudžbenica - " + order.Firstname + " " + order.Lastname + " | Admin panel";
            lblOrderID.Value = order.OrderID.ToString();

            dgvItems.DataSource = orderBL.GetOrderItemsFull(orderID);
            dgvItems.DataBind();

            double total = 0;
            for (int i = 0; i < dgvItems.Rows.Count; i++)
            {
                total += double.Parse(((Label)dgvItems.Rows[i].FindControl("lblTotal")).Text);
            }

            lblTotal.Text = string.Format("{0:N2}", total);
        }
Example #6
0
 protected void cmbStatus_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbStatus.SelectedIndex > -1)
     {
         OrderBL orderBL = new OrderBL();
         orderBL.UpdateOrderStatus(int.Parse(lblOrderID.Value), int.Parse(cmbStatus.SelectedValue));
     }
 }