protected void DropDownList1_OnSelectedIndexChanged(object sender, EventArgs e)
    {
        QuotationLogic ql = new QuotationLogic();

        TextBox1.Text = ql.SelectByProductID(Convert.ToInt32(DropDownList1.SelectedItem.Value)).QuotationID.ToString();
    }
 protected void DropDownList1_OnSelectedIndexChanged(object sender, EventArgs e)
 {
     QuotationLogic ql = new QuotationLogic();
     TextBox1.Text = ql.SelectByProductID(Convert.ToInt32(DropDownList1.SelectedItem.Value)).QuotationID.ToString();
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        EmployeeLogic el = new EmployeeLogic();
        Employee      e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));

        if (e2.Designation.Equals("COMERCIAL MANAGER") || e2.Designation.Equals("COMERCIAL EMPLOYEE") || e2.Designation.Equals("DESIGNER") || e2.Designation.Equals("PRODUCTION MANAGER") || e2.Designation.Equals("PRODUCTION EMPLOYEE"))
        {
            if (!IsPostBack)
            {
                ProductLogic pl = new ProductLogic();
                DropDownList1.DataSource     = pl.SelectAll();
                DropDownList1.DataTextField  = "Name";
                DropDownList1.DataValueField = "ProductID";
                DropDownList1.DataBind();

                if (Convert.ToInt32(Request.QueryString["id"]) > 0)
                {
                    OrderLogic ol = new OrderLogic();
                    Order      o1 = ol.SelectByID(Convert.ToInt32(Request.QueryString["id"]));

                    Product p1 = pl.SelectByProductID(o1.ProductID);
                    DropDownList1.SelectedItem.Text = p1.Name;
                    QuotationLogic ql = new QuotationLogic();
                    TextBox1.Text = ql.SelectByProductID(Convert.ToInt32(DropDownList1.SelectedValue)).QuotationID.ToString();
                    TextBox2.Text = o1.Quantity.ToString();
                    TextBox3.Text = o1.Rate.ToString();
                    TextBox4.Text = o1.PODate.ToString("dd/MM/yyyy");

                    TextBox5.Text = o1.PONumber.ToString();
                    TextBox6.Text = o1.CreateDate.ToString("dd/MM/yyyy");

                    DropDownList2.SelectedItem.Text = o1.Status;
                    TextBox8.Text  = o1.StatusRemarks;
                    TextArea2.Text = o1.DeliveryAddress;
                    TextBox9.Text  = o1.DeliveryDate.ToString("dd/MM/yyyy");

                    String po    = o1.AttachPO;
                    string ticks = DateTime.Now.Ticks.ToString();
                    if (FileUpload1.HasFile)
                    {
                        FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));
                        FileUpload1.Visible   = false;
                        lnkImage1.Text        = po.Substring(25);
                        lnkImage1.NavigateUrl = po;
                    }
                    else
                    {
                        lnkImage1.Visible   = false;
                        LinkButton1.Visible = false;
                    }
                }


                else
                {
                    lnkImage1.Visible   = false;
                    LinkButton1.Visible = false;
                    QuotationLogic ql = new QuotationLogic();
                    TextBox1.Text = ql.SelectByProductID(Convert.ToInt32(DropDownList1.SelectedItem.Value)).QuotationID.ToString();
                    TextBox6.Text = DateTime.Now.ToString("dd/MM/yyyy");
                }
            }
            Label2.Visible = false;
        }
        else
        {
            Response.Redirect("Access.aspx");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        EmployeeLogic el = new EmployeeLogic();
        Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
        if (e2.Designation.Equals("COMERCIAL MANAGER") || e2.Designation.Equals("COMERCIAL EMPLOYEE") || e2.Designation.Equals("DESIGNER") || e2.Designation.Equals("PRODUCTION MANAGER") || e2.Designation.Equals("PRODUCTION EMPLOYEE"))
        {
            if (!IsPostBack)
            {

                ProductLogic pl = new ProductLogic();
                DropDownList1.DataSource = pl.SelectAll();
                DropDownList1.DataTextField = "Name";
                DropDownList1.DataValueField = "ProductID";
                DropDownList1.DataBind();

                if (Convert.ToInt32(Request.QueryString["id"]) > 0)
                {

                    OrderLogic ol = new OrderLogic();
                    Order o1 = ol.SelectByID(Convert.ToInt32(Request.QueryString["id"]));

                    Product p1 = pl.SelectByProductID(o1.ProductID);
                    DropDownList1.SelectedItem.Text = p1.Name;
                    QuotationLogic ql = new QuotationLogic();
                    TextBox1.Text = ql.SelectByProductID(Convert.ToInt32(DropDownList1.SelectedValue)).QuotationID.ToString();
                    TextBox2.Text = o1.Quantity.ToString();
                    TextBox3.Text = o1.Rate.ToString();
                    TextBox4.Text = o1.PODate.ToString("dd/MM/yyyy");

                    TextBox5.Text = o1.PONumber.ToString();
                    TextBox6.Text = o1.CreateDate.ToString("dd/MM/yyyy");

                    DropDownList2.SelectedItem.Text = o1.Status;
                    TextBox8.Text = o1.StatusRemarks;
                    TextArea2.Text = o1.DeliveryAddress;
                    TextBox9.Text = o1.DeliveryDate.ToString("dd/MM/yyyy");

                    String po = o1.AttachPO;
                    string ticks = DateTime.Now.Ticks.ToString();
                    if (FileUpload1.HasFile)
                    {
                        FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName));
                        FileUpload1.Visible = false;
                        lnkImage1.Text = po.Substring(25);
                        lnkImage1.NavigateUrl = po;
                    }
                    else
                    {
                        lnkImage1.Visible = false;
                        LinkButton1.Visible = false;

                    }


                }


                else
                {
                    lnkImage1.Visible = false;
                    LinkButton1.Visible = false;
                    QuotationLogic ql = new QuotationLogic();
                    TextBox1.Text = ql.SelectByProductID(Convert.ToInt32(DropDownList1.SelectedItem.Value)).QuotationID.ToString();
                    TextBox6.Text = DateTime.Now.ToString("dd/MM/yyyy");
                }
            }
            Label2.Visible = false;
        }
        else
        {
            Response.Redirect("Access.aspx");
        }
    }