Beispiel #1
0
    protected void ddlRegions_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlRegions.SelectedValue != "0")
        {
            lblFeedback.Text = string.Empty;

            DataTable dt1 = new JpmmsClasses.BL.MainStreet().GetStreetsIRI();
            RadioButtonList1.Items.Clear();
            RadioButtonList1.Items.AddRange(new SharedClass().CreateRadioBtnSurveys(dt1.Rows[ddlRegions.SelectedIndex - 1][3].ToString()));
            RadioButtonList1.SelectedValue = dt1.Rows[ddlRegions.SelectedIndex - 1][2].ToString();
            RadioButtonList1.DataBind();

            gvRegionSamplesIRI.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsSampleDublicateIRI(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
            gvRegionSamplesIRI.DataBind();

            if (gvRegionSamplesIRI.Rows.Count > 0)
            {
                lblFeedback0.Text = string.Empty;
                DataTable  dt = new JpmmsClasses.BL.MainStreet().GetStreetsInfo(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
                DataColumn d  = new DataColumn("DublicateIRI");
                d.DefaultValue = gvRegionSamplesIRI.Rows.Count;
                dt.Columns.Add(d);
                gvRegionIRI.DataSource = dt;
                gvRegionIRI.DataBind();
            }
            else
            {
                lblFeedback0.Text      = Feedback.NoData();
                gvRegionIRI.DataSource = null;
                gvRegionIRI.DataBind();
            }
        }
    }
Beispiel #2
0
    protected void ddlMainStreets_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        DataTable dtx = new JpmmsClasses.BL.MainStreet().GetStreetsAssets();

        RadioButtonList1.Items.Clear();
        RadioButtonList1.Items.AddRange(new SharedClass().CreateRadioBtnSurveys(dtx.Rows[ddlMainStreets.SelectedIndex - 1][3].ToString()));
        RadioButtonList1.SelectedValue = dtx.Rows[ddlMainStreets.SelectedIndex - 1][2].ToString();
        RadioButtonList1.DataBind();
    }
