Example #1
0
    private void SetInitialRow_ReqDetails()
    {
        try
        {
            DataTable dt = new DataTable();
            DataRow   dr;
            dt.Columns.Add("#", typeof(int));
            dt.Columns.Add("RequisitionNo", typeof(string));
            dt.Columns.Add("RemarkIND", typeof(string));
            dt.Columns.Add("RequisitionDate", typeof(string));
            dt.Columns.Add("ReqStatus", typeof(string));
            dt.Columns.Add("Location", typeof(string));
            dr = dt.NewRow();

            dr["#"]               = 0;
            dr["RequisitionNo"]   = "";
            dr["RemarkIND"]       = "";
            dr["RequisitionDate"] = DateTime.Now.ToString("dd-MMM-yyyy");
            dr["ReqStatus"]       = "";
            dr["Location"]        = "";

            dt.Rows.Add(dr);

            ViewState["CurrentTable"] = dt;
            GrdReq.DataSource         = dt;
            GrdReq.DataBind();
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }
    public void BindReportGrid(string RepCondition)
    {
        try
        {
            DataSet DsReport      = new DataSet();
            string  RepCondition1 = string.Empty;
            //if (!Convert.ToBoolean(Session["IsCentral"].ToString()))
            //{
            //    RepCondition1 = RepCondition1 + " AND D.CafeteriaId=" + Convert.ToInt32(Session["CafeteriaId"].ToString());
            //}
            DataTable dt = new DataTable();
            dt = db.Displaygrid(" select distinct project  , enquiry  , enquiry as # , status from  Conversionpo where status <>  '" + "Authorised" + "' ");
            DsReport.Tables.Add(dt);
            if (DsReport.Tables.Count > 0 && DsReport.Tables[0].Rows.Count > 0)
            {
                GrdReq.DataSource = DsReport.Tables[0];
                GrdReq.DataBind();
            }
            else
            {
                GrdReq.DataSource = null;
                GrdReq.DataBind();
                // SetInitialRow_ReqDetails();
            }


            //if (DsReport.Tables.Count > 0 && DsReport.Tables[1].Rows.Count > 0)
            //{
            //    LblGen.Text = DsReport.Tables[1].Rows[0][0].ToString();
            //    LblApprov.Text = DsReport.Tables[1].Rows[0][1].ToString();
            //    LblAutho.Text = DsReport.Tables[1].Rows[0][2].ToString();
            //}
            //else
            //{
            //    LblAutho.Text = LblApprov.Text = LblGen.Text = "0";
            //}
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }
Example #3
0
    public void BindReportGrid(string RepCondition)
    {
        try
        {
            DataSet DsReport      = new DataSet();
            string  RepCondition1 = string.Empty;
            //if (!Convert.ToBoolean(Session["IsCentral"].ToString()))
            //{
            //    RepCondition1 = RepCondition1 + " AND D.CafeteriaId=" + Convert.ToInt32(Session["CafeteriaId"].ToString());
            //}

            DsReport = Obj_ApproveRequisition.GetAllRequisition(RepCondition, RepCondition1, out StrError);
            if (DsReport.Tables.Count > 0 && DsReport.Tables[0].Rows.Count > 0)
            {
                GrdReq.DataSource = DsReport.Tables[0];
                GrdReq.DataBind();
            }
            else
            {
                GrdReq.DataSource = null;
                GrdReq.DataBind();
                SetInitialRow_ReqDetails();
            }


            if (DsReport.Tables.Count > 0 && DsReport.Tables[1].Rows.Count > 0)
            {
                LblGen.Text    = DsReport.Tables[1].Rows[0][0].ToString();
                LblApprov.Text = DsReport.Tables[1].Rows[0][1].ToString();
                LblAutho.Text  = DsReport.Tables[1].Rows[0][2].ToString();
            }
            else
            {
                LblAutho.Text = LblApprov.Text = LblGen.Text = "0";
            }
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }