protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User_ID"] != null && Session["Customer_ID"] != null)
        {
            if (!IsPostBack)
            {
                try
                {
                    if (Request.QueryString["gaugeId"] != null)
                    {
                        string   getIds     = Request.QueryString["gaugeId"].ToString();
                        string[] str        = getIds.Split(',');
                        int      gaugeId    = Convert.ToInt32(str[0].ToString());
                        int      customerId = Convert.ToInt32(str[1].ToString());

                        DataTable dat         = new DataTable();
                        string    stprocedure = "spGaugeDetailsReport";
                        DataSet   ds          = q.ProcdureWith3Param(stprocedure, 1, customerId, gaugeId);



                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            ReportViewer1.Reset();

                            ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/GaugeDetailsReport.rdlc");
                            ReportViewer1.ProcessingMode         = ProcessingMode.Local;
                            ReportDataSource rep = new ReportDataSource("DataSet1", ds.Tables[0]);
                            ReportViewer1.LocalReport.DataSources.Add(rep);
                            ReportViewer1.LocalReport.Refresh();
                        }
                        DataTable dtcust = new DataTable();
                        dtcust = g.GetCustomerDetails(Convert.ToInt32(Session["Customer_ID"]));
                        ReportDataSource repcust = new ReportDataSource("DataSetcust", dtcust);
                        ReportViewer1.LocalReport.DataSources.Add(repcust);
                        ReportViewer1.LocalReport.EnableExternalImages = true;
                    }
                }
                catch (Exception ex)
                {
                    g.ShowMessage(this.Page, ex.Message);
                }
            }
        }

        else
        {
            Response.Redirect("Login.aspx");
        }
    }
