Example #1
0
    private void Calculate()
    {
        DataTable dt;
        bool result = true;

        SectionsUDI udiSections = new SectionsUDI();
        IntersectionUDI udiIntersect = new IntersectionUDI();
        RegionSecondaryStUDI udiRegions = new RegionSecondaryStUDI();
        string user = Session["UserName"].ToString();


        dt = new MainStreet().GetMainStreetsHavingSurveyDistresses();
        foreach (DataRow dr in dt.Rows)
            result &= udiSections.CalculateMainStreetSectionsUDI(int.Parse(dr["STREET_ID"].ToString()), user, true);

        dt = new MainStreet().GetMainStreetsHavingIntersectionsSurveyDistresses();
        foreach (DataRow dr in dt.Rows)
            result &= udiIntersect.CalculateMainStreetIntersectionsUDI(int.Parse(dr["STREET_ID"].ToString()), user, true);

        dt = new Region().GetSurveyedRegions();
        foreach (DataRow dr in dt.Rows)
            result &= udiRegions.CalculateRegionSecondaryStreetsUDI(int.Parse(dr["REGION_ID"].ToString()), user, true);


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

        dt = new MainStreet().GetMainStreetsHavingSurveyDistresses();
        foreach (DataRow dr in dt.Rows)
        {
            result &= udiSections.CalculateMainStreetSectionsUDI(int.Parse(dr["STREET_ID"].ToString()), user, true);
        }
        dt = new DataTable();
        ThreadResults.Add(RequestID, dt);
    }
Example #3
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);
    }
