protected void uiButtonCancel_Click(object sender, EventArgs e)
 {
     uiPanelEdit.Visible = false;
     uiPanelViewStatus.Visible = true;
     Clearfields();
     CurrentStatus = null;
 }
        protected void uiButtonUpdate_Click(object sender, EventArgs e)
        {
            OrderStatus status = new OrderStatus();
            if (CurrentStatus != null)
            {
                status = CurrentStatus;
            }
            else
            {
                status.AddNew();
            }

            status.Name = uiTextBoxName.Text;
            status.Save();
            uiPanelEdit.Visible = false;
            uiPanelViewStatus.Visible = true;
            Clearfields();
            BindData();
            CurrentStatus = null;
        }
示例#3
0
        private void BindOrder()
        {
            Order order = (Order)Session["ViewCurrentOrder"];
            uiLabelOrderNumber.Text = order.OrderNumber;
            OrderStatus status = new OrderStatus ();
            status.LoadByPrimaryKey(order.OrderStatusID);
            uiLabelStatus.Text = status.Name;
            uiLabelDate.Text = order.Orderdate.ToString("dd/MM/yyyy");

            uiLabelFullName.Text = order.FirstName + " " + order.LastName;
            uiLabelCity.Text = order.City;
            uiLabelCountry.Text = order.Country;
            uiLabelFax.Text = order.Fax;
            uiLabelTele.Text = order.Phone;
            uiLabelMail.Text = order.Mail;

            uiHyperLinkInvoice.NavigateUrl = "ViewOrder.aspx?oid=" + order.OrderID.ToString();

            BindDetails();
            BindHistory();
        }
        private void LoadDDLs()
        {
            Users users = new Users();
            users.GetAllUsers();
            uiDropDownListUsers.DataSource = users.DefaultView;
            uiDropDownListUsers.DataTextField = "DisplayName";
            uiDropDownListUsers.DataValueField = "UserID";
            uiDropDownListUsers.DataBind();
            uiDropDownListUsers.Items.Insert(0, new ListItem("Choose user", ""));

            Product product = new Product();
            product.GetAllProducts();
            uiDropDownListProducts.DataSource = product.DefaultView;
            uiDropDownListProducts.DataTextField = "Name";
            uiDropDownListProducts.DataValueField = "ProductID";
            uiDropDownListProducts.DataBind();
            uiDropDownListProducts.Items.Insert(0, new ListItem("Choose product", ""));

            OrderStatus orderStatus = new OrderStatus();
            orderStatus.LoadAll();
            uiDropDownListStatus.DataSource = orderStatus.DefaultView;
            uiDropDownListStatus.DataTextField = "Name";
            uiDropDownListStatus.DataValueField = "OrderStatusID";
            uiDropDownListStatus.DataBind();
            uiDropDownListStatus.Items.Insert(0, new ListItem("Choose status", ""));
        }
        protected void uiGridViewStatus_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditStatus")
            {
                OrderStatus orderStatus = new EGEMech.BLL.OrderStatus();
                orderStatus.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument));
                CurrentStatus = orderStatus;

                uiTextBoxName.Text = orderStatus.Name;

                uiPanelViewStatus.Visible = false;
                uiPanelEdit.Visible = true;
            }
            else if (e.CommandName == "DeleteStatus")
            {
                try
                {
                    OrderStatus orderStatus = new EGEMech.BLL.OrderStatus();
                    orderStatus.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument));
                    orderStatus.MarkAsDeleted();
                    orderStatus.Save();
                    BindData();
                }
                catch (Exception ex)
                {
                    uiLabelError.Visible = true;
                }

            }
        }
 private void BindData()
 {
     OrderStatus Status = new OrderStatus();
     Status.LoadAll();
     uiGridViewStatus.DataSource = Status.DefaultView;
     uiGridViewStatus.DataBind();
 }