Esempio n. 2
0
    private void bindTranHistoryGrd()
    {
        try
        {
            grdCalibTran.DataSource = null;
            grdCalibTran.DataBind();
            string searchValue = txtsearch.Text.Trim();
            searchValue = Regex.Replace(searchValue, @"\s+", " ");
            bool   Status      = g.CheckSuperAdmin(Convert.ToInt32(Session["User_ID"]));
            string stprocedure = "spCalibTransactionDt";
            // Check super Admin condition
            #region supper Admin wise
            if (Status == true)
            {
                int customerId;
                if (ddlcust.SelectedIndex == 0)
                {
                    if (ddtRejeOrNotInUsed.SelectedIndex == 0)
                    {
                        DataSet ds = q.ProcdureWith3Param(stprocedure, 9, 0, "");
                        grdCalibTran.DataSource = ds.Tables[0];
                        grdCalibTran.DataBind();
                    }
                    else if (ddtRejeOrNotInUsed.SelectedIndex == 1 && txtsearch.Text == "")
                    {
                        DataSet ds = q.ProcdureWith3Param(stprocedure, 10, 0, "");
                        grdCalibTran.DataSource = ds.Tables[0];
                        grdCalibTran.DataBind();
                    }
                    else if (ddtRejeOrNotInUsed.SelectedIndex == 2 && txtsearch.Text == "")
                    {
                        DataSet ds = q.ProcdureWith3Param(stprocedure, 11, 0, "");
                        grdCalibTran.DataSource = ds.Tables[0];
                        grdCalibTran.DataBind();
                    }
                    else if (ddtRejeOrNotInUsed.SelectedIndex == 1 && txtsearch.Text != "")
                    {
                        DataSet ds = q.ProcdureWith3Param(stprocedure, 16, 0, searchValue);
                        grdCalibTran.DataSource = ds.Tables[0];
                        grdCalibTran.DataBind();
                    }
                    else if (ddtRejeOrNotInUsed.SelectedIndex == 2 && txtsearch.Text != "")
                    {
                        DataSet ds = q.ProcdureWith3Param(stprocedure, 17, 0, searchValue);
                        grdCalibTran.DataSource = ds.Tables[0];
                        grdCalibTran.DataBind();
                    }
                }
                if (ddlcust.SelectedIndex > 0)
                {
                    if (ddtRejeOrNotInUsed.SelectedIndex == 0)
                    {
                        customerId = Convert.ToInt32(ddlcust.SelectedValue);
                        DataSet ds = q.ProcdureWith3Param(stprocedure, 7, customerId, "");
                        grdCalibTran.DataSource = ds.Tables[0];
                        grdCalibTran.DataBind();
                    }
                    else if (ddtRejeOrNotInUsed.SelectedIndex == 1 && txtsearch.Text == "")
                    {
                        customerId = Convert.ToInt32(ddlcust.SelectedValue);
                        DataSet ds = q.ProcdureWith3Param(stprocedure, 12, customerId, "");
                        grdCalibTran.DataSource = ds.Tables[0];
                        grdCalibTran.DataBind();
                    }
                    else if (ddtRejeOrNotInUsed.SelectedIndex == 2 && txtsearch.Text == "")
                    {
                        customerId = Convert.ToInt32(ddlcust.SelectedValue);
                        DataSet ds = q.ProcdureWith3Param(stprocedure, 13, customerId, "");
                        grdCalibTran.DataSource = ds.Tables[0];
                        grdCalibTran.DataBind();
                    }
                    else if (ddtRejeOrNotInUsed.SelectedIndex == 0 && txtsearch.Text != "")
                    {
                        customerId = Convert.ToInt32(ddlcust.SelectedValue);
                        DataSet ds = q.ProcdureWith3Param(stprocedure, 8, customerId, searchValue);
                        grdCalibTran.DataSource = ds.Tables[0];
                        grdCalibTran.DataBind();
                    }
                    else if (ddtRejeOrNotInUsed.SelectedIndex == 1 && txtsearch.Text != "")
                    {
                        customerId = Convert.ToInt32(ddlcust.SelectedValue);
                        DataSet ds = q.ProcdureWith3Param(stprocedure, 14, customerId, searchValue);
                        grdCalibTran.DataSource = ds.Tables[0];
                        grdCalibTran.DataBind();
                    }
                    else if (ddtRejeOrNotInUsed.SelectedIndex == 2 && txtsearch.Text != "")
                    {
                        customerId = Convert.ToInt32(ddlcust.SelectedValue);
                        DataSet ds = q.ProcdureWith3Param(stprocedure, 15, customerId, searchValue);
                        grdCalibTran.DataSource = ds.Tables[0];
                        grdCalibTran.DataBind();
                    }
                }
            }
            #endregion
            #region employee wise
            else
            {
                int customerID = Convert.ToInt32(Session["Customer_ID"]);
                if (ddtRejeOrNotInUsed.SelectedIndex == 0 && txtsearch.Text == "")
                {
                    DataSet ds = q.ProcdureWith3Param(stprocedure, 7, customerID, "");
                    grdCalibTran.DataSource = ds.Tables[0];
                    grdCalibTran.DataBind();
                }
                else if (ddtRejeOrNotInUsed.SelectedIndex == 1 && txtsearch.Text == "")
                {
                    DataSet ds = q.ProcdureWith3Param(stprocedure, 12, customerID, "");
                    grdCalibTran.DataSource = ds.Tables[0];
                    grdCalibTran.DataBind();
                }
                else if (ddtRejeOrNotInUsed.SelectedIndex == 2 && txtsearch.Text == "")
                {
                    DataSet ds = q.ProcdureWith3Param(stprocedure, 13, customerID, "");
                    grdCalibTran.DataSource = ds.Tables[0];
                    grdCalibTran.DataBind();
                }
                else if (ddtRejeOrNotInUsed.SelectedIndex == 0 && txtsearch.Text != "")
                {
                    DataSet ds = q.ProcdureWith3Param(stprocedure, 8, customerID, searchValue);
                    grdCalibTran.DataSource = ds.Tables[0];
                    grdCalibTran.DataBind();
                }
                else if (ddtRejeOrNotInUsed.SelectedIndex == 1 && txtsearch.Text != "")
                {
                    DataSet ds = q.ProcdureWith3Param(stprocedure, 14, customerID, searchValue);
                    grdCalibTran.DataSource = ds.Tables[0];
                    grdCalibTran.DataBind();
                }
                else if (ddtRejeOrNotInUsed.SelectedIndex == 2 && txtsearch.Text != "")
                {
                    DataSet ds = q.ProcdureWith3Param(stprocedure, 15, customerID, searchValue);
                    grdCalibTran.DataSource = ds.Tables[0];
                    grdCalibTran.DataBind();
                }
            }
            #endregion

            checkAuthority();
        }
        catch (Exception ex)
        {
            g.ShowMessage(this.Page, ex.Message);
        }
    }