Beispiel #3
0
    protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlRegions.SelectedValue != "0")
        {
            gvRegionIRI.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsInfo(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
            gvRegionIRI.DataBind();

            gvRegionSections.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsInfo((int.Parse(ddlRegions.SelectedValue)));
            gvRegionSections.DataBind();

            DataTable dtIRI     = new JpmmsClasses.BL.MainStreet().GetStreetsSections(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
            DataTable dtSection = new JpmmsClasses.BL.MainStreet().GetStreetsSections(int.Parse(ddlRegions.SelectedValue));
            gvRegionSamplesIRI.DataSource = dtIRI;
            gvRegionSamplesIRI.DataBind();
            for (int i = 0; i < gvRegionSamplesIRI.Rows.Count; i++)
            {
                if (gvRegionSamplesIRI.Rows[i].RowType == DataControlRowType.DataRow)
                {
                    if (gvRegionSamplesIRI.Rows[i].Cells[1].Text != gvRegionSamplesIRI.Rows[i].Cells[4].Text)
                    {
                        if (gvRegionSamplesIRI.Rows[i].Cells[1].Text == "&nbsp;")
                        {
                            gvRegionSamplesIRI.Rows[i].Cells[1].Text = "0";
                        }
                        if (gvRegionSamplesIRI.Rows[i].Cells[4].Text == "&nbsp;")
                        {
                            gvRegionSamplesIRI.Rows[i].Cells[4].Text = "0";
                        }

                        int value = int.Parse(gvRegionSamplesIRI.Rows[i].Cells[4].Text) - int.Parse(gvRegionSamplesIRI.Rows[i].Cells[1].Text);
                        gvRegionSamplesIRI.Rows[i].Cells[4].Text = value.ToString();
                        if (value > 0)
                        {
                            gvRegionSamplesIRI.Rows[i].BackColor = System.Drawing.Color.Green;
                        }
                        else
                        {
                            gvRegionSamplesIRI.Rows[i].BackColor = System.Drawing.Color.Yellow;
                        }
                    }
                    if (gvRegionSamplesIRI.Rows[i].Cells[1].Text == gvRegionSamplesIRI.Rows[i].Cells[4].Text && (gvRegionSamplesIRI.Rows[i].BackColor != System.Drawing.Color.Green || gvRegionSamplesIRI.Rows[i].BackColor != System.Drawing.Color.Yellow))
                    {
                        gvRegionSamplesIRI.Rows[i].Cells[4].Text = string.Empty;
                    }
                }
            }

            gvRegionSamplesSECTION.DataSource = dtSection;
            gvRegionSamplesSECTION.DataBind();

            ViewState["gvRegionSamplesSECTION"] = gvRegionSamplesSECTION.DataSource;
            ViewState["gvRegionSamplesIRI"]     = gvRegionSamplesIRI.DataSource;
            ViewState["sortdrIRI"] = "Asc";
            ViewState["sortdr"]    = "Asc";
        }
    }
Beispiel #4
0
    private void CalculateMainStreetsMinWithDate()
    {
        bool result = true;
        MaintenanceDecisions maintD = new MaintenanceDecisions();
        string user = Session["UserName"].ToString();

        DataTable dt = new JpmmsClasses.BL.MainStreet().FinshedMFVMaintenanceWithDate("02/01/2020", "3");

        foreach (DataRow dr in dt.Rows)
        {
            result &= maintD.PrepareMainStreetSectionsMaintenanceDecisions(int.Parse(dr["STREET_ID"].ToString()), user, true);
        }

        dt = new DataTable();
        ThreadResults.Add(RequestID, dt);
    }
Beispiel #5
0
    private void CalculateMainStreetsMin()
    {
        bool result = true;
        MaintenanceDecisions maintD = new MaintenanceDecisions();
        string user = Session["UserName"].ToString();

        DataTable dt = new JpmmsClasses.BL.MainStreet().FinshedRrturnToMFVMaintenance();//.CustomMunicpilityMaintenance();

        foreach (DataRow dr in dt.Rows)
        {
            result &= maintD.PrepareMainStreetSectionsMaintenanceDecisions(int.Parse(dr["STREET_ID"].ToString()), user, false);
        }

        dt = new DataTable();
        ThreadResults.Add(RequestID, dt);
    }
Beispiel #6
0
    private void CalculateMainStreetsUdi()
    {
        bool        result      = true;
        SectionsUDI udiSections = new SectionsUDI();
        string      user        = Session["UserName"].ToString();

        DataTable dt = new JpmmsClasses.BL.MainStreet().FinshedRrturnToMFVUDI();//.CustomMunicpilityUdi();//

        foreach (DataRow dr in dt.Rows)
        {
            result &= udiSections.CalculateMainStreetSectionsUDI(int.Parse(dr["STREET_ID"].ToString()), user, false);
        }

        dt = new DataTable();
        ThreadResults.Add(RequestID, dt);
    }
Beispiel #7
0
    protected void RadioBtnListSYS_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlRegions.SelectedValue != "0")
        {
            System.Data.DataTable dt = new JpmmsClasses.BL.MainStreet().GetStreetsIRI();
            RadioButtonList1.Items.Clear();
            RadioButtonList1.Items.AddRange(new SharedClass().CreateRadioBtnSurveys(dt.Rows[ddlRegions.SelectedIndex - 1][3].ToString()));
            RadioButtonList1.SelectedValue = dt.Rows[ddlRegions.SelectedIndex - 1][2].ToString();
            RadioButtonList1.DataBind();

            if (RadioBtnListSYS.SelectedValue == "1")
            {
                gvERorrLanes.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsDublicateLanesIRI(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
                gvERorrLanes.DataBind();

                if (gvERorrLanes.Rows.Count > 0)
                {
                    lblFeedback.Text = string.Empty;
                }
                else
                {
                    lblFeedback.Text = Feedback.NoData();
                }
            }
            else
            {
                gvERorrLanes.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsDublicateLanes(ddlRegions.SelectedItem.Text);
                gvERorrLanes.DataBind();

                if (gvERorrLanes.Rows.Count > 0)
                {
                    lblFeedback.Text = string.Empty;
                }
                else
                {
                    lblFeedback.Text = Feedback.NoData();
                }
            }
        }
    }
    protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        gvRegionIRI.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsInfoSKID(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
        gvRegionIRI.DataBind();

        gvRegionSections.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsInfo(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
        gvRegionSections.DataBind();

        DataTable dtIRI     = new JpmmsClasses.BL.MainStreet().GetStreetsSectionsLengthSKID(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
        DataTable dtSection = new JpmmsClasses.BL.MainStreet().GetStreetsSectionsLength(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);

        gvRegionSamplesIRI.DataSource = dtIRI;
        gvRegionSamplesIRI.DataBind();
        gvRegionSamplesSECTION.DataSource = dtSection;
        gvRegionSamplesSECTION.DataBind();

        try
        {
            dtSection.PrimaryKey = new DataColumn[] {
                dtSection.Columns["SECTION_NO"],
                dtSection.Columns["LANE"]
            };


            for (int i = 0; i < gvRegionSamplesIRI.Rows.Count; i++)
            {
                if (gvRegionSamplesIRI.Rows[i].RowType == DataControlRowType.DataRow)
                {
                    if (!dtSection.Rows.Contains(new object[] { gvRegionSamplesIRI.Rows[i].Cells[0].Text, gvRegionSamplesIRI.Rows[i].Cells[1].Text }))
                    {
                        gvRegionSamplesIRI.Rows[i].BackColor     = System.Drawing.Color.YellowGreen;
                        gvRegionSamplesIRI.Rows[i].Cells[3].Text = "غير موجود IRI";
                    }
                }
            }
            dtIRI.PrimaryKey = new DataColumn[] {
                dtIRI.Columns["SECTION_NO"],
                dtIRI.Columns["LANE"]
            };


            for (int i = 0; i < gvRegionSamplesSECTION.Rows.Count; i++)
            {
                if (gvRegionSamplesSECTION.Rows[i].RowType == DataControlRowType.DataRow)
                {
                    if (!dtIRI.Rows.Contains(new object[] { gvRegionSamplesSECTION.Rows[i].Cells[0].Text, gvRegionSamplesSECTION.Rows[i].Cells[1].Text }))
                    {
                        gvRegionSamplesSECTION.Rows[i].BackColor     = System.Drawing.Color.LimeGreen;
                        gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "غير موجود SKID";
                    }
                }
            }
        }
        catch (Exception ex)
        {
            lblFeedback0.Text = string.Empty;
            if (ex.Message == "Column 'SECTION_NO' has null values in it.")
            {
                lblFeedback0.Text = "البيانات من النظام يوجد بها مقطع ليس له رقم";

                for (int i = 0; i < dtSection.Rows.Count; i++)
                {
                    if (dtSection.Rows[i][1].ToString() == string.Empty)
                    {
                        lblFeedback.Text += "LANE_ID : " + dtSection.Rows[i][0].ToString();
                    }
                }
                for (int i = 0; i < dtIRI.Rows.Count; i++)
                {
                    if (dtIRI.Rows[i][0].ToString() == string.Empty)
                    {
                        lblFeedback.Text += " LANE  : " + dtIRI.Rows[i][1].ToString();
                        lblFeedback0.Text = "البيانات من المعدة يوجد بها مقطع ليس له رقم";
                    }
                }
            }
            else if (ex.Message == "These columns don't currently have unique values.")
            {
                DataTable dtIRIErorr = new JpmmsClasses.BL.MainStreet().GetStreetsSectionsLengtErorr((int.Parse(ddlRegions.SelectedValue)));
                if (dtIRIErorr.Rows.Count > 0)
                {
                    for (int i = 0; i < gvRegionSamplesSECTION.Rows.Count; i++)
                    {
                        if (gvRegionSamplesSECTION.Rows[i].Cells[0].Text == dtIRIErorr.Rows[0][0].ToString() &&
                            gvRegionSamplesSECTION.Rows[i].Cells[1].Text == dtIRIErorr.Rows[0][1].ToString())
                        {
                            gvRegionSamplesSECTION.Rows[i].BackColor = System.Drawing.Color.Red;
                        }
                    }
                }
                DataTable dtdublicate = new JpmmsClasses.BL.MainStreet().GetStreetsDublicateLanesSKID(ddlRegions.SelectedItem.Text);
                if (dtdublicate.Rows.Count > 0)
                {
                    for (int i = 0; i < gvRegionSamplesIRI.Rows.Count; i++)
                    {
                        for (int j = 0; j < dtdublicate.Rows.Count; j++)
                        {
                            if (gvRegionSamplesIRI.Rows[i].Cells[0].Text == dtdublicate.Rows[j][2].ToString() &&
                                gvRegionSamplesIRI.Rows[i].Cells[1].Text == dtdublicate.Rows[j][3].ToString())
                            {
                                if (gvRegionSamplesIRI.Rows[i].Cells[3].Text == string.Empty)
                                {
                                    gvRegionSamplesIRI.Rows[i].BackColor     = System.Drawing.Color.Red;
                                    gvRegionSamplesIRI.Rows[i].Cells[3].Text = "  مكرر  ";
                                }
                                else
                                {
                                    gvRegionSamplesIRI.Rows[i].BackColor      = System.Drawing.Color.Salmon;
                                    gvRegionSamplesIRI.Rows[i].Cells[3].Text += "  ومكرر  ";
                                }
                            }
                        }
                    }
                }
                lblFeedback.Text = "البيانات من المعدة يوجد بها تكرار";
            }
            else
            {
                lblFeedback.Text = ex.Message;
            }
            lblFeedback.Focus();
        }
    }
Beispiel #9
0
    protected void ddlRegions_SelectedIndexChanged(object sender, EventArgs e)
    {
        System.Data.DataTable dt = new JpmmsClasses.BL.MainStreet().GetStreetsGPR();
        RadioButtonList1.Items.Clear();
        RadioButtonList1.Items.AddRange(new SharedClass().CreateRadioBtnSurveys(dt.Rows[ddlRegions.SelectedIndex - 1][3].ToString()));
        RadioButtonList1.SelectedValue = dt.Rows[ddlRegions.SelectedIndex - 1][2].ToString();
        RadioButtonList1.DataBind();
        if (dt.Rows[ddlRegions.SelectedIndex - 1][3].ToString() == "1")
        {
            RadioButtonList1.Enabled = false;
        }
        else
        {
            RadioButtonList1.Enabled = true;
        }
        gvRegionIRI.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsInfoGPR(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
        gvRegionIRI.DataBind();

        gvRegionSections.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsInfo(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
        gvRegionSections.DataBind();

        DataTable dtIRI     = new JpmmsClasses.BL.MainStreet().GetStreetsSectionsGPR(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
        DataTable dtSection = new JpmmsClasses.BL.MainStreet().GetStreetsSections(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);

        gvRegionSamplesIRI.DataSource = dtIRI;
        gvRegionSamplesIRI.DataBind();
        for (int i = 0; i < gvRegionSamplesIRI.Rows.Count; i++)
        {
            if (gvRegionSamplesIRI.Rows[i].RowType == DataControlRowType.DataRow)
            {
                if (gvRegionSamplesIRI.Rows[i].Cells[1].Text != gvRegionSamplesIRI.Rows[i].Cells[4].Text)
                {
                    if (gvRegionSamplesIRI.Rows[i].Cells[1].Text == "&nbsp;")
                    {
                        gvRegionSamplesIRI.Rows[i].Cells[1].Text = "0";
                    }
                    if (gvRegionSamplesIRI.Rows[i].Cells[4].Text == "&nbsp;")
                    {
                        gvRegionSamplesIRI.Rows[i].Cells[4].Text = "0";
                    }

                    int value = int.Parse(gvRegionSamplesIRI.Rows[i].Cells[4].Text) - int.Parse(gvRegionSamplesIRI.Rows[i].Cells[1].Text);
                    gvRegionSamplesIRI.Rows[i].Cells[4].Text = value.ToString();
                    if (value > 0)
                    {
                        gvRegionSamplesIRI.Rows[i].BackColor = System.Drawing.Color.Green;
                    }
                    else
                    {
                        gvRegionSamplesIRI.Rows[i].BackColor = System.Drawing.Color.Yellow;
                    }
                }
                if (gvRegionSamplesIRI.Rows[i].Cells[1].Text == gvRegionSamplesIRI.Rows[i].Cells[4].Text && (gvRegionSamplesIRI.Rows[i].BackColor != System.Drawing.Color.Green || gvRegionSamplesIRI.Rows[i].BackColor != System.Drawing.Color.Yellow))
                {
                    gvRegionSamplesIRI.Rows[i].Cells[4].Text = string.Empty;
                }
            }
        }

        gvRegionSamplesSECTION.DataSource = dtSection;
        gvRegionSamplesSECTION.DataBind();

        ViewState["gvRegionSamplesSECTION"] = gvRegionSamplesSECTION.DataSource;
        ViewState["gvRegionSamplesIRI"]     = gvRegionSamplesIRI.DataSource;
        ViewState["sortdrIRI"] = "Asc";
        ViewState["sortdr"]    = "Asc";
    }
Beispiel #10
0
 protected void gvRegionSamplesSECTION_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
 {
     if (Session["UserID"].ToString() == "55" || Session["UserID"].ToString() == "49" || Session["UserID"].ToString() == "48")
     {
         if (new JpmmsClasses.BL.MainStreet().DeleteCleanDDF(gvRegionSamplesSECTION.Rows[e.NewSelectedIndex].Cells[0].Text, gvRegionSamplesSECTION.Rows[e.NewSelectedIndex].Cells[1].Text, RadioButtonList1.SelectedValue))
         {
             lblFeedback.Text = Feedback.UpdateSuccessfull();
             DataTable dtSection = new JpmmsClasses.BL.MainStreet().GetStreetsSectionsLengthDDFCLEAN(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
             dtSection.PrimaryKey = new DataColumn[] {
                 dtSection.Columns["SECTION_NO"],
                 dtSection.Columns["LANE"]
             };
             gvRegionSamplesSECTION.DataSource = dtSection;
             gvRegionSamplesSECTION.DataBind();
             for (int i = 0; i < gvRegionSamplesSECTION.Rows.Count; i++)
             {
                 if (gvRegionSamplesSECTION.Rows[i].RowType == DataControlRowType.DataRow)
                 {
                     if (gvRegionSamplesSECTION.Rows[i].Cells[2].Text != "0")
                     {
                         gvRegionSamplesSECTION.Rows[i].Cells[4].Visible = false;
                     }
                     else
                     {
                         gvRegionSamplesSECTION.Rows[i].BackColor     = System.Drawing.Color.LimeGreen;
                         gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "تم اضافة نظيف";
                         gvRegionSamplesSECTION.Rows[i].Cells[2].Text = string.Empty;
                     }
                 }
             }
             for (int i = 0; i < gvRegionSamplesIRI.Rows.Count; i++)
             {
                 if (gvRegionSamplesIRI.Rows[i].RowType == DataControlRowType.DataRow)
                 {
                     if (!dtSection.Rows.Contains(new object[] { gvRegionSamplesIRI.Rows[i].Cells[0].Text, gvRegionSamplesIRI.Rows[i].Cells[1].Text }))
                     {
                         gvRegionSamplesIRI.Rows[i].BackColor        = System.Drawing.Color.YellowGreen;
                         gvRegionSamplesIRI.Rows[i].Cells[3].Text    = "غير موجود بــ DDF";
                         gvRegionSamplesIRI.Rows[i].Cells[4].Visible = true;
                     }
                     else
                     {
                         gvRegionSamplesIRI.Rows[i].Cells[4].Visible = false;
                     }
                 }
             }
             gvRegionSections.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsInfoDDF(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
             gvRegionSections.DataBind();
             e.Cancel = true;
         }
         else
         {
             e.Cancel         = true;
             lblFeedback.Text = Feedback.UpdateUNSuccessfull();
         }
     }
     else
     {
         e.Cancel         = true;
         lblFeedback.Text = Feedback.NoPermissions();
     }
 }
Beispiel #11
0
    protected void ddlRegions_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlRegions.SelectedValue != "0")
        {
            lblFeedback0.Text = string.Empty;
            lblFeedback.Text  = string.Empty;

            DataTable dt = new JpmmsClasses.BL.MainStreet().GetStreetsDDF();
            RadioButtonList1.Items.Clear();
            RadioButtonList1.Items.Add(new SharedClass().CreateRadioBtnMaxSurveys(dt.Rows[ddlRegions.SelectedIndex - 1][2].ToString()));
            RadioButtonList1.SelectedValue = dt.Rows[ddlRegions.SelectedIndex - 1][2].ToString();
            RadioButtonList1.DataBind();

            gvRegionIRI.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsInfo(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
            gvRegionIRI.DataBind();

            gvRegionSections.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsInfoDDF(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
            gvRegionSections.DataBind();

            DataTable dtIRI     = new JpmmsClasses.BL.MainStreet().GetStreetsSectionsLength(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
            DataTable dtSection = new JpmmsClasses.BL.MainStreet().GetStreetsSectionsLengthDDFCLEAN(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);

            gvRegionSamplesIRI.DataSource = dtIRI;
            gvRegionSamplesIRI.DataBind();
            gvRegionSamplesSECTION.DataSource = dtSection;
            gvRegionSamplesSECTION.DataBind();

            try
            {
                dtSection.PrimaryKey = new DataColumn[] {
                    dtSection.Columns["SECTION_NO"],
                    dtSection.Columns["LANE"]
                };


                for (int i = 0; i < gvRegionSamplesIRI.Rows.Count; i++)
                {
                    if (gvRegionSamplesIRI.Rows[i].RowType == DataControlRowType.DataRow)
                    {
                        if (!dtSection.Rows.Contains(new object[] { gvRegionSamplesIRI.Rows[i].Cells[0].Text, gvRegionSamplesIRI.Rows[i].Cells[1].Text }))
                        {
                            gvRegionSamplesIRI.Rows[i].BackColor     = System.Drawing.Color.YellowGreen;
                            gvRegionSamplesIRI.Rows[i].Cells[3].Text = "غير موجود بــ DDF";
                        }
                        else
                        {
                            gvRegionSamplesIRI.Rows[i].Cells[4].Visible = false;
                        }
                    }
                }
                dtIRI.PrimaryKey = new DataColumn[] {
                    dtIRI.Columns["SECTION_NO"],
                    dtIRI.Columns["LANE"]
                };


                for (int i = 0; i < gvRegionSamplesSECTION.Rows.Count; i++)
                {
                    if (gvRegionSamplesSECTION.Rows[i].RowType == DataControlRowType.DataRow)
                    {
                        if (!dtIRI.Rows.Contains(new object[] { gvRegionSamplesSECTION.Rows[i].Cells[0].Text, gvRegionSamplesSECTION.Rows[i].Cells[1].Text }))
                        {
                            gvRegionSamplesSECTION.Rows[i].BackColor     = System.Drawing.Color.LimeGreen;
                            gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "غير موجود بــ IRI";
                        }
                        if (gvRegionSamplesSECTION.Rows[i].Cells[2].Text != "0")
                        {
                            gvRegionSamplesSECTION.Rows[i].Cells[4].Visible = false;
                        }
                        else
                        {
                            gvRegionSamplesSECTION.Rows[i].BackColor     = System.Drawing.Color.LimeGreen;
                            gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "تم اضافة نظيف";
                            gvRegionSamplesSECTION.Rows[i].Cells[2].Text = string.Empty;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                lblFeedback0.Text = string.Empty;
                if (ex.Message == "Column 'SECTION_NO' has null values in it.")
                {
                    lblFeedback0.Text = "البيانات من النظام يوجد بها مقطع ليس له رقم";
                    for (int i = 0; i < dtSection.Rows.Count; i++)
                    {
                        if (dtSection.Rows[i][1].ToString() == string.Empty)
                        {
                            lblFeedback.Text += "LANE_ID : " + dtSection.Rows[i][0].ToString();
                        }
                    }
                }
                else if (ex.Message == "These columns don't currently have unique values.")
                {
                    DataTable dtIRIErorr = new JpmmsClasses.BL.MainStreet().GetStreetsSectionsLengtErorr((int.Parse(ddlRegions.SelectedValue)));
                    if (dtIRIErorr.Rows.Count > 0)
                    {
                        for (int i = 0; i < gvRegionSamplesSECTION.Rows.Count; i++)
                        {
                            if (gvRegionSamplesSECTION.Rows[i].Cells[0].Text == dtIRIErorr.Rows[0][0].ToString() &&
                                gvRegionSamplesSECTION.Rows[i].Cells[1].Text == dtIRIErorr.Rows[0][1].ToString())
                            {
                                gvRegionSamplesSECTION.Rows[i].BackColor = System.Drawing.Color.Red;
                            }
                        }
                        lblFeedback.Text = "البيانات من النظام يوجد بها تكرار";
                    }
                    else
                    {
                        lblFeedback.Text = "البيانات من المعدة يوجد بها تكرار";
                    }
                }
                else
                {
                    lblFeedback.Text = ex.Message;
                }
                lblFeedback.Focus();
            }
        }


        //ViewState["gvRegionSamplesSECTION"] = gvRegionSamplesSECTION.DataSource;
        //ViewState["gvRegionSamplesIRI"] = gvRegionSamplesIRI.DataSource;
        //ViewState["sortdrIRI"] = "Asc";
        //ViewState["sortdr"] = "Asc";
    }
Beispiel #12
0
    protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlRegions.SelectedValue != "0")
        {
            lblFeedback0.Text = string.Empty;
            lblFeedback.Text  = string.Empty;
            lblFeedback1.Text = string.Empty;

            gvRegionIRI.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsInfo(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
            gvRegionIRI.DataBind();

            gvRegionSections.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsInfoDDF(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
            gvRegionSections.DataBind();
            gvRegionSections.DataSource = new JpmmsClasses.BL.MainStreet().GetStreetsInfo((int.Parse(ddlRegions.SelectedValue)));
            gvRegionSections.DataBind();

            DataTable dtIRI     = new JpmmsClasses.BL.MainStreet().GetStreetsSectionsLength(ddlRegions.SelectedItem.Text, RadioButtonList1.SelectedValue);
            DataTable dtSection = new JpmmsClasses.BL.MainStreet().GetStreetsSectionsLength(int.Parse(ddlRegions.SelectedValue));

            gvRegionSamplesIRI.DataSource = dtIRI;
            gvRegionSamplesIRI.DataBind();
            gvRegionSamplesSECTION.DataSource = dtSection;
            gvRegionSamplesSECTION.DataBind();

            try
            {
                dtSection.PrimaryKey = new DataColumn[] {
                    dtSection.Columns["SECTION_NO"],
                    dtSection.Columns["LANE"]
                };

                dtIRI.PrimaryKey = new DataColumn[] {
                    dtIRI.Columns["SECTION_NO"],
                    dtIRI.Columns["LANE"]
                };


                for (int i = 0; i < gvRegionSamplesIRI.Rows.Count; i++)
                {
                    if (gvRegionSamplesIRI.Rows[i].RowType == DataControlRowType.DataRow)
                    {
                        if (dtSection.Rows.Contains(new object[] { gvRegionSamplesIRI.Rows[i].Cells[0].Text, gvRegionSamplesIRI.Rows[i].Cells[1].Text }))
                        {
                            int SectionLenth = int.Parse(
                                dtSection.Rows.Find(new object[] { gvRegionSamplesIRI.Rows[i].Cells[0].Text, gvRegionSamplesIRI.Rows[i].Cells[1].Text }).ItemArray[3].ToString());

                            if ((System.Math.Abs(int.Parse(gvRegionSamplesIRI.Rows[i].Cells[2].Text) - SectionLenth) > 4000))
                            {
                                gvRegionSamplesIRI.Rows[i].Cells[3].Text = "4000 تجاوز الطول";
                                gvRegionSamplesIRI.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(int.Parse(gvRegionSamplesIRI.Rows[i].Cells[2].Text) - SectionLenth) > 3000))
                            {
                                gvRegionSamplesIRI.Rows[i].Cells[3].Text = "3000 تجاوز الطول";
                                gvRegionSamplesIRI.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(int.Parse(gvRegionSamplesIRI.Rows[i].Cells[2].Text) - SectionLenth) > 2000))
                            {
                                gvRegionSamplesIRI.Rows[i].Cells[3].Text = "2000 تجاوز الطول";
                                gvRegionSamplesIRI.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(int.Parse(gvRegionSamplesIRI.Rows[i].Cells[2].Text) - SectionLenth) > 1000))
                            {
                                gvRegionSamplesIRI.Rows[i].Cells[3].Text = "1000 تجاوز الطول";
                                gvRegionSamplesIRI.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(int.Parse(gvRegionSamplesIRI.Rows[i].Cells[2].Text) - SectionLenth) > 600))
                            {
                                gvRegionSamplesIRI.Rows[i].Cells[3].Text = "600 تجاوز الطول";
                                gvRegionSamplesIRI.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(int.Parse(gvRegionSamplesIRI.Rows[i].Cells[2].Text) - SectionLenth) > 450))
                            {
                                gvRegionSamplesIRI.Rows[i].Cells[3].Text = "450 تجاوز الطول";
                                gvRegionSamplesIRI.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(int.Parse(gvRegionSamplesIRI.Rows[i].Cells[2].Text) - SectionLenth) > 300))
                            {
                                gvRegionSamplesIRI.Rows[i].Cells[3].Text = "300 تجاوز الطول";
                                gvRegionSamplesIRI.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(int.Parse(gvRegionSamplesIRI.Rows[i].Cells[2].Text) - SectionLenth) > 200))
                            {
                                gvRegionSamplesIRI.Rows[i].Cells[3].Text = "200 تجاوز الطول";
                                gvRegionSamplesIRI.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(int.Parse(gvRegionSamplesIRI.Rows[i].Cells[2].Text) - SectionLenth) > 75))
                            {
                                gvRegionSamplesIRI.Rows[i].Cells[3].Text = "75 تجاوز الطول";
                                //gvRegionSamplesIRI.Rows[i].BackColor = System.Drawing.Color.BlueViolet;
                            }
                            else if ((System.Math.Abs(int.Parse(gvRegionSamplesIRI.Rows[i].Cells[2].Text) - SectionLenth) > 50))
                            {
                                gvRegionSamplesIRI.Rows[i].Cells[3].Text = "50 تجاوز الطول";
                                //gvRegionSamplesIRI.Rows[i].BackColor = System.Drawing.Color.Aqua;
                            }
                            else if ((System.Math.Abs(int.Parse(gvRegionSamplesIRI.Rows[i].Cells[2].Text) - SectionLenth) > 25))
                            {
                                gvRegionSamplesIRI.Rows[i].Cells[3].Text = "25 تجاوز الطول";
                                //gvRegionSamplesIRI.Rows[i].BackColor = System.Drawing.Color.AntiqueWhite;
                            }


                            //if ((int.Parse(gvRegionSamplesIRI.Rows[i].Cells[2].Text) - int.Parse(gvRegionSamplesSECTION.Rows[i].Cells[2].Text) > 25))
                            //{
                            //    gvRegionSamplesIRI.Rows[i].Cells[3].Text = " تجاوز الطول";
                            //    gvRegionSamplesIRI.Rows[i].BackColor = System.Drawing.Color.BlueViolet;
                            //    gvRegionSamplesSECTION.Rows[i].Cells[3].Text = " تجاوز الطول";
                            //    gvRegionSamplesSECTION.Rows[i].BackColor = System.Drawing.Color.BlueViolet;
                            //}
                        }
                    }
                }
                for (int i = 0; i < gvRegionSamplesSECTION.Rows.Count; i++)
                {
                    if (gvRegionSamplesSECTION.Rows[i].RowType == DataControlRowType.DataRow)
                    {
                        if (dtIRI.Rows.Contains(new object[] { gvRegionSamplesSECTION.Rows[i].Cells[0].Text, gvRegionSamplesSECTION.Rows[i].Cells[1].Text }))
                        {
                            int SectionLenth = int.Parse(
                                dtIRI.Rows.Find(new object[] { gvRegionSamplesSECTION.Rows[i].Cells[0].Text, gvRegionSamplesSECTION.Rows[i].Cells[1].Text }).ItemArray[2].ToString());
                            if ((System.Math.Abs(SectionLenth - int.Parse(gvRegionSamplesSECTION.Rows[i].Cells[2].Text)) > 4000))
                            {
                                gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "4000 تجاوز الطول";
                                gvRegionSamplesSECTION.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(SectionLenth - int.Parse(gvRegionSamplesSECTION.Rows[i].Cells[2].Text)) > 3000))
                            {
                                gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "3000 تجاوز الطول";
                                gvRegionSamplesSECTION.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(SectionLenth - int.Parse(gvRegionSamplesSECTION.Rows[i].Cells[2].Text)) > 2000))
                            {
                                gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "2000 تجاوز الطول";
                                gvRegionSamplesSECTION.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(SectionLenth - int.Parse(gvRegionSamplesSECTION.Rows[i].Cells[2].Text)) > 1000))
                            {
                                gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "1000 تجاوز الطول";
                                gvRegionSamplesSECTION.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(SectionLenth - int.Parse(gvRegionSamplesSECTION.Rows[i].Cells[2].Text)) > 600))
                            {
                                gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "600 تجاوز الطول";
                                gvRegionSamplesSECTION.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(SectionLenth - int.Parse(gvRegionSamplesSECTION.Rows[i].Cells[2].Text)) > 450))
                            {
                                gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "450 تجاوز الطول";
                                gvRegionSamplesSECTION.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(SectionLenth - int.Parse(gvRegionSamplesSECTION.Rows[i].Cells[2].Text)) > 300))
                            {
                                gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "300 تجاوز الطول";
                                gvRegionSamplesSECTION.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(SectionLenth - int.Parse(gvRegionSamplesSECTION.Rows[i].Cells[2].Text)) > 200))
                            {
                                gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "200 تجاوز الطول";
                                gvRegionSamplesSECTION.Rows[i].BackColor     = System.Drawing.Color.Red;
                            }
                            else if ((System.Math.Abs(SectionLenth - int.Parse(gvRegionSamplesSECTION.Rows[i].Cells[2].Text)) > 75))
                            {
                                gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "75 تجاوز الطول";
                                //gvRegionSamplesSECTION.Rows[i].BackColor = System.Drawing.Color.BlueViolet;
                            }
                            else if ((System.Math.Abs(SectionLenth - int.Parse(gvRegionSamplesSECTION.Rows[i].Cells[2].Text)) > 50))
                            {
                                gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "50 تجاوز الطول";
                                //gvRegionSamplesSECTION.Rows[i].BackColor = System.Drawing.Color.Aqua;
                            }
                            else if ((System.Math.Abs(SectionLenth - int.Parse(gvRegionSamplesSECTION.Rows[i].Cells[2].Text)) > 25))
                            {
                                gvRegionSamplesSECTION.Rows[i].Cells[3].Text = "25 تجاوز الطول";
                                //gvRegionSamplesSECTION.Rows[i].BackColor = System.Drawing.Color.AntiqueWhite;
                            }
                        }
                    }
                }
            }
            catch
            {
            }
        }
    }