protected void radOldSurvey_CheckedChanged(object sender, EventArgs e)
    {
        try
        {
            if (radOldSurvey.Checked)
            {
                pnlNewSurvey.Visible   = false;
                radlOldSurveys.Visible = true;
                radlOldSurveys.DataBind();

                lblSurveysCount.Text    = radlOldSurveys.Items.Count.ToString();
                lbtnAddDistress.Visible = (radlOldSurveys.Items.Count > 0);
                if (radlOldSurveys.Items.Count == 1)
                {
                    radlOldSurveys.SelectedValue = DistressSurvey.GetLastIntersectionSurveyNumber(int.Parse(gvIntersectionSamples.SelectedValue.ToString())).ToString();
                    radlOldSurveys_SelectedIndexChanged(sender, e);
                    //gvDistresses.DataBind();
                }
                else
                {
                    radlOldSurveys.SelectedIndex = 0; //-1;
                }
            }
        }
        catch (Exception ex)
        {
            lblFeedback.Text = ex.Message;
        }
    }
예제 #2
0
        public bool UpdateIntersectionSampleArea(int INTER_SAMP_ID, double INTERSEC_SAMP_AREA, string user, string NOTES)
        {
            string sql           = "";
            int    lastSurveyNum = DistressSurvey.GetLastIntersectionSurveyNumber(INTER_SAMP_ID);

            if (lastSurveyNum == 0)
            {
                // no surveys have been done over this secondar street, so we can update its length and width directly
                sql = string.Format("UPDATE INTERSECTION_SAMPLES SET INTERSEC_SAMP_AREA={0}, NOTES='{2}' WHERE INTER_SAMP_ID={1} ", INTERSEC_SAMP_AREA, INTER_SAMP_ID, NOTES);

                int rows = db.ExecuteNonQuery(sql);
                Shared.SaveLogfile("INTERSECTION_SAMPLES", INTER_SAMP_ID.ToString(), "Update", user);
                return(rows > 0);
            }
            else
            {
                // surveys have been done over this secondar street, so we have to remove them before we can update its length and width directly
                sql = string.Format("UPDATE INTERSECTION_SAMPLES SET INTERSEC_SAMP_AREA={0}, NOTES='{2}' WHERE INTER_SAMP_ID={1} ", INTERSEC_SAMP_AREA, INTER_SAMP_ID, NOTES);
                int rows = db.ExecuteNonQuery(sql);

                //if (INTERSEC_SAMP_AREA == 0)
                //{
                //    sql = string.Format("delete from DISTRESS WHERE INTER_SAMP_ID={0} ", INTER_SAMP_ID);
                //    db.ExecuteNonQuery(sql);
                //}
                //else
                //{
                //    sql = string.Format("UPDATE DISTRESS SET STATUS='N' WHERE INTER_SAMP_ID={0} ", INTER_SAMP_ID);
                //    db.ExecuteNonQuery(sql);
                //}

                //sql = string.Format("UPDATE UDI SET UDI_DATE=NULL, UDI_VALUE=NULL, UDI_RATE=NULL, UDI_UP_DATE=NULL, UDI_UPD_VALUE=NULL, UDI_UPD_RATE=NULL, STATUS='N', STATUS_UPD='N'  WHERE INTER_SAMP_ID={0} ", INTER_SAMP_ID);
                //db.ExecuteNonQuery(sql);

                //sql = string.Format("DELETE FROM PREVENT_MAINT_DECISIONS WHERE INTER_SAMP_ID={0} ", INTER_SAMP_ID);
                //db.ExecuteNonQuery(sql);

                //sql = string.Format("DELETE FROM MAINTENANCE_DECISIONS WHERE INTER_SAMP_ID={0} ", INTER_SAMP_ID);
                //db.ExecuteNonQuery(sql);

                rows += FixDistressesAfterAreaChange(INTER_SAMP_ID, INTERSEC_SAMP_AREA, user);


                sql   = string.Format("UPDATE UDI_INTERSECTION_SAMPLE SET UDI_DATE=NULL, UDI_VALUE=NULL, UDI_RATE=NULL WHERE INTER_SAMP_ID={0} ", INTER_SAMP_ID);
                rows += db.ExecuteNonQuery(sql);


                Shared.SaveLogfile("INTERSECTION_SAMPLES", INTER_SAMP_ID.ToString(), "Update", user);
                return(rows > 0);
            }
        }