Esempio n. 3
0
 protected void btnEditGauge_Click(object sender, EventArgs e)
 {
     try
     {
         LinkButton lnk = (LinkButton)sender;
         lblGaugeId.Text = lnk.CommandArgument;
         string    stprocedure = "spGaugeDetailsReport";
         DataSet   ds          = q.ProcdureWith3Param(stprocedure, 2, 0, Convert.ToInt32(lblGaugeId.Text));
         DataTable dtgauge     = ds.Tables[0];
         txtGaugeId.Text            = dtgauge.Rows[0]["gauge_id"].ToString();
         txtGaugeName.Text          = dtgauge.Rows[0]["gauge_name"].ToString();
         txtGaugeSrNo.Text          = dtgauge.Rows[0]["gauge_sr_no"].ToString();
         txtManufactureId.Text      = dtgauge.Rows[0]["gauge_Manufature_Id"].ToString();
         txtmake.Text               = dtgauge.Rows[0]["make"].ToString();
         ddlgaugeType.SelectedValue = dtgauge.Rows[0]["gauge_type_master_id"].ToString();
         if (dtgauge.Rows[0]["gauge_type"].ToString() == "ATTRIBUTE")
         {
             ddlType.SelectedIndex               = 1;
             divSize.Visible                     = true;
             divRange.Visible                    = false;
             divLeastCount.Visible               = false;
             divResolution.Visible               = false;
             divGoandNoGoPlus.Visible            = true;
             divGoandNoGoTolleranceminus.Visible = true;
             divPermisable1.Visible              = false;
             divPermisable2.Visible              = false;
             divGoWereLimit.Visible              = true;
             txtSize.Text = dtgauge.Rows[0]["size_range"].ToString();
             string tolType = dtgauge.Rows[0]["tolerance_type"].ToString();
             if (tolType == "Plug Tolerance")
             {
                 ddlTolerance.SelectedIndex = 1;
             }
             else if (tolType == "Snap Tolerance")
             {
                 ddlTolerance.SelectedIndex = 2;
             }
             else
             {
                 ddlTolerance.SelectedIndex = 0;
             }
             txtSizeMax.Text        = dtgauge.Rows[0]["size2"].ToString();
             txtToleranceRange.Text = dtgauge.Rows[0]["tolerance_desc"].ToString();
             hftoleranceId.Value    = dtgauge.Rows[0]["tolerance_id"].ToString();
             string grade = dtgauge.Rows[0]["tolerance_grd"].ToString();
             grade         = grade.Replace("grd_", "grd");
             hfGrade.Value = grade;
         }
         else if (dtgauge.Rows[0]["gauge_type"].ToString() == "VARIABLE")
         {
             ddlType.SelectedIndex               = 2;
             divSize.Visible                     = false;
             divRange.Visible                    = true;
             divLeastCount.Visible               = true;
             divResolution.Visible               = true;
             divGoandNoGoPlus.Visible            = false;
             divGoandNoGoTolleranceminus.Visible = false;
             divPermisable1.Visible              = true;
             divPermisable2.Visible              = true;
             divGoWereLimit.Visible              = false;
             txtRange.Text = dtgauge.Rows[0]["size_range"].ToString();
         }
         txtGoWereLimit.Text         = dtgauge.Rows[0]["go_were_limit"].ToString();
         txtGoTollerancePlus.Text    = dtgauge.Rows[0]["go_tollerance_plus"].ToString();
         txtGoTolleranceMinus.Text   = dtgauge.Rows[0]["go_tollerance_minus"].ToString();
         txtNoGoTollerancePlus.Text  = dtgauge.Rows[0]["no_go_tollerance_plus"].ToString();
         txtNoGoTolleranceMinus.Text = dtgauge.Rows[0]["no_go_tollerance_minus"].ToString();
         txtLeastCount.Text          = dtgauge.Rows[0]["least_count"].ToString();
         txtResolution.Text          = dtgauge.Rows[0]["resolution"].ToString();
         txtPermisableError1.Text    = dtgauge.Rows[0]["permisable_error1"].ToString();
         txtPermisableError2.Text    = dtgauge.Rows[0]["permisable_error2"].ToString();
         MultiView1.ActiveViewIndex  = 1;
         btnSaveGauge.Text           = "Update";
     }
     catch (Exception ex)
     {
         g.ShowMessage(this.Page, ex.Message);
     }
 }