Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (RequisitionControl.getRequisition(int.Parse((string)Request.QueryString["requisitionNo"])) != null)
        {
            id = Convert.ToInt32(Request.QueryString["requisitionNo"]);
            //int id = 24;

            Requisition r     = RequisitionControl.getRequisition(id);
            int         empid = Convert.ToInt32(r.RequestedBy);
            lblDate.Text   = r.RequestDate.ToString();
            lblStatus.Text = r.Status.ToString();
            if (lblStatus.Text.Equals("Approved") || lblStatus.Text.Equals("approved") || lblStatus.Text.Equals("InProgress"))
            {
                lblStatus.ForeColor = System.Drawing.Color.Green;
            }
            else if (lblStatus.Text.Equals("Pending"))
            {
                lblStatus.ForeColor = System.Drawing.Color.Blue;
            }
            else if (lblStatus.Text.Equals("Priority"))
            {
                lblStatus.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                lblStatus.ForeColor = System.Drawing.Color.Black;
            }

            if (!IsPostBack)
            {
                showAllItems();
                if (r.Status != "Pending")
                {
                    btnCancel.Visible = false;
                    btnAdd.Visible    = false;
                    btnUpdate.Visible = false;

                    if (!String.IsNullOrWhiteSpace(r.Remarks))
                    {
                        lblRemarks.Text = r.Remarks.ToString();
                    }
                }

                ddlItem.DataSource     = RequisitionControl.getItem();
                ddlItem.DataTextField  = "Description";
                ddlItem.DataValueField = "ItemCode";
                ddlItem.DataBind();
            }

            code        = ddlItem.SelectedValue.ToString();
            lblUom.Text = RequisitionControl.getUOM(code);
        }
        else
        {
            Response.Redirect(LoginController.RequisitionListDepEmpURI);
        }
    }