Exemplo n.º 1
0
 private void OKButton_Click(object eventSender, EventArgs eventArgs)
 {
     try
     {
         string Left = BuildingSystem.AddSystem(this.m_strBldgID, Conversions.ToInteger(this.cboSystems.SelectedValue));
         if ((uint)Operators.CompareString(Left, "", false) <= 0U)
         {
             return;
         }
         frmMain    fMainForm = mdUtility.fMainForm;
         ref string local1    = ref this.m_strBldgID;
         ref string local2    = ref Left;
Exemplo n.º 2
0
 public static void DeleteBuilding(string strBuildingID)
 {
     try
     {
         mdUtility.DB.BeginTransaction();
         DataTable dataTable1 = mdUtility.DB.GetDataTable("SELECT * FROM Building_System WHERE bldg_sys_bldg_id='" + strBuildingID + "'");
         try
         {
             foreach (DataRow row in dataTable1.Rows)
             {
                 BuildingSystem.DeleteSystem(row["bldg_sys_id"].ToString());
             }
         }
         finally
         {
             IEnumerator enumerator;
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         Sample.DeleteSampleLocationsForBuilding(strBuildingID);
         string    str1       = "SELECT * FROM Facility WHERE [Facility_ID]='" + strBuildingID + "'";
         DataTable dataTable2 = mdUtility.DB.GetDataTable(str1);
         if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(dataTable2.Rows[0]["bred_status"])) || Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(dataTable2.Rows[0]["bred_status"], (object)"N", false))
         {
             dataTable2.Rows[0]["bred_status"] = (object)"D";
         }
         else
         {
             dataTable2.Rows[0].Delete();
         }
         mdUtility.DB.SaveDataTable(ref dataTable2, str1);
         string    str2       = "Select * from Organization_Facilities where Facility_ID = '" + strBuildingID + "'";
         DataTable dataTable3 = mdUtility.DB.GetDataTable(str2);
         try
         {
             foreach (DataRow row in dataTable3.Rows)
             {
                 if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(row["BRED_STATUS"])) || Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(row["BRED_STATUS"], (object)"N", false))
                 {
                     row["BRED_STATUS"] = (object)"D";
                 }
                 else
                 {
                     row.Delete();
                 }
             }
         }
         finally
         {
             IEnumerator enumerator;
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         mdUtility.DB.SaveDataTable(ref dataTable3, str2);
         string    str3       = "SELECT * FROM Missing_Components WHERE Building_ID = '" + strBuildingID + "'";
         DataTable dataTable4 = mdUtility.DB.GetDataTable(str3);
         if (dataTable4.Rows.Count > 0)
         {
             try
             {
                 foreach (DataRow row in dataTable4.Rows)
                 {
                     row.Delete();
                 }
             }
             finally
             {
                 IEnumerator enumerator;
                 if (enumerator is IDisposable)
                 {
                     (enumerator as IDisposable).Dispose();
                 }
             }
             mdUtility.DB.SaveDataTable(ref dataTable4, str3);
         }
         string    str4       = "SELECT * FROM ADA_Assessment WHERE Building_ID = '" + strBuildingID + "'";
         DataTable dataTable5 = mdUtility.DB.GetDataTable(str4);
         if (dataTable5.Rows.Count > 0)
         {
             string    str5       = Conversions.ToString(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject((object)"SELECT * FROM ADA_Attributes WHERE ADA_Assessment_ID = '", dataTable5.Rows[0]["ADA_Assessment_ID"]), (object)"'"));
             DataTable dataTable6 = mdUtility.DB.GetDataTable(str5);
             if (dataTable6.Rows.Count > 0)
             {
                 try
                 {
                     foreach (DataRow row in dataTable6.Rows)
                     {
                         row.Delete();
                     }
                 }
                 finally
                 {
                     IEnumerator enumerator;
                     if (enumerator is IDisposable)
                     {
                         (enumerator as IDisposable).Dispose();
                     }
                 }
                 mdUtility.DB.SaveDataTable(ref dataTable6, str5);
             }
             dataTable5.Rows[0].Delete();
             mdUtility.DB.SaveDataTable(ref dataTable5, str4);
         }
         mdUtility.fMainForm.tvInventory.Nodes.Remove(mdUtility.fMainForm.tvInventory.Nodes[strBuildingID]);
         if (mdUtility.fMainForm.tvInspection.GetNodeByKey(strBuildingID) != null)
         {
             mdUtility.fMainForm.tvInspection.Nodes.Remove(mdUtility.fMainForm.tvInspection.GetNodeByKey(strBuildingID));
             mdUtility.fMainForm.tvInspection.Refresh();
         }
         mdUtility.DB.CommitTransaction();
         mdUtility.fMainForm.tvInventory.Refresh();
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception exception = ex;
         if (Information.Err().Number != 35601)
         {
             mdUtility.DB.RollbackTransaction();
             throw exception;
         }
         ProjectData.ClearProjectError();
     }
 }