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); }
private void Calculate() { DataTable dt; bool result = true; MaintenanceDecisions maintD = new MaintenanceDecisions(); string user = Session["UserName"].ToString(); dt = new MainStreet().GetMainStreetsHavingSurveyDistresses(); foreach (DataRow dr in dt.Rows) { result &= maintD.PrepareMainStreetSectionsMaintenanceDecisions(int.Parse(dr["STREET_ID"].ToString()), user, true); // id3 } dt = new MainStreet().GetMainStreetsHavingIntersectionsSurveyDistresses(); foreach (DataRow dr in dt.Rows) { result &= maintD.PrepareMainStreetIntersectionsMaintenanceDecisions(int.Parse(dr["STREET_ID"].ToString()), user, true); } dt = new Region().GetSurveyedRegions(); foreach (DataRow dr in dt.Rows) { result &= maintD.PrepareRegionSecondaryStreetsMaintenanceDecisions(int.Parse(dr["REGION_ID"].ToString()), user, true); } dt = new DataTable(); ThreadResults.Add(RequestID, dt); }
private void DelegateInvoke_PreInvokeCallback(object sender, ThreadResults results, object[] pars) { FunctionModule m = (FunctionModule)sender; m.BelongThread = results.Thread; Logger.Log("Thread " + sender.ToString() + " started"); }
private void DelegateInvoke_PostInvokeCallback(object sender, ThreadResults results, object[] pars) { //* Debug if (results.Err != null) { Logger.Log(results.Err.ToString()); } else { Logger.Log("Thread " + sender.ToString() + " ended"); } //*/ }
protected void Page_Load(object sender, EventArgs e) { try { Guid id = new Guid(Request.QueryString["id"]); // Check the thread result collection if (ThreadResults.Contains(id) && ThreadResults.message == "") { // The worker thread has finished // Get the result from the thread result collection //int authorizationId = (int)ThreadResults.Get(id); DataTable dt = (DataTable)ThreadResults.Get(id); // Remove the result from the collection ThreadResults.Remove(id); lblMessage.Text = "انتهى حساب قرارات الصيانة بنجاح"; lblMessage.ForeColor = Color.Green; hlnkClose.Visible = true; gvSectionMaintenanceDecisions.DataSource = dt; gvSectionMaintenanceDecisions.DataBind(); //UdiShared.StartShapeFileAutoCreationProgram(); } else { if (ThreadResults.message == "") { lblMessage.Text = "يجري الآن حساب حالة الرصف وقرارات الصيانة ، الرجاء الانتظار"; lblMessage.ForeColor = Color.Black; Response.AddHeader("Refresh", "2"); } else { lblMessage.Text = ThreadResults.message; ThreadResults.message = ""; hlnkClose.Visible = true; } } } catch (Exception ex) { lblMessage.Text = ex.Message; hlnkClose.Visible = true; } }
private void CalculateUdiRegionsALL() { DataTable dt; bool result = true; RegionSecondaryStUDI udiRegions = new RegionSecondaryStUDI(); string user = Session["UserName"].ToString(); dt = new SystemUsers().GetReceivedReports(); foreach (DataRow dr in dt.Rows) { result &= udiRegions.CalculateRegionSecondaryStreetsUDI(int.Parse(dr["ID"].ToString()), user, true); } dt = new DataTable(); ThreadResults.Add(RequestID, dt); }
private void CalculateUdiudiIntersectionALL() { DataTable dt; bool result = true; IntersectionUDI udiIntersection = new IntersectionUDI(); string user = Session["UserName"].ToString(); dt = new SystemUsers().GetReceivedInterMainStreet(); foreach (DataRow dr in dt.Rows) { result &= udiIntersection.CalculateMainStreetIntersectionsUDI(int.Parse(dr["ID"].ToString()), user, true); } dt = new DataTable(); ThreadResults.Add(RequestID, dt); }
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); }
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); }
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); }
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); }
private void CalculateMainIntersectionALL() { DataTable dt; bool result = true; MaintenanceDecisions maintD = new MaintenanceDecisions(); string user = Session["UserName"].ToString(); dt = new SystemUsers().GetReceivedInterMainStreet(); foreach (DataRow dr in dt.Rows) { result &= maintD.PrepareMainStreetIntersectionsMaintenanceDecisions(int.Parse(dr["ID"].ToString()), user, true); } dt = new DataTable(); ThreadResults.Add(RequestID, dt); }
protected void Page_Load(object sender, EventArgs e) { try { Guid id = new Guid(Request.QueryString["id"]); // Check the thread result collection if (ThreadResults.Contains(id)) { // The worker thread has finished // Get the result from the thread result collection //int authorizationId = (int)ThreadResults.Get(id); DataTable dt = (DataTable)ThreadResults.Get(id); // Remove the result from the collection ThreadResults.Remove(id); lblMessage.Text = "انتهى حساب حالة الرصف بنجاح"; lblMessage.ForeColor = Color.Green; UdiShared.StartShapeFileAutoCreationProgram(); } else { lblMessage.Text = "يجري الآن حساب حالة الرصف، الرجاء الانتظار"; lblMessage.ForeColor = Color.Black; Response.AddHeader("Refresh", "2"); } } catch (Exception ex) { lblMessage.Text = ex.Message; } }
private void CalculateUDI(int survey, int mainStID) { string user = Session["UserName"].ToString(); bool result = true; MaintenanceDecisions md = new MaintenanceDecisions(); if (radByMainLanes.Checked) { if (ddlMainStreets.SelectedValue == "0") { DataTable dt = new MainStreet().GetMainStreetsHavingSurveyDistresses(); foreach (DataRow dr in dt.Rows) { if (survey != 0) { result &= md.PrepareMainStreetSectionsMaintenanceDecisions(int.Parse(dr["STREET_ID"].ToString()), survey, user); } else { result &= md.PrepareMainStreetSectionsMaintenanceDecisions(int.Parse(dr["STREET_ID"].ToString()), user, false); } } } else { if (survey != 0) { result &= md.PrepareMainStreetSectionsMaintenanceDecisions(mainStID, survey, user); } else { result &= md.PrepareMainStreetSectionsMaintenanceDecisions(mainStID, user, false); } } if (result) { lblFeedback.Text = "تم الحساب بنجاح"; DataTable dt = md.GetMainStreetSectionLaneSamplesMaintenanceDecisions(mainStID, survey); //, true); ThreadResults.Add(RequestID, dt); } else { lblFeedback.Text = "فشلت عملية الحساب"; } } else if (radByIntersections.Checked) { if (ddlMainStreets.SelectedValue == "0") { DataTable dt = new MainStreet().GetMainStreetsHavingIntersectionsSurveyDistresses(); foreach (DataRow dr in dt.Rows) { if (survey != 0) { result &= md.PrepareMainStreetIntersectionsMaintenanceDecisions(int.Parse(dr["STREET_ID"].ToString()), survey, user); // id3 } else { result &= md.PrepareMainStreetIntersectionsMaintenanceDecisions(int.Parse(dr["STREET_ID"].ToString()), user, false); } } } else { if (survey != 0) { result &= md.PrepareMainStreetIntersectionsMaintenanceDecisions(mainStID, survey, user); } else { result &= md.PrepareMainStreetIntersectionsMaintenanceDecisions(mainStID, user, false); } } if (result) { lblFeedback.Text = "تم الحساب بنجاح"; DataTable dt = md.GetMainStreetIntersectionSamplesMaintenanceDecisions(mainStID, survey); ThreadResults.Add(RequestID, dt); } else { lblFeedback.Text = "فشلت عملية الحساب"; } } else { if (radByRegionNo.Checked) { if (ddlRegions.SelectedValue == "0") { DataTable dt = new Region().GetSurveyedRegions(); foreach (DataRow dr in dt.Rows) { if (survey != 0) { result = md.PrepareRegionSecondaryStreetsMaintenanceDecisions(int.Parse(dr["REGION_ID"].ToString()), survey, user); } else { result &= md.PrepareRegionSecondaryStreetsMaintenanceDecisions(int.Parse(dr["REGION_ID"].ToString()), user, false); } } } else { int regionID = int.Parse(ddlRegions.SelectedValue); if (survey != 0) { result = md.PrepareRegionSecondaryStreetsMaintenanceDecisions(regionID, survey, user); } else { result &= md.PrepareRegionSecondaryStreetsMaintenanceDecisions(regionID, user, false); } } } else if (radByRegionName.Checked) { if (ddlRegionNames.SelectedValue == "0") { throw new Exception("الرجاء اختيار الحي الفرعي"); } else { if (survey != 0) { result = md.PrepareSubdistrictSecondaryStreetsMaintenanceDecisions(ddlRegionNames.SelectedValue, survey, user); } else { result &= md.PrepareSubdistrictSecondaryStreetsMaintenanceDecisions(ddlRegionNames.SelectedValue, user); } } } else if (radByRegionsAreaName.Checked) { if (ddlDistrict.SelectedValue == "0") { throw new Exception("الرجاء اختيار الحي"); } else { if (survey != 0) { result = md.PrepareDistrictSecondaryStreetsMaintenanceDecisions(ddlDistrict.SelectedValue, survey, user); } else { result &= md.PrepareDistrictSecondaryStreetsMaintenanceDecisions(ddlDistrict.SelectedValue, user); } } } else if (radByMunicName.Checked) { if (ddlMunic.SelectedValue == "0") { throw new Exception("الرجاء اختيار البلدية الفرعية"); } else { if (survey != 0) { result = md.PrepareMunicipalitySecondaryStreetsMaintenanceDecisions(ddlMunic.SelectedValue, survey, user); } else { result &= md.PrepareMunicipalitySecondaryStreetsMaintenanceDecisions(ddlMunic.SelectedValue, user); } } } if (result) { lblFeedback.Text = "تم الحساب بنجاح"; DataTable dt = new DataTable(); if (radByRegionNo.Checked) { dt = md.GetRegionSecondaryStreetsMaintenanceDecisions(int.Parse(ddlRegions.SelectedValue), survey); } else if (radByRegionName.Checked) { dt = md.GetSubdistrictSecondaryStreetsMaintenanceDecisions(ddlRegionNames.SelectedValue, survey); } else if (radByRegionsAreaName.Checked) { dt = md.GetDistrictSecondaryStreetsMaintenanceDecisions(ddlDistrict.SelectedValue, survey); } else if (radByMunicName.Checked) { dt = md.GetMunicipalitySecondaryStreetsMaintenanceDecisions(ddlMunic.SelectedValue, survey); } ThreadResults.Add(RequestID, dt); } else { lblFeedback.Text = "فشلت عملية الحساب"; } } }
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 = "فشلت عملية الحساب"; } }