protected void Page_Load(object sender, EventArgs e)
    {   
        EmployeeLogic el = new EmployeeLogic();
        Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"]));
       
            if (!IsPostBack)
            {
                if (e2.Designation.Equals("MANAGING DIRECTOR") || e2.Designation.Equals("CHAIRMAN") || e2.Designation.Equals("COMERCIAL MANAGER") || e2.Designation.Equals("COMERCIAL EMPLOYEE") || e2.Designation.Equals("MARKETING MANAGER") || e2.Designation.Equals("MARKETING EMPLOYEE") || e2.Designation.Equals("PRODUCTION MANAGER") || e2.Designation.Equals("PRODUCTION EMPLOYEE"))
                {
                QuotationLogic QL = new QuotationLogic();
                DataTable dt = QL.SelectAllJoined();
                Repeater1.DataSource = dt;
                Repeater1.DataBind();
                if (dt.Rows.Count == 0)
                {
                    Table1.Visible = false;
                    Label1.Visible = true;
                }
                else
                {
                    Table1.Visible = true;
                    Label1.Visible = false;
                }

                CustomerLogic cl = new CustomerLogic();
                DataTable dt1 = cl.SelectAll();
                dt1.Rows.Add(0, "All Customer", null, null, null, null, null, null, null, null, null);
                dt1.DefaultView.Sort = "CustomerID";
                DropDownList1.DataSource = dt1;
                DropDownList1.DataTextField = "Name";
                DropDownList1.DataValueField = "CustomerID";
                DropDownList1.DataBind();
                DropDownList1.SelectedItem.Text = "All Customer";

                ProductLogic pl = new ProductLogic();
                DataTable dt2 = pl.SelectAll();
                dt2.Rows.Add(0, "All Product", null, null, null, null, null, null, null, null);
                dt2.DefaultView.Sort = "ProductID";
                DropDownList2.DataSource = dt2;
                DropDownList2.DataTextField = "Name";
                DropDownList2.DataValueField = "ProductID";
                DropDownList2.DataBind();
                DropDownList2.SelectedItem.Text = "All Product";
            }
                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("MANAGING DIRECTOR") || e2.Designation.Equals("CHAIRMAN") || e2.Designation.Equals("COMERCIAL MANAGER") || e2.Designation.Equals("COMERCIAL EMPLOYEE"))
        {
            if (!IsPostBack)
            {
                ProductLogic pl = new ProductLogic();
                DropDownList1.DataSource = pl.SelectAll();
                DropDownList1.DataTextField = "Name";
                DropDownList1.DataValueField = "ProductID";
                DropDownList1.DataBind();
                QuotationLogic ql = new QuotationLogic();
                Quotation q1 = ql.SelectByID(Convert.ToInt32(Request.QueryString["id"]));

                if (q1.QuotationID > 0)
                {
                    Product p1 = pl.SelectByProductID(q1.ProductID);
                    DropDownList1.SelectedItem.Value = p1.ProductID.ToString();
                    TextBox1.Text = q1.MOQ.ToString();
                    TextBox2.Text = q1.Rate.ToString();
                    TextBox3.Text = q1.CreateDate.ToString("dd/MM/yyyy");
                    TextBox4.Text = q1.Status;
                    TextBox5.Text = q1.Remarks;
                    TextBox6.Text = q1.TermsConditions;

                }
                else
                {
                    TextBox3.Text = DateTime.Now.ToString("dd/MM/yyyy");
                }
            }
        }
        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");
        }
    }