Example #4
0
    private void CalculateUDI()
    {       
        int survey = int.Parse(ddlOldSurveys.SelectedValue);
        string user = Session["UserName"].ToString();
        bool result = true;

        if (radByMainLanes.Checked)
        {
            int mainStID = int.Parse(ddlMainStreets.SelectedValue);
            SectionsUDI udi = new SectionsUDI();
            if (ddlMainStreets.SelectedValue == "0")
            {
                DataTable dt = new MainStreet().GetMainStreetsHavingSurveyDistresses();
                foreach (DataRow dr in dt.Rows)
                {
                    if (survey != 0)
                        result &= udi.CalculateMainStreetSectionsUDI(int.Parse(dr["STREET_ID"].ToString()), survey, user); // id3
                    else
                        result &= udi.CalculateMainStreetSectionsUDI(int.Parse(dr["STREET_ID"].ToString()), user, false);
                }
            }
            else
            {
                if (survey != 0)
                    result &= udi.CalculateMainStreetSectionsUDI(mainStID, survey, user);
                else
                    result &= udi.CalculateMainStreetSectionsUDI(mainStID, user, false);
            }

            if (result)
            {
                lblFeedback.Text = "تم الحساب بنجاح";
                DataTable dt = udi.GetSectionsUdiByMainStreet(mainStID, survey, true);

                ThreadResults.Add(RequestID, dt);
            }
            else
                lblFeedback.Text = "فشلت عملية الحساب";
        }
        else if (radByIntersections.Checked)
        {
            int mainStID = int.Parse(ddlMainStreets.SelectedValue);
            IntersectionUDI udi = new IntersectionUDI();
            if (ddlMainStreets.SelectedValue == "0")
            {
                DataTable dt = new MainStreet().GetMainStreetsHavingIntersectionsSurveyDistresses();
                foreach (DataRow dr in dt.Rows)
                {
                    if (survey != 0)
                        result &= udi.CalculateMainStreetIntersectionsUDI(int.Parse(dr["STREET_ID"].ToString()), survey, user);
                    else
                        result &= udi.CalculateMainStreetIntersectionsUDI(int.Parse(dr["STREET_ID"].ToString()), user, false);
                }
            }
            else
            {
                if (survey != 0)
                    result &= udi.CalculateMainStreetIntersectionsUDI(mainStID, survey, user);
                else
                    result &= udi.CalculateMainStreetIntersectionsUDI(mainStID, user, false);
            }

            if (result)
            {
                lblFeedback.Text = "تم الحساب بنجاح";
                DataTable dt = udi.GetMainStreetIntersectionUDI(mainStID, survey);

                ThreadResults.Add(RequestID, dt);
            }
            else
                lblFeedback.Text = "فشلت عملية الحساب";
        }
        else
        {
            RegionSecondaryStUDI udi = new RegionSecondaryStUDI();
            if (radByRegionNo.Checked)
            {
                if (ddlRegions.SelectedValue == "0")
                {
                    DataTable dt = new Region().GetSurveyedRegions();
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (survey != 0)
                            result = udi.CalculateRegionSecondaryStreetsUDI(int.Parse(dr["REGION_ID"].ToString()), survey, user);
                        else
                            result &= udi.CalculateRegionSecondaryStreetsUDI(int.Parse(dr["REGION_ID"].ToString()), user, false);
                    }
                }
                else
                {
                    int regionID = int.Parse(ddlRegions.SelectedValue);
                    if (survey != 0)
                        result = udi.CalculateRegionSecondaryStreetsUDI(regionID, survey, user);
                    else
                        result &= udi.CalculateRegionSecondaryStreetsUDI(regionID, user, false);
                }
            }
            else if (radByRegionName.Checked)
            {
                if (ddlRegionNames.SelectedValue == "0")
                {
                    throw new Exception("الرجاء اختيار الحي الفرعي");
                    //DataTable dt = new Region().GetSurveyedSubdistricts();
                    //foreach (DataRow dr in dt.Rows)
                    //{
                    //    if (survey != 0)
                    //        result = udi.CalculateRegionSecondaryStreetsUDI(dr["subdistrict"].ToString(), survey, user);
                    //    else
                    //        result &= udi.CalculateRegionSecondaryStreetsUDI(dr["subdistrict"].ToString(), user);
                    //}
                }
                else
                {
                    if (survey != 0)
                        result = udi.CalculateRegionSecondaryStreetsUDI_BySubdistrict(ddlRegionNames.SelectedValue, survey, user);
                    else
                        result &= udi.CalculateRegionSecondaryStreetsUDI_BySubdistrict(ddlRegionNames.SelectedValue, user);
                }
            }
            else if (radByRegionsAreaName.Checked)
            {
                if (ddlDistrict.SelectedValue == "0")
                {
                    throw new Exception("الرجاء اختيار الحي");
                    //DataTable dt = new Region().GetSurveyedDistricts();
                    //foreach (DataRow dr in dt.Rows)
                    //{
                    //    if (survey != 0)
                    //        result = udi.CalculateRegionSecondaryStreetsUDI_ByDistrict(dr["DIST_NAME"].ToString(), survey, user);
                    //    else
                    //        result &= udi.CalculateRegionSecondaryStreetsUDI_ByDistrict(dr["DIST_NAME"].ToString(), user);
                    //}
                }
                else
                {
                    if (survey != 0)
                        result = udi.CalculateRegionSecondaryStreetsUDI_ByDistrict(ddlDistrict.SelectedValue, survey, user);
                    else
                        result &= udi.CalculateRegionSecondaryStreetsUDI_ByDistrict(ddlDistrict.SelectedValue, user);
                }
            }
            else if (radByMunicName.Checked)
            {
                if (ddlMunic.SelectedValue == "0")
                {
                    throw new Exception("الرجاء اختيار البلدية الفرعية");
                    //DataTable dt = new Region().GetSurveyedMunicipalities();
                    //foreach (DataRow dr in dt.Rows)
                    //{
                    //    if (survey != 0)
                    //        result = udi.CalculateRegionSecondaryStreetsUDI_ByDistrict(dr["MUNIC_NAME"].ToString(), survey, user);
                    //    else
                    //        result &= udi.CalculateRegionSecondaryStreetsUDI_ByDistrict(dr["MUNIC_NAME"].ToString(), user);
                    //}
                }
                else
                {
                    if (survey != 0)
                        result = udi.CalculateRegionSecondaryStreetsUDI_ByMunicipality(ddlMunic.SelectedValue, survey, user);
                    else
                        result &= udi.CalculateRegionSecondaryStreetsUDI_ByMunicipality(ddlMunic.SelectedValue, user);
                }
            }

            if (result)
            {
                lblFeedback.Text = "تم الحساب بنجاح";

                DataTable dt = new DataTable();
                if (radByRegionNo.Checked)
                    dt = udi.GetSecondaryStreetsUdiByRegion(int.Parse(ddlRegions.SelectedValue), survey);
                else if (radByRegionName.Checked)
                    dt = udi.GetSecondaryStreetsUdiByRegion(ddlRegionNames.SelectedValue, survey);
                else if (radByRegionsAreaName.Checked)
                    dt = udi.GetSecondaryStreetsUdiByDistrict(ddlDistrict.SelectedValue, survey);
                else if (radByMunicName.Checked)
                    dt = udi.GetSecondaryStreetsUdiByMuniciplaity(ddlMunic.SelectedValue, survey);

                ThreadResults.Add(RequestID, dt);

            }
            else
                lblFeedback.Text = "فشلت عملية الحساب";
        }
    }