Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private CCIToLocalizationLoader(String paramString1, boolean paramBoolean, String paramString2) throws Exception
        private CCIToLocalizationLoader(string paramString1, bool paramBoolean, string paramString2)
        {
            this.online = paramBoolean;
            this.CCI    = paramString2;
            File file1 = new File(paramString1 + File.separator + "City Cost Index" + File.separator + paramString2 + ".up");
            File file2 = new File(paramString1 + File.separator + "City Cost Index" + File.separator + paramString2 + ".sys");

            try
            {
                DatabaseDBUtil.currentSession().beginTransaction();
                Console.WriteLine("PROCESSING: " + file1.AbsolutePath);
                loadCCI(file1, "US", "extraCode1", "RSMeans Unit Cost Base");
                Transaction transaction = DatabaseDBUtil.currentSession().Transaction;
                transaction.commit();
                DatabaseDBUtil.currentSession().beginTransaction();
                Console.WriteLine("PROCESSING: " + file2.AbsolutePath);
                loadCCI(file2, "US", "extraCode3", "RSMeans Assemblies Base");
                transaction = DatabaseDBUtil.currentSession().Transaction;
                transaction.commit();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
                Transaction transaction = DatabaseDBUtil.currentSession().Transaction;
                if (transaction.Active)
                {
                    transaction.rollback();
                }
                DatabaseDBUtil.closeSession();
                throw exception;
            }
            DatabaseDBUtil.closeSession();
        }
        public virtual void resetAll()
        {
            bool    @bool   = !DatabaseDBUtil.hasOpenedSession() ? 1 : 0;
            Session session = DatabaseDBUtil.currentSession();

            if (@bool)
            {
                session.beginTransaction();
            }
            System.Collections.IEnumerator iterator = session.createQuery("from FieldCustomizationTable").list().GetEnumerator();
            List <object> arrayList = new List <object>();

            while (iterator.MoveNext())
            {
                arrayList.Add(iterator.Current);
            }
            iterator = arrayList.GetEnumerator();
            while (iterator.MoveNext())
            {
                session.delete(iterator.Current);
            }
            if (@bool)
            {
                session.Transaction.commit();
            }
            if (@bool)
            {
                DatabaseDBUtil.closeSession();
            }
            initializeFieldsMap();
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static boolean deleteLocalIcon(String paramString, Class paramClass) throws Exception
        public static bool deleteLocalIcon(string paramString, Type paramClass)
        {
            bool @bool = !DatabaseDBUtil.hasOpenedSession() ? 1 : 0;
            int  i     = ((Number)DatabaseDBUtil.currentSession().createQuery("select count(o.icon) from " + paramClass.Name + " o where o.icon = '" + paramString + "'").iterate().next()).intValue();

            if (i > 1)
            {
                return(false);
            }
            if (@bool)
            {
                DatabaseDBUtil.closeSession();
            }
            File file1 = new File(getLocalPathOfIcon(paramString, paramClass, 16));
            File file2 = new File(getLocalPathOfIcon(paramString, paramClass, 24));
            File file3 = new File(getLocalPathOfIcon(paramString, paramClass, 32));

            if (file1.exists())
            {
                file1.delete();
            }
            if (file2.exists())
            {
                file2.delete();
            }
            if (file3.exists())
            {
                file3.delete();
            }
            return(true);
        }
        private bool checkRequiresAltering(ProjectUrlTable paramProjectUrlTable)
        {
            if (paramProjectUrlTable.CreatesNewDatabases != null && !paramProjectUrlTable.CreatesNewDatabases.Value)
            {
                return(false);
            }
            Session session = DatabaseDBUtil.currentSession();

            try
            {
                string str1 = "SELECT PVAL as VER FROM  " + paramProjectUrlTable.DatabaseName + ".dbo.PRJPROP WHERE PKEY LIKE 'costos.estimating.version' and PRJID = " + ProjectUrlId;
                string str2 = (string)session.createSQLQuery(str1).addScalar("VER", StringType.INSTANCE).uniqueResult();
                if (string.ReferenceEquals(str2, null))
                {
                    DatabaseDBUtil.closeSession();
                    return(true);
                }
                if (StringUtils.checkEquality(str2, ProjectDBProperties.PROPERTIES_VERSION))
                {
                    DatabaseDBUtil.closeSession();
                    return(false);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
            }
            DatabaseDBUtil.closeSession();
            return(true);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private UniFormatLoader(String paramString1, String paramString2) throws Exception
        private UniFormatLoader(string paramString1, string paramString2)
        {
            this.costDataFolder = paramString1;
            this.asm            = paramString2;
            Session     session     = DatabaseDBUtil.currentSession();
            Transaction transaction = session.beginTransaction();

            try
            {
                loadUniCodes("Assembly", "ASM", session);
                loadUniCodes("Civil", "CVL", session);
                loadUniCodes("Commercial", "COM", session);
                loadUniCodes("Concrete", "CON", session);
                loadUniCodes("Electrical", "ELE", session);
                loadUniCodes("Facility", "FAC", session);
                loadUniCodes("Green Building", "GRN", session);
                loadUniCodes("Heavy", "HVY", session);
                loadUniCodes("Interior", "INT", session);
                loadUniCodes("Master", "ALL", session);
                loadUniCodes("Mechanical", "MEC", session);
                loadUniCodes("Plumbing", "PLU", session);
                loadUniCodes("Site Work", "SIT", session);
                loadUniCodes("Square Foot", "SF", session);
                transaction.commit();
            }
            catch (Exception exception)
            {
                transaction.rollback();
                DatabaseDBUtil.closeSession();
                throw exception;
            }
            DatabaseDBUtil.closeSession();
        }
        public virtual void storeToDatabase(IList <FieldCustomizationTable> paramList)
        {
            Session session = DatabaseDBUtil.currentSession();

            session.beginTransaction();
            foreach (FieldCustomizationTable fieldCustomizationTable in paramList)
            {
                storeToDatabase(fieldCustomizationTable);
            }
            session.Transaction.commit();
            DatabaseDBUtil.closeSession();
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static java.util.Map<long, long> moveModelsToCEP(nomitech.common.ui.UIProgress paramUIProgress, nomitech.common.CostOSBimEngineFileDBUtil paramCostOSBimEngineFileDBUtil, java.util.List<long> paramList) throws Exception
        public static IDictionary <long, long> moveModelsToCEP(UIProgress paramUIProgress, CostOSBimEngineFileDBUtil paramCostOSBimEngineFileDBUtil, IList <long> paramList)
        {
            Hashtable     hashMap   = new Hashtable();
            List <object> arrayList = new List <object>();
            Session       session1  = null;
            Session       session2  = null;

            try
            {
                session1 = DatabaseDBUtil.currentSession();
                session2 = paramCostOSBimEngineFileDBUtil.createSession();
                Session session3 = session1;
                Session session4 = session2;
                paramList.ForEach(paramLong =>
                {
                    try
                    {
                        BimExportCEPDataMover bimExportCEPDataMover = new BimExportCEPDataMover(paramUIProgress, paramLong, paramSession1, paramSession2);
                        long?long = bimExportCEPDataMover.moveModelsToCEP();
                        if (long == null)
                        {
                            return;
                        }
                        BimModelMetadata bimModelMetadata = gatherMetadata(paramSession1, paramLong, long);
                        if (bimModelMetadata == null)
                        {
                            return;
                        }
                        paramList.Add(bimModelMetadata);
                        paramMap.put(paramLong, long);
                    }
                    catch (Exception throwable)
                    {
                        Console.WriteLine(throwable.ToString());
                        Console.Write(throwable.StackTrace);
                    }
                });
                cleanup(session2);
                saveMetadata(paramCostOSBimEngineFileDBUtil.ProjectFolder, arrayList);
            }
            catch (Exception)
            {
                if (session1 != null)
                {
                    session1.close();
                }
                if (session2 != null)
                {
                    session2.close();
                }
            }
            return(hashMap);
        }
        public virtual void reloadFromDatabase()
        {
            initializeFieldsMap();
            bool    @bool   = !DatabaseDBUtil.hasOpenedSession() ? 1 : 0;
            Session session = DatabaseDBUtil.currentSession();

            foreach (FieldCustomizationTable fieldCustomizationTable in session.createQuery("from FieldCustomizationTable").list())
            {
                this.fieldsMap[new FieldCustomizationKey(this, fieldCustomizationTable.Name, fieldCustomizationTable.ResourceType)] = (FieldCustomizationTable)fieldCustomizationTable.clone();
            }
            if (@bool)
            {
                DatabaseDBUtil.closeSession();
            }
        }
 private void reload(Session paramSession)
 {
     this.functions.Clear();
     this.definitions.Clear();
     if (paramSession == null)
     {
         if (DatabaseDBUtil.LocalCommunication)
         {
             bool @bool = !DatabaseDBUtil.hasOpenedSession() ? 1 : 0;
             paramSession = DatabaseDBUtil.currentSession();
             foreach (FunctionTable functionTable1 in paramSession.createQuery("from FunctionTable o left join fetch o.functionArgumentList").list())
             {
                 FunctionTable functionTable2 = functionTable1.copyWithVariables();
                 this.functions[functionTable1.Name]   = new ExprDBFunction(functionTable2);
                 this.definitions[functionTable1.Name] = new ExprFunctionDefinition(functionTable2);
             }
             if (@bool)
             {
                 DatabaseDBUtil.closeSession();
             }
         }
         else
         {
             try
             {
                 foreach (FunctionTable functionTable in DatabaseDBUtil.loadAllDeepCopy(typeof(FunctionTable)))
                 {
                     this.functions[functionTable.Name]   = new ExprDBFunction(functionTable);
                     this.definitions[functionTable.Name] = new ExprFunctionDefinition(functionTable);
                 }
             }
             catch (Exception exception)
             {
                 Console.WriteLine(exception.ToString());
                 Console.Write(exception.StackTrace);
             }
         }
     }
     else
     {
         foreach (FunctionTable functionTable1 in paramSession.createQuery("from FunctionTable o left join fetch o.functionArgumentList").list())
         {
             FunctionTable functionTable2 = functionTable1.copyWithVariables();
             this.functions[functionTable1.Name]   = new ExprDBFunction(functionTable2);
             this.definitions[functionTable1.Name] = new ExprFunctionDefinition(functionTable2);
         }
     }
 }
Example #10
0
        public static ProjectInfoTable findProjectInfoFromUrl(ProjectUrlTable paramProjectUrlTable)
        {
            Query query = DatabaseDBUtil.currentSession().createQuery("select prjInfo from ProjectInfoTable as prjInfo join prjInfo.urlSet as urlTable with urlTable.projectUrlId = :urlid");

            query.setLong("urlid", paramProjectUrlTable.ProjectUrlId.Value);
            System.Collections.IEnumerator iterator = query.iterate();
            //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            if (!iterator.hasNext())
            {
                DatabaseDBUtil.closeSession();
                return(null);
            }
            //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            ProjectInfoTable projectInfoTable = (ProjectInfoTable)DatabaseDBUtil.currentSession().load(typeof(ProjectInfoTable), ((ProjectInfoTable)iterator.next()).Id);

            projectInfoTable = projectInfoTable.copyWithAssignments();
            DatabaseDBUtil.closeSession();
            return(projectInfoTable);
        }
        public static IDictionary <long, long> moveModelsFromCEP(UIProgress paramUIProgress, CostOSBimEngineFileDBUtil paramCostOSBimEngineFileDBUtil, IDictionary <long, long> paramMap)
        {
            Hashtable hashMap  = new Hashtable();
            Session   session1 = null;
            Session   session2 = null;

            try
            {
                session1 = paramCostOSBimEngineFileDBUtil.createSession();
                session2 = DatabaseDBUtil.currentSession();
                Session session3 = session1;
                Session session4 = session2;
                paramMap.forEach((paramLong1, paramLong2) =>
                {
                    try
                    {
                        BimImportCEPDataMover bimImportCEPDataMover = new BimImportCEPDataMover(paramUIProgress, paramLong1, paramLong2, paramSession1, paramSession2);
                        long?long            = bimImportCEPDataMover.moveModelsFromCEP();
                        paramMap[paramLong1] = long.Value;
                    }
                    catch (Exception throwable)
                    {
                        Console.WriteLine(throwable.ToString());
                        Console.Write(throwable.StackTrace);
                    }
                });
                cleanup(session2);
            }
            catch (Exception)
            {
                if (session1 != null)
                {
                    session1.close();
                }
                if (session2 != null)
                {
                    session2.close();
                }
                cleanup(session2);
            }
            return(hashMap);
        }
Example #12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private CitiesToLocalizationLoader(java.sql.Connection paramConnection) throws Exception
        private CitiesToLocalizationLoader(Connection paramConnection)
        {
            this.con = paramConnection;
            Console.WriteLine("Caching cities...");
            loadCities();
            Console.WriteLine("Caching averages...");
            loadAverages();
            Console.WriteLine("Loading the location profile...");
            try
            {
                loadProfile();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
                DatabaseDBUtil.currentSession().Transaction.rollback();
                DatabaseDBUtil.closeSession();
            }
        }
Example #13
0
        public TimberlineMigrationUtil(string paramString1, string paramString2, string paramString3, string paramString4)
        {
            paramString1 = "C:\\DPR\\DB-SAVED\\MFL";
            paramString2 = "C:\\DPR\\DB-SAVED\\UNI";
            paramString3 = "C:\\DPR\\DB-SAVED\\CMiC.xls";
            paramString4 = "C:\\DPR\\DB-SAVED\\DPR Items DB.xls";
            Session session = DatabaseDBUtil.currentSession();

            session.beginTransaction();
            try
            {
                Console.WriteLine("Starting Importing of Resources and Crews...");
                session.Transaction.commit();
                session.beginTransaction();
                Console.WriteLine("PROCESSING CSI...");
                loadCSI(session, paramString1);
                session.Transaction.commit();
                session.beginTransaction();
                Console.WriteLine("PROCESSING UNI...");
                loadUniFormat(session, paramString2);
                session.Transaction.commit();
                session.beginTransaction();
                Console.WriteLine("PROCESSING CMIC...");
                loadCmic(session, paramString3);
                session.Transaction.commit();
                session.beginTransaction();
                Console.WriteLine("PROCESSING LINE ITEMS...");
                loadLineItems(session, paramString4);
                session.Transaction.commit();
            }
            catch (Exception exception)
            {
                if (session.Transaction.Active)
                {
                    session.Transaction.rollback();
                }
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
            }
            DatabaseDBUtil.closeSession();
        }
Example #14
0
        public static IDictionary <long, string> getModelsReferedInProject(UIProgress paramUIProgress, Session paramSession, long?paramLong)
        {
            Session  session   = DatabaseDBUtil.currentSession();
            SQLQuery sQLQuery1 = paramSession.createSQLQuery("SELECT DISTINCT DBNAME from CNDON where PRJID = :id and TAKEOFFTYPE = :type");

            sQLQuery1.setLong("id", paramLong.Value);
            sQLQuery1.setString("type", "BIM");
            System.Collections.IList list1     = sQLQuery1.list();
            List <object>            arrayList = new List <object>();

            list1.ForEach(paramString =>
            {
                try
                {
                    paramList.add(Convert.ToInt64(long.Parse(paramString)));
                }
                catch (Exception throwable)
                {
                    logger.error(throwable);
                }
            });
            SQLQuery sQLQuery2 = session.createSQLQuery("select BC_MODEL.ID, BC_MODEL.NAME, BC_MODEL.REV, BC_MODEL.APPNAME, SUM(LEN(BC_GEOMFILE.FDATA)) as SIZE from BC_MODEL JOIN BC_GEOMFILE ON BC_GEOMFILE.MODEL_ID = BC_MODEL.ID where BC_MODEL.ID in (:ids) group by BC_MODEL.ID, BC_MODEL.NAME, BC_MODEL.REV, BC_MODEL.APPNAME");

            sQLQuery2.setParameterList("ids", arrayList);
            System.Collections.IList list2 = sQLQuery2.list();
            Hashtable hashMap = new Hashtable(list2.Count);

            list2.ForEach(paramArrayOfObject =>
            {
                long?long     = Convert.ToInt64(((Number)paramArrayOfObject[0]).longValue());
                string str1   = (string)paramArrayOfObject[1];
                string str2   = (string)paramArrayOfObject[2];
                string str3   = (string)paramArrayOfObject[3];
                Number number = (Number)paramArrayOfObject[4];
                double d      = number.doubleValue() / 1048576.0D;
                paramMap.put(long, string.Format("{0} {1:F2} MB", new object[] { str1, Convert.ToDouble(d) }));
            });
            return(hashMap);
        }
        public virtual void storeToDatabase(FieldCustomizationTable paramFieldCustomizationTable)
        {
            bool    @bool   = !DatabaseDBUtil.hasOpenedSession() ? 1 : 0;
            Session session = DatabaseDBUtil.currentSession();

            if (@bool)
            {
                session.beginTransaction();
            }
            System.Collections.IEnumerator iterator = session.createQuery("from FieldCustomizationTable o where o.name = '" + paramFieldCustomizationTable.Name + "' and o.resourceType = '" + paramFieldCustomizationTable.ResourceType + "'").list().GetEnumerator();
            FieldCustomizationTable        fieldCustomizationTable = paramFieldCustomizationTable;

//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            Console.WriteLine("FOUND: " + iterator.hasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            if (iterator.hasNext())
            {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                fieldCustomizationTable      = (FieldCustomizationTable)iterator.next();
                fieldCustomizationTable.Data = paramFieldCustomizationTable;
                session.update(fieldCustomizationTable);
            }
            else
            {
                long?long = (long?)session.save(fieldCustomizationTable);
                fieldCustomizationTable.Id = long;
            }
            Console.WriteLine("SAVED " + fieldCustomizationTable.DisplayName);
            this.fieldsMap[new FieldCustomizationKey(this, fieldCustomizationTable)] = (FieldCustomizationTable)fieldCustomizationTable.clone();
            if (@bool)
            {
                session.Transaction.commit();
            }
            if (@bool)
            {
                DatabaseDBUtil.closeSession();
            }
        }
        private CCCMigrationUtil(string paramString1, string paramString2, string paramString3)
        {
            Session session = DatabaseDBUtil.currentSession();

            session.beginTransaction();
            try
            {
                Console.WriteLine("Starting Importing...");
                session.Transaction.commit();
                session.beginTransaction();
                loadCSI95(session, paramString1);
                session.Transaction.commit();
                session.beginTransaction();
                loadResourceCodes(session);
                session.Transaction.commit();
                session.beginTransaction();
                loadResources(session, paramString3);
                session.Transaction.commit();
                session.beginTransaction();
                loadOperations(session, paramString3);
                session.Transaction.commit();
                session.beginTransaction();
                loadWorkgroups(session, paramString3);
                session.Transaction.commit();
                session.beginTransaction();
            }
            catch (Exception exception)
            {
                if (session.Transaction.Active)
                {
                    session.Transaction.rollback();
                }
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
            }
            DatabaseDBUtil.closeSession();
        }
        public TimberlineMigrationUtil2(string paramString)
        {
            paramString = "C:\\Cocosing\\DB-SAVED\\LINE_ITEMS.xls";
            Session session = DatabaseDBUtil.currentSession();

            session.beginTransaction();
            try
            {
                Console.WriteLine("Starting Importing of Resources and Crews...");
                Console.WriteLine("PROCESSING LINE ITEMS...");
                loadLineItems(session, paramString);
                session.Transaction.commit();
            }
            catch (Exception exception)
            {
                if (session.Transaction.Active)
                {
                    session.Transaction.rollback();
                }
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
            }
            DatabaseDBUtil.closeSession();
        }
Example #18
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private SPONMigrationUtil(String paramString1, String paramString2) throws Exception
        private SPONMigrationUtil(string paramString1, string paramString2)
        {
            initializeRateConverter();
            this.sponLineItemList = SponLineTimeLoader.loadLineItems(paramString1, paramString2);
            System.Collections.IEnumerator iterator1 = this.sponLineItemList.GetEnumerator();
            this.rootNode = new DefaultMutableTreeNode();
            sbyte b;

            for (b = 0; iterator1.MoveNext(); b++)
            {
                SponLineItem sponLineItem = (SponLineItem)iterator1.Current;
                sponLineItem.Index = b;
                DefaultMutableTreeNode defaultMutableTreeNode = findParentForLineItem(sponLineItem, b);
                defaultMutableTreeNode.add(sponLineItem);
            }
            System.Collections.IEnumerator enumeration = this.rootNode.children();
            LinkedList linkedList = new LinkedList();

            while (enumeration.MoveNext())
            {
                linkedList.AddLast(enumeration.Current);
            }
            Hashtable hashMap = new Hashtable();

            foreach (SponLineItem sponLineItem1 in linkedList)
            {
                SponLineItem sponLineItem2 = null;
                LinkedList   linkedList1   = null;
                System.Collections.IEnumerator enumeration1 = sponLineItem1.children();
                Console.WriteLine("" + sponLineItem1);
                while (enumeration1.MoveNext())
                {
                    SponLineItem sponLineItem = (SponLineItem)enumeration1.Current;
                    string       str          = sponLineItem.Code;
                    if (str.IndexOf("/", StringComparison.Ordinal) != -1)
                    {
                        if (str.IndexOf("N", StringComparison.Ordinal) == -1)
                        {
                            str = StringHelper.SubstringSpecial(str, str.IndexOf("/", StringComparison.Ordinal) + 1, str.Length);
                        }
                        else
                        {
                            str = StringHelper.SubstringSpecial(str, str.IndexOf("/", StringComparison.Ordinal), str.Length);
                        }
                    }
                    if (str.Length == 3)
                    {
                        sponLineItem2          = sponLineItem;
                        linkedList1            = new LinkedList();
                        hashMap[sponLineItem2] = linkedList1;
                        Console.WriteLine(" " + sponLineItem);
                        continue;
                    }
                    if (linkedList1 == null)
                    {
                        Console.WriteLine("I was trying;" + sponLineItem);
                    }
                    linkedList1.AddLast(sponLineItem);
                }
            }
            foreach (SponLineItem sponLineItem in hashMap.Keys)
            {
                foreach (SponLineItem sponLineItem1 in (System.Collections.IList)hashMap[sponLineItem])
                {
                    sponLineItem1.removeFromParent();
                }
                foreach (SponLineItem sponLineItem1 in (System.Collections.IList)hashMap[sponLineItem])
                {
                    sponLineItem.add(sponLineItem1);
                }
            }
            Session     session     = DatabaseDBUtil.currentSession();
            Transaction transaction = session.beginTransaction();

            try
            {
                Console.WriteLine("\n\n\n\n");
                enumeration = this.rootNode.preorderEnumeration();
                b           = 0;
                while (enumeration.MoveNext())
                {
                    DefaultMutableTreeNode defaultMutableTreeNode = (DefaultMutableTreeNode)enumeration.Current;
                    if (defaultMutableTreeNode.Root)
                    {
                        continue;
                    }
                    SponLineItem sponLineItem = (SponLineItem)defaultMutableTreeNode;
                    string       str1         = null;
                    string       str2         = sponLineItem.Code;
                    if (++b % 'Ǵ' == '\x0000')
                    {
                        Console.WriteLine("PROCESSED: " + b + " lines");
                        transaction.commit();
                        DatabaseDBUtil.closeSession();
                        session     = DatabaseDBUtil.currentSession();
                        transaction = session.beginTransaction();
                    }
                    if (b % '✐' == '\x0000')
                    {
                        Thread.Sleep(2000L);
                    }
                    if (sponLineItem.Composite)
                    {
                        if (defaultMutableTreeNode.Path.length == 2)
                        {
                            str1 = str2;
                        }
                        else if (defaultMutableTreeNode.Path.length == 3)
                        {
                            str1 = str2.Substring(0, 1) + "." + str2.Substring(1, str2.Length - 1);
                        }
                        else if (defaultMutableTreeNode.Path.length == 4)
                        {
                            string str4 = ((SponLineItem)defaultMutableTreeNode.Parent).WbsCode;
                            string str5 = StringHelper.SubstringSpecial(str2, str4.Length - 1 - "C".Length, str2.Length);
                            str1 = str4 + "." + str5;
                        }
                        else
                        {
                            SponLineItem sponLineItem1 = (SponLineItem)defaultMutableTreeNode.Parent;
                            string       str           = sponLineItem1.WbsCode;
                            sbyte        b2            = 1;
                            System.Collections.IEnumerator enumeration1 = sponLineItem1.children();
                            while (enumeration1.MoveNext())
                            {
                                SponLineItem sponLineItem2 = (SponLineItem)enumeration1.Current;
                                if (sponLineItem2.Equals(sponLineItem))
                                {
                                    break;
                                }
                                b2++;
                            }
                            str1 = str + "." + b2;
                        }
                    }
                    string str3 = "";
                    for (sbyte b1 = 1; b1 < defaultMutableTreeNode.Path.length; b1++)
                    {
                        str3 = str3 + " ";
                    }
                    if (sponLineItem.Composite)
                    {
                        if (sponLineItem.Depth == 1)
                        {
                            System.Collections.IEnumerator enumeration1 = sponLineItem.children();
                            while (enumeration1.MoveNext())
                            {
                                SponLineItem sponLineItem1 = (SponLineItem)enumeration1.Current;
                                sponLineItem1.MoreDescription.Add(sponLineItem.Description);
                                if (!string.ReferenceEquals(sponLineItem.SecondDescription, null))
                                {
                                    sponLineItem1.MoreSecondDescription.Add(sponLineItem.SecondDescription);
                                }
                            }
                            continue;
                        }
                        if (sponLineItem.ChildCount == 0)
                        {
                            bool         @bool         = sponLineItem.NoteItem;
                            SponLineItem sponLineItem1 = (SponLineItem)defaultMutableTreeNode.Parent;
                            System.Collections.IEnumerator enumeration1 = sponLineItem1.children();
                            bool bool1 = false;
                            while (enumeration1.MoveNext())
                            {
                                SponLineItem sponLineItem2 = (SponLineItem)enumeration1.Current;
                                if (sponLineItem2.Equals(sponLineItem))
                                {
                                    bool1 = true;
                                    continue;
                                }
                                if (bool1 == true)
                                {
                                    if (@bool)
                                    {
                                        sponLineItem2.Notes = sponLineItem.Description;
                                        setNotesToAllSubItems(sponLineItem2, sponLineItem2.Notes);
                                        continue;
                                    }
                                    if (sponLineItem2.NoteItem)
                                    {
                                        string str = sponLineItem2.Description;
                                        sponLineItem2.Description = sponLineItem.Description;
                                        sponLineItem2.Notes       = str;
                                        setNotesToAllSubItems(sponLineItem2, sponLineItem2.Notes);
                                        sponLineItem.Notes = sponLineItem2.Description;
                                    }
                                }
                            }
                            continue;
                        }
                        if (sponLineItem.NoteItem)
                        {
                            setNotesToAllSubItems(sponLineItem, sponLineItem.Description);
                        }
                    }
                    if (!string.ReferenceEquals(str1, null))
                    {
                        if (!str1.StartsWith("C", StringComparison.Ordinal))
                        {
                            sponLineItem.WbsCode = "C" + str1;
                        }
                        else
                        {
                            sponLineItem.WbsCode = str1;
                        }
                        GroupCodeTable groupCodeTable = new GroupCodeTable();
                        groupCodeTable.GroupCode   = sponLineItem.WbsCode;
                        groupCodeTable.Title       = sponLineItem.makeShortTitle();
                        groupCodeTable.Unit        = "";
                        groupCodeTable.UnitFactor  = BigDecimalMath.ONE;
                        groupCodeTable.Description = sponLineItem.Description + "\n" + sponLineItem.Notes;
                        groupCodeTable.Notes       = sponLineItem.Code;
                        groupCodeTable.EditorId    = "spon";
                        session.save(groupCodeTable);
                        continue;
                    }
                    processSponCostItem(sponLineItem, session);
                }
                transaction.commit();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
                transaction.rollback();
            }
            DatabaseDBUtil.closeSession();
            Console.WriteLine("\n\n\n\nUNIT MAP TO CONVERT:");
            System.Collections.IEnumerator iterator2 = this.unitMap.Values.GetEnumerator();
            while (iterator2.MoveNext())
            {
                Console.WriteLine(iterator2.Current);
            }
        }
Example #19
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void loadCCI(java.io.File paramFile, String paramString1, String paramString2, String paramString3) throws Exception
        private void loadCCI(File paramFile, string paramString1, string paramString2, string paramString3)
        {
            StreamReader             bufferedReader           = new StreamReader(paramFile);
            LocalizationProfileTable localizationProfileTable = new LocalizationProfileTable();

            localizationProfileTable.SupportsState = false;
            localizationProfileTable.ProfileName   = paramString3;
            localizationProfileTable.CreateDate    = DateTime.Now;
            localizationProfileTable.LastUpdate    = DateTime.Now;
            localizationProfileTable.CreateUserId  = "rsmeans";
            localizationProfileTable.EditorId      = "rsmeans";
            localizationProfileTable.FromCountry   = "US";
            localizationProfileTable.FromState     = "US AVERAGE";
            long?long = (long?)DatabaseDBUtil.currentSession().save(localizationProfileTable);

            localizationProfileTable   = (LocalizationProfileTable)DatabaseDBUtil.currentSession().load(typeof(LocalizationProfileTable), long);
            this.localizationProfileId = long;
            if (localizationProfileTable.Factors == null)
            {
                localizationProfileTable.Factors = new List <object>();
            }
            sbyte b = 0;

            while (true)
            {
                string str1 = bufferedReader.ReadLine();
                if (string.ReferenceEquals(str1, null))
                {
                    break;
                }
                string str2 = str1.Substring(0, 4);
                string str3 = str1.Substring(4, 3);
                string str4 = str1.Substring(7, 2);
                string str5 = StringUtils.removeSpacesFromEnd(str1.Substring(9, 23));
                string str6 = str1.Substring(32, 3);
                string str7 = StringUtils.removeSpacesFromStart(str1.Substring(35, 12));
                string str8 = StringUtils.removeSpacesFromStart(str1.Substring(47, 12));
                string str9 = StringUtils.removeSpacesFromStart(str1.Substring(59, 12));
                LocalizationFactorTable localizationFactorTable = new LocalizationFactorTable();
                localizationFactorTable.AssemblyFactor      = BigDecimalMath.ONE;
                localizationFactorTable.EquipmentFactor     = BigDecimalMath.ONE;
                localizationFactorTable.Online              = true;
                localizationFactorTable.EditorId            = "rsmeans";
                localizationFactorTable.SubcontractorFactor = BigDecimalMath.ONE;
                localizationFactorTable.LaborFactor         = new BigDecimalFixed(str8);
                localizationFactorTable.MaterialFactor      = new BigDecimalFixed(str7);
                localizationFactorTable.ConsumableFactor    = BigDecimalMath.ONE;
                LocationData locationData = null;
                if (locationData == null)
                {
                    locationData            = new LocationData();
                    locationData.City       = str5.ToUpper();
                    locationData.State      = str4.ToUpper();
                    locationData.Country    = paramString1;
                    locationData.ZipCode    = str3;
                    locationData.GeoPolygon = "";
                    Console.WriteLine("LOADED: " + str3 + ", " + str4 + ", " + str5 + "," + paramString1);
                }
                localizationFactorTable.ToCountry                = locationData.Country;
                localizationFactorTable.ToState                  = locationData.State;
                localizationFactorTable.ToCity                   = locationData.City;
                localizationFactorTable.ToZipCode                = locationData.ZipCode;
                localizationFactorTable.GroupCodeName            = paramString2;
                localizationFactorTable.ParentCode               = str6;
                localizationFactorTable.GeoPolygon               = locationData.GeoPolygon;
                localizationFactorTable.LocalizationProfileTable = localizationProfileTable;
                localizationProfileTable.Factors.Add(localizationFactorTable);
                DatabaseDBUtil.currentSession().save(localizationFactorTable);
                if (++b % 'Ǵ' == 'dz')
                {
                    DatabaseDBUtil.currentSession().Transaction.commit();
                    DatabaseDBUtil.currentSession().beginTransaction();
                    Console.WriteLine("Committed " + b + " factors");
                }
            }
            bufferedReader.Close();
            DatabaseDBUtil.currentSession().update(localizationProfileTable);
        }
Example #20
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void loadProfile() throws Exception
        private void loadProfile()
        {
            DatabaseDBUtil.currentSession().beginTransaction();
            LocalizationProfileTable localizationProfileTable = new LocalizationProfileTable();

            localizationProfileTable.SupportsState = false;
            localizationProfileTable.ProfileName   = "Richardson Base";
            localizationProfileTable.CreateDate    = DateTime.Now;
            localizationProfileTable.LastUpdate    = DateTime.Now;
            localizationProfileTable.CreateUserId  = "richardson";
            localizationProfileTable.EditorId      = "richardson";
            localizationProfileTable.FromCountry   = "US";
            localizationProfileTable.FromState     = "US AVERAGE";
            long?long = (long?)DatabaseDBUtil.currentSession().save(localizationProfileTable);

            localizationProfileTable = (LocalizationProfileTable)DatabaseDBUtil.currentSession().load(typeof(LocalizationProfileTable), long);
            if (localizationProfileTable.Factors == null)
            {
                localizationProfileTable.Factors = new List <object>();
            }
            string            str = "SELECT * FROM CRAFT";
            PreparedStatement preparedStatement = this.con.prepareStatement(str);
            ResultSet         resultSet         = preparedStatement.executeQuery();
            sbyte             b = 0;

            while (resultSet.next())
            {
                int?   integer = Convert.ToInt32(resultSet.getInt(1));
                string str1    = resultSet.getString(2);
                string str2    = resultSet.getString(3);
                string str3    = resultSet.getString(4);
                double?double1;
                double?double2 = (double1 = Convert.ToDouble(resultSet.getDouble(5))).valueOf(resultSet.getDouble(6));
                string str4    = resultSet.getString(7);
                if (str1.Equals("0RICH0"))
                {
                    continue;
                }
                double?                 double3        = (double?)this.averagesMap[str3];
                RichardsonCity          richardsonCity = (RichardsonCity)this.citiesMap[str1];
                double                  d = (double1.Value + double2.Value) / double3.Value;
                LocalizationFactorTable localizationFactorTable = new LocalizationFactorTable();
                localizationFactorTable.AssemblyFactor      = BigDecimalMath.ONE;
                localizationFactorTable.EquipmentFactor     = BigDecimalMath.ONE;
                localizationFactorTable.Online              = true;
                localizationFactorTable.EditorId            = "richardson";
                localizationFactorTable.SubcontractorFactor = BigDecimalMath.ONE;
                localizationFactorTable.LaborFactor         = new BigDecimalFixed("" + d);
                localizationFactorTable.MaterialFactor      = BigDecimalMath.ONE;
                localizationFactorTable.ConsumableFactor    = BigDecimalMath.ONE;
                string str5 = richardsonCity.CountryCode;
                if (str5.Equals("USA"))
                {
                    str5 = "US";
                }
                else if (str5.Equals("CAN"))
                {
                    str5 = "CA";
                }
                LocationData locationData = LocationDataRetriever.Instance.retrieveForNorthAmericaData(richardsonCity.ZipCode, richardsonCity.StateCode, richardsonCity.City, str5);
                if (locationData == null)
                {
                    Console.WriteLine("NO LOCATION DATA FOUND FOR: " + richardsonCity);
                    continue;
                }
                localizationFactorTable.ToCountry                = locationData.Country;
                localizationFactorTable.ToState                  = locationData.State;
                localizationFactorTable.ToCity                   = locationData.City;
                localizationFactorTable.ToZipCode                = locationData.ZipCode;
                localizationFactorTable.GroupCodeName            = "";
                localizationFactorTable.ParentCode               = str3;
                localizationFactorTable.GeoPolygon               = locationData.GeoPolygon;
                localizationFactorTable.LocalizationProfileTable = localizationProfileTable;
                localizationProfileTable.Factors.Add(localizationFactorTable);
                Console.WriteLine("I AM SAVING: " + localizationFactorTable.ToCountry + ", " + localizationFactorTable.ToState + ", " + localizationFactorTable.ToCity + ", " + localizationFactorTable.ToZipCode);
                DatabaseDBUtil.currentSession().save(localizationFactorTable);
                if (++b % 'Ǵ' == 'dz')
                {
                    DatabaseDBUtil.currentSession().Transaction.commit();
                    DatabaseDBUtil.currentSession().beginTransaction();
                    Console.WriteLine("\n\n\n\n\n\nCommitted " + b + " factors");
                }
            }
            preparedStatement.close();
            DatabaseDBUtil.currentSession().Transaction.commit();
            DatabaseDBUtil.closeSession();
        }
Example #21
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.boris.expr.Expr evaluate(org.boris.expr.IEvaluationContext paramIEvaluationContext, org.boris.expr.Expr[] paramArrayOfExpr) throws org.boris.expr.ExprException
        public virtual Expr evaluate(IEvaluationContext paramIEvaluationContext, Expr[] paramArrayOfExpr)
        {
            assertMinArgCount(paramArrayOfExpr, 1);
            for (sbyte b = 0; b < paramArrayOfExpr.Length; b++)
            {
                if (paramArrayOfExpr[b] is org.boris.expr.ExprEvaluatable)
                {
                    paramArrayOfExpr[b] = evalArg(paramIEvaluationContext, paramArrayOfExpr[b]);
                }
            }
            if (!(paramArrayOfExpr[0] is ExprString))
            {
                throw new ExprException("Input " + paramArrayOfExpr[0].ToString() + " is not a String.");
            }
            string str = ((ExprString)paramArrayOfExpr[0]).str;
            bool   bool1;

            for (bool1 = true; bool1 < paramArrayOfExpr.Length; bool1++)
            {
                if (paramArrayOfExpr[bool1] is ExprVariable)
                {
                    paramArrayOfExpr[bool1] = paramIEvaluationContext.evaluateVariable((ExprVariable)paramArrayOfExpr[bool1]);
                }
                if (!(paramArrayOfExpr[bool1] is ExprString) && !(paramArrayOfExpr[bool1] is org.boris.expr.ExprNumber) && !(paramArrayOfExpr[bool1] is ExprBoolean))
                {
                    throw new ExprException("Invalid Parameter Value: " + paramArrayOfExpr[bool1]);
                }
            }
            bool1 = true;
            Session session = null;
            bool    bool2   = true;

            if (paramIEvaluationContext is ExprAbstractEvaluationContext)
            {
                session = ((ExprAbstractEvaluationContext)paramIEvaluationContext).MasterDatabaseSession;
                if (session == null)
                {
                    bool1   = DatabaseDBUtil.hasOpenedSession();
                    session = DatabaseDBUtil.currentSession();
                    bool2   = DatabaseDBUtil.LocalCommunication;
                }
            }
            string[] arrayOfString = null;
            int      i             = 0;

            try
            {
                SQLQuery sQLQuery             = null;
                System.Collections.IList list = Collections.EMPTY_LIST;
                if (bool2)
                {
                    Query query;
                    sQLQuery           = session.createSQLQuery(str);
                    sQLQuery.Cacheable = true;
                    for (sbyte b2 = 1; b2 < paramArrayOfExpr.Length; b2++)
                    {
                        if (paramArrayOfExpr[b2] is ExprString)
                        {
                            query = sQLQuery.setString(b2 - true, ((ExprString)paramArrayOfExpr[b2]).str);
                        }
                        else if (paramArrayOfExpr[b2] is ExprDouble)
                        {
                            query = query.setDouble(b2 - true, ((ExprDouble)paramArrayOfExpr[b2]).doubleValue());
                        }
                        else if (paramArrayOfExpr[b2] is ExprInteger)
                        {
                            query = query.setInteger(b2 - true, ((ExprInteger)paramArrayOfExpr[b2]).intValue());
                        }
                        else if (paramArrayOfExpr[b2] is ExprBoolean)
                        {
                            query = query.setBoolean(b2 - true, ((ExprBoolean)paramArrayOfExpr[b2]).booleanValue());
                        }
                    }
                    list = query.list();
                    if (list.Count != 0)
                    {
                        object @object = list[0];
                        if (@object is BaseEntity)
                        {
                            ClassMetadata classMetadata = ((SessionImplementor)session).Factory.getClassMetadata(@object.GetType());
                            arrayOfString = classMetadata.PropertyNames;
                            if (arrayOfString == null)
                            {
                                throw new Exception("Invalid class name: " + @object.GetType());
                            }
                            i = arrayOfString.Length;
                        }
                        else if (@object is object[])
                        {
                            i = (object[])@object.length;
                        }
                        else
                        {
                            i = 1;
                        }
                    }
                }
                else
                {
                    List <object> arrayList = new List <object>();
                    for (sbyte b2 = 1; b2 < paramArrayOfExpr.Length; b2++)
                    {
                        if (paramArrayOfExpr[b2] is ExprString)
                        {
                            arrayList.Add(new HqlParameterWithValue(b2 - true, ((ExprString)paramArrayOfExpr[b2]).str));
                        }
                        else if (paramArrayOfExpr[b2] is ExprDouble)
                        {
                            arrayList.Add(new HqlParameterWithValue(b2 - true, Convert.ToDouble(((ExprDouble)paramArrayOfExpr[b2]).doubleValue())));
                        }
                        else if (paramArrayOfExpr[b2] is ExprInteger)
                        {
                            arrayList.Add(new HqlParameterWithValue(b2 - true, new long?(((ExprInteger)paramArrayOfExpr[b2]).intValue())));
                        }
                        else if (paramArrayOfExpr[b2] is ExprBoolean)
                        {
                            arrayList.Add(new HqlParameterWithValue(b2 - true, "" + ((ExprBoolean)paramArrayOfExpr[b2]).booleanValue()));
                        }
                    }
                    throw new System.ArgumentException("not implemented as a web service");
                }
                ExprArray exprArray = new ExprArray(list.Count, i);
                sbyte     b1        = 0;
                foreach (object @object in list)
                {
                    if (@object is HqlResultValue[])
                    {
                        HqlResultValue[] arrayOfHqlResultValue = (HqlResultValue[])@object;
                        for (sbyte b2 = 0; b2 < arrayOfHqlResultValue.Length; b2++)
                        {
                            setArrayValue(exprArray, arrayOfHqlResultValue[b2], b1, b2);
                        }
                    }
                    else if (@object is object[])
                    {
                        object[] arrayOfObject = (object[])@object;
                        for (sbyte b2 = 0; b2 < arrayOfObject.Length; b2++)
                        {
                            setArrayValue(exprArray, arrayOfObject[b2], b1, b2);
                        }
                    }
                    else if (@object is BaseEntity)
                    {
                        sbyte b2 = 0;
                        foreach (string str1 in arrayOfString)
                        {
                            object object1 = BlankResourceInitializer.getFieldValue((BaseEntity)@object, str1);
                            setArrayValue(exprArray, object1, b1, b2++);
                        }
                    }
                    else if (i == 1)
                    {
                        setArrayValue(exprArray, @object, b1, 0);
                    }
                    else
                    {
                        if (!bool1)
                        {
                            DatabaseDBUtil.closeSession();
                        }
                        throw new ExprException("Not a persistent class: " + @object.GetType().Name);
                    }
                    b1++;
                }
                if (!bool1)
                {
                    DatabaseDBUtil.closeSession();
                }
                return(exprArray);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                Console.Write(exception.StackTrace);
                if (!bool1)
                {
                    DatabaseDBUtil.closeSession();
                }
                throw new ExprException(exception.Message);
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void backUpAndRestore() throws Exception
        private void backUpAndRestore()
        {
            string str1 = ((ProjectServerDBUtil)this.source).ProjectUrl.DatabaseName;
            string str2 = ((ProjectServerDBUtil)this.dest).ProjectUrl.DatabaseName;
            string str3 = null;
            string str4 = null;

            this.dest.closeProject();
            this.dest.closeSession();
            this.progress.TotalTimes = 7;
            this.progress.Progress   = "Backing up " + str1 + " to " + str2;
            Console.WriteLine("STARTED BACKUP [" + str2 + "] RESTORE TO [" + str1 + "]");
            Session session = DatabaseDBUtil.currentSession();

            try
            {
                string str5 = stringFromQuery(session, "select physical_name from " + str1 + ".sys.database_files where physical_name not like '%.ldf'");
                Console.WriteLine("  SOURCE DATABASE FILE: " + str5);
                if (StringUtils.isNullOrBlank(str5))
                {
                    throw new System.InvalidOperationException("Null database file for: " + str1);
                }
                this.progress.incrementProgress(1);
                DatabaseDBUtil.closeSession();
                executeUpdate(DatabaseDBUtil.currentSession(), "ALTER DATABASE " + str2 + " MODIFY NAME = " + str2 + "tmp");
                DatabaseDBUtil.closeSession();
                session = DatabaseDBUtil.currentSession();
                str3    = str2 + "tmp";
                Console.WriteLine("  RENAMED DESTINATION TEMPORARILY FROM " + str2 + " TO: " + str3);
                this.progress.incrementProgress(1);
                string str6 = str5.Substring(0, str5.LastIndexOf("\\", StringComparison.Ordinal));
                string str7 = str6 + "\\" + str1 + ".bak";
                executeUpdate(session, "BACKUP DATABASE " + str1 + " TO DISK = '" + str7 + "' WITH COPY_ONLY");
                str4 = str7;
                Console.WriteLine("  BACKED UP " + str1 + " TO FILE: " + str7);
                this.progress.incrementProgress(1);
                System.Collections.IList list = session.createSQLQuery("RESTORE FILELISTONLY FROM DISK = '" + str7 + "'").list();
                string str8 = null;
                string str9 = null;
                foreach (object[] arrayOfObject in list)
                {
                    string str12 = arrayOfObject[0].ToString();
                    string str13 = arrayOfObject[2].ToString();
                    if (string.ReferenceEquals(str8, null) && str13.Equals("D"))
                    {
                        str8 = str12;
                        continue;
                    }
                    if (string.ReferenceEquals(str9, null) && str13.Equals("L"))
                    {
                        str9 = str12;
                    }
                }
                if (string.ReferenceEquals(str8, null))
                {
                    throw new Exception("No DATA file found in backup: " + str7);
                }
                if (string.ReferenceEquals(str9, null))
                {
                    throw new Exception("No LOG file found in backup: " + str7);
                }
                this.progress.incrementProgress(1);
                string str10 = str6 + "\\" + str2;
                str10 = StringUtils.replaceAll(str10, "cep_", "cep_b");
                string str11 = "RESTORE DATABASE " + str2 + " FROM DISK = '" + str7 + "' WITH MOVE '" + str8 + "' TO '" + str10 + ".mdf', MOVE '" + str9 + "' TO '" + str10 + ".ldf'";
                this.progress.Progress = "Restoring to " + str2;
                executeUpdate(session, str11);
                Console.WriteLine("  RESTORED FILE " + str7 + " TO DATABASE: " + str2);
                this.progress.incrementProgress(1);
                try
                {
                    executeUpdate(session, "IF DB_ID('" + str3 + "') IS NOT NULL BEGIN DROP DATABASE [" + str3 + "]; END");
                    Console.WriteLine("  DROPPED TEMPORARY DATABASE " + str3);
                }
                catch (Exception exception)
                {
                    Console.WriteLine("WARN: FAILED TO DROP DATABASE: " + str3);
                    Console.WriteLine(exception.ToString());
                    Console.Write(exception.StackTrace);
                }
                this.progress.incrementProgress(1);
                try
                {
                    executeUpdate(session, "EXECUTE master.dbo.xp_delete_file 0,N'" + str4 + "'");
                    Console.WriteLine("  DELETED BACKUP: " + str4);
                }
                catch (Exception exception)
                {
                    Console.WriteLine("WARN: FAILED TO DELETE BACKUP: " + str4);
                    Console.WriteLine(exception.ToString());
                    Console.Write(exception.StackTrace);
                }
                this.progress.incrementProgress(1);
                Console.WriteLine("SUCCESS");
            }
            catch (Exception exception)
            {
                this.progress.Indeterminate = true;
                Console.WriteLine("FAILED: " + exception.Message);
                try
                {
                    if (!string.ReferenceEquals(str3, null))
                    {
                        executeUpdate(session, "ALTER DATABASE " + str3 + " MODIFY NAME = " + str2);
                    }
                }
                catch (Exception exception1)
                {
                    Console.WriteLine("WARN: FAILED TO ALTER DATABASE: " + str3);
                    Console.WriteLine(exception1.ToString());
                    Console.Write(exception1.StackTrace);
                }
                try
                {
                    if (!string.ReferenceEquals(str4, null))
                    {
                        executeUpdate(session, "EXECUTE master.dbo.xp_delete_file 0,N'" + str4 + "'");
                    }
                }
                catch (Exception exception1)
                {
                    Console.WriteLine("WARN: FAILED TO DELETE BACKUP: " + str4);
                    Console.WriteLine(exception1.ToString());
                    Console.Write(exception1.StackTrace);
                }
                DatabaseDBUtil.closeSession();
                throw exception;
            }
            this.progress.Indeterminate = true;
            DatabaseDBUtil.closeSession();
        }
Example #23
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private nomitech.common.db.local.EquipmentTable saveOrUpdateEquipmentTable(org.hibernate.Session paramSession, Desktop.common.nomitech.common.migration.spon.SponLineItem paramSponLineItem) throws Exception
        private EquipmentTable saveOrUpdateEquipmentTable(Session paramSession, SponLineItem paramSponLineItem)
        {
            SponLineItem sponLineItem;

            for (sponLineItem = (SponLineItem)paramSponLineItem.Parent; string.ReferenceEquals(sponLineItem.WbsCode, null); sponLineItem = (SponLineItem)sponLineItem.Parent)
            {
                ;
            }
            double?double = convertToCostOSRate(paramSponLineItem.Unit, paramSponLineItem.Plant);

            null             = BlankResourceInitializer.createBlankEquipment(null);
            null.EquipmentId = null;
            string str1 = paramSponLineItem.makeShortTitle();

            null.Title = str1;
            null.Model = "";
            null.Make  = "";
            string str2 = convertToCostOSUnit(paramSponLineItem.Unit);

            if (string.ReferenceEquals(str2, null))
            {
                throw new Exception("FATAL: UNIT WAS NULL FOR " + paramSponLineItem.Unit);
            }
            null.GroupCode     = sponLineItem.WbsCode + " - " + sponLineItem.makeShortTitle();
            null.GekCode       = "";
            null.ExtraCode1    = "";
            null.ExtraCode2    = "";
            null.ExtraCode3    = "";
            null.ExtraCode4    = "";
            null.ExtraCode5    = "";
            null.ExtraCode6    = "";
            null.ExtraCode7    = "";
            null.ExtraCode8    = "";
            null.ExtraCode9    = "";
            null.ExtraCode10   = "";
            null.Country       = "GB";
            null.StateProvince = "";
            null.Unit          = str2;
            null.EditorId      = "spon";
            null.Unit          = "HOUR";
            if (str2.Equals("DAY"))
            {
                double = Convert.ToDouble(double.Value * 0.125D);
            }
            else if (str2.Equals("WEEK"))
            {
                double = Convert.ToDouble(double.Value * 0.025D);
            }
            else if (str2.Equals("MONTH"))
            {
                double = Convert.ToDouble(double.Value * 0.00625D);
            }
            if (str1.ToLower().IndexOf("diesel", StringComparison.Ordinal) != -1)
            {
                null.FuelType = "DIESEL";
            }
            else if (str1.ToLower().IndexOf("gas", StringComparison.Ordinal) != -1)
            {
                null.FuelType = "PETROL";
            }
            else if (str1.ToLower().IndexOf("electric", StringComparison.Ordinal) != -1)
            {
                null.FuelType = "ELECTRIC";
            }
            else
            {
                null.FuelType = "OTHER";
            }
            null.DepreciationCalculationMethod = EquipmentTable.USER_DEFINED_METHOD;
            null.DepreciationYears             = BigInteger.Parse("6");
            null.OccupationalFactor            = new BigDecimalFixed("0.73");
            null.OccupationHoursPerMonth       = new BigDecimalFixed("175.0");
            null.InitAquasitionPrice           = new BigDecimalFixed("0.0");
            null.InterestRate     = new BigDecimalFixed("0.065");
            null.LubricatesRate   = new BigDecimalFixed("0");
            null.TiresRate        = new BigDecimalFixed("0");
            null.FuelConsumption  = new BigDecimalFixed("0");
            null.SparePartsRate   = new BigDecimalFixed("0");
            null.ReservationRate  = new BigDecimalFixed("" + double);
            null.DepreciationRate = new BigDecimalFixed("0");
            null.FuelRate         = new BigDecimalFixed("0");
            null.TotalRate        = new BigDecimalFixed("" + double);
            null.Currency         = "GBP";
            null.Notes            = "SPON Major Rate";
            null.Description      = paramSponLineItem.makeFullDescription() + "\nCODE: " + paramSponLineItem.Code;
            null.LastUpdate       = this.lastUpdate;
            null.CreateDate       = this.lastUpdate;
            null.CreateUserId     = "spon";
            null.recalculate();
            long?long = null.EquipmentId;

            if (long == null)
            {
                long = (long?)paramSession.save(null);
            }
            else
            {
                paramSession.update(null);
            }
            return((EquipmentTable)DatabaseDBUtil.loadBulk(typeof(EquipmentTable), new long?[] { long })[0]);
        }
Example #24
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private nomitech.common.db.local.SubcontractorTable saveOrSubcontractorTable(org.hibernate.Session paramSession, Desktop.common.nomitech.common.migration.spon.SponLineItem paramSponLineItem, System.Nullable<double> paramDouble) throws Exception
        private SubcontractorTable saveOrSubcontractorTable(Session paramSession, SponLineItem paramSponLineItem, double?paramDouble)
        {
            SponLineItem sponLineItem;

            for (sponLineItem = (SponLineItem)paramSponLineItem.Parent; string.ReferenceEquals(sponLineItem.WbsCode, null); sponLineItem = (SponLineItem)sponLineItem.Parent)
            {
                ;
            }
            null = BlankResourceInitializer.createBlankSubcontractor(null);
            null.SubcontractorId = null;
            null.Title           = paramSponLineItem.makeShortTitle();
            string str = convertToCostOSUnit(paramSponLineItem.Unit);

            if (string.ReferenceEquals(str, null))
            {
                throw new Exception("FATAL: UNIT WAS NULL FOR " + paramSponLineItem.Unit);
            }
            null.GroupCode       = sponLineItem.WbsCode + " - " + sponLineItem.makeShortTitle();
            null.GekCode         = "";
            null.ExtraCode1      = "";
            null.ExtraCode2      = "";
            null.ExtraCode3      = "";
            null.ExtraCode4      = "";
            null.ExtraCode5      = "";
            null.ExtraCode6      = "";
            null.ExtraCode7      = "";
            null.ExtraCode8      = "";
            null.ExtraCode9      = "";
            null.ExtraCode10     = "";
            null.Unit            = str;
            null.EditorId        = "spon";
            null.ContactPerson   = "";
            null.PhoneNumber     = "";
            null.MobileNumber    = "";
            null.FaxNumber       = "";
            null.Email           = "";
            null.Url             = "";
            null.Company         = "";
            null.Performance     = "8";
            null.Address         = "";
            null.City            = "";
            null.IKA             = BigDecimalMath.ZERO;
            null.SubMaterialRate = BigDecimalMath.ZERO;
            null.Rate            = new BigDecimalFixed("" + convertToCostOSRate(paramSponLineItem.Unit, paramDouble));
            null.Project         = "";
            null.Country         = "GB";
            null.StateProvince   = "";
            null.Currency        = "GBP";
            null.Accuracy        = "enum.quotation.accuracy.estimated";
            null.Inclusion       = "enum.inclusion.subonly";
            null.Quantity        = new BigDecimalFixed(0);
            null.Notes           = "SPON Major Rate";
            null.Description     = paramSponLineItem.makeFullDescription() + "\nCODE: " + paramSponLineItem.Code;
            null.LastUpdate      = this.lastUpdate;
            null.CreateDate      = this.lastUpdate;
            null.CreateUserId    = "spon";
            null.recalculate();
            long?long = null.SubcontractorId;

            if (long == null)
            {
                long = (long?)paramSession.save(null);
            }
            else
            {
                paramSession.update(null);
            }
            return((SubcontractorTable)DatabaseDBUtil.loadBulk(typeof(SubcontractorTable), new long?[] { long })[0]);
        }
Example #25
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private nomitech.common.db.local.MaterialTable saveOrUpdateMaterialTable(org.hibernate.Session paramSession, Desktop.common.nomitech.common.migration.spon.SponLineItem paramSponLineItem) throws Exception
        private MaterialTable saveOrUpdateMaterialTable(Session paramSession, SponLineItem paramSponLineItem)
        {
            SponLineItem sponLineItem;

            for (sponLineItem = (SponLineItem)paramSponLineItem.Parent; string.ReferenceEquals(sponLineItem.WbsCode, null); sponLineItem = (SponLineItem)sponLineItem.Parent)
            {
                ;
            }
            null            = BlankResourceInitializer.createBlankMaterial(null);
            null.MaterialId = null;
            null.Title      = paramSponLineItem.makeShortTitle();
            string str = convertToCostOSUnit(paramSponLineItem.Unit);

            if (string.ReferenceEquals(str, null))
            {
                throw new Exception("FATAL: UNIT WAS NULL FOR " + paramSponLineItem.Unit);
            }
            null.GroupCode           = sponLineItem.WbsCode + " - " + sponLineItem.makeShortTitle();
            null.GekCode             = "";
            null.ExtraCode1          = "";
            null.ExtraCode2          = "";
            null.ExtraCode3          = "";
            null.ExtraCode4          = "";
            null.ExtraCode5          = "";
            null.ExtraCode6          = "";
            null.ExtraCode7          = "";
            null.ExtraCode8          = "";
            null.ExtraCode9          = "";
            null.ExtraCode10         = "";
            null.Unit                = str;
            null.EditorId            = "spon";
            null.Weight              = new BigDecimalFixed("0");
            null.WeightUnit          = "KG";
            null.RawMaterial         = "enum.rm.unspecified";
            null.RawMaterialReliance = new BigDecimalFixed("100");
            null.Rate                = new BigDecimalFixed("" + convertToCostOSRate(paramSponLineItem.Unit, paramSponLineItem.Material));
            null.Project             = "";
            null.Country             = "GB";
            null.StateProvince       = "";
            null.Currency            = "GBP";
            null.Notes               = "SPON Major Rate";
            null.Description         = paramSponLineItem.makeFullDescription() + "\nCODE: " + paramSponLineItem.Code;
            null.LastUpdate          = this.lastUpdate;
            null.Accuracy            = "enum.quotation.accuracy.estimated";
            null.Inclusion           = "enum.inclusion.matonly";
            null.Quantity            = new BigDecimalFixed(0);
            null.DistanceToSite      = new BigDecimalFixed(0);
            null.DistanceUnit        = "MILE";
            null.ShipmentRate        = new BigDecimalFixed(0);
            null.FabricationRate     = new BigDecimalFixed(0);
            null.TotalRate           = null.Rate;
            null.CreateDate          = this.lastUpdate;
            null.CreateUserId        = "spon";
            null.recalculate();
            long?long = null.MaterialId;

            if (long == null)
            {
                long = (long?)paramSession.save(null);
            }
            else
            {
                paramSession.update(null);
            }
            return((MaterialTable)DatabaseDBUtil.loadBulk(typeof(MaterialTable), new long?[] { long })[0]);
        }
Example #26
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void saveOrUpdateAssemblyTable(org.hibernate.Session paramSession, Desktop.common.nomitech.common.migration.spon.SponLineItem paramSponLineItem, nomitech.common.db.local.MaterialTable paramMaterialTable, nomitech.common.db.local.SubcontractorTable paramSubcontractorTable, nomitech.common.db.local.EquipmentTable paramEquipmentTable) throws Exception
        private void saveOrUpdateAssemblyTable(Session paramSession, SponLineItem paramSponLineItem, MaterialTable paramMaterialTable, SubcontractorTable paramSubcontractorTable, EquipmentTable paramEquipmentTable)
        {
            SponLineItem sponLineItem;

            for (sponLineItem = (SponLineItem)paramSponLineItem.Parent; string.ReferenceEquals(sponLineItem.WbsCode, null); sponLineItem = (SponLineItem)sponLineItem.Parent)
            {
                ;
            }
            AssemblyTable assemblyTable = BlankResourceInitializer.createBlankAssembly(null);

            assemblyTable.AssemblyId = null;
            assemblyTable.Title      = paramSponLineItem.makeShortTitle();
            string str = convertToCostOSUnit(paramSponLineItem.Unit);

            if (string.ReferenceEquals(str, null))
            {
                throw new Exception("FATAL: UNIT WAS NULL FOR " + paramSponLineItem.Unit);
            }
            assemblyTable.GroupCode             = sponLineItem.WbsCode + " - " + sponLineItem.makeShortTitle();
            assemblyTable.GekCode               = "";
            assemblyTable.Unit                  = str;
            assemblyTable.EditorId              = "spon";
            assemblyTable.StateProvince         = "";
            assemblyTable.Country               = "GB";
            assemblyTable.Currency              = "GBP";
            assemblyTable.Productivity          = BigDecimalMath.ZERO;
            assemblyTable.Project               = "";
            assemblyTable.PublishedRate         = new BigDecimalFixed("" + convertToCostOSRate(paramSponLineItem.Unit, paramSponLineItem.Total));
            assemblyTable.PublishedRevisionCode = paramSponLineItem.Code;
            assemblyTable.Notes                 = "SPON Major Rate";
            assemblyTable.Description           = paramSponLineItem.makeFullDescription() + "\nCODE: " + paramSponLineItem.Code;
            assemblyTable.Virtual               = false;
            assemblyTable.VirtualEquipment      = false;
            assemblyTable.VirtualSubcontractor  = false;
            assemblyTable.VirtualLabor          = false;
            assemblyTable.VirtualMaterial       = false;
            assemblyTable.VirtualConsumable     = false;
            assemblyTable.LastUpdate            = this.lastUpdate;
            assemblyTable.Quantity              = new BigDecimalFixed("0");
            assemblyTable.Accuracy              = "enum.quotation.accuracy.estimated";
            assemblyTable.CreateDate            = assemblyTable.LastUpdate;
            assemblyTable.CreateUserId          = "spon";
            Serializable serializable = assemblyTable.AssemblyId;

            if (serializable == null)
            {
                serializable = paramSession.save(assemblyTable);
            }
            else
            {
                paramSession.update(assemblyTable);
            }
            assemblyTable = (AssemblyTable)paramSession.load(typeof(AssemblyTable), serializable);
            if (paramSubcontractorTable != null)
            {
                paramSubcontractorTable = (SubcontractorTable)DatabaseDBUtil.loadBulk(typeof(SubcontractorTable), new long?[] { paramSubcontractorTable.SubcontractorId })[0];
                AssemblySubcontractorTable assemblySubcontractorTable = new AssemblySubcontractorTable();
                assemblySubcontractorTable.Factor1                     = BigDecimalMath.ONE;
                assemblySubcontractorTable.Factor2                     = BigDecimalMath.ONE;
                assemblySubcontractorTable.Factor3                     = BigDecimalMath.ONE;
                assemblySubcontractorTable.QuantityPerUnit             = BigDecimalMath.ONE;
                assemblySubcontractorTable.QuantityPerUnitFormula      = "";
                assemblySubcontractorTable.QuantityPerUnitFormulaState = ResourceToAssignmentTable.QTYPUFORM_NOFORMULA;
                assemblySubcontractorTable.LocalFactor                 = BigDecimalMath.ONE;
                assemblySubcontractorTable.LocalCountry                = "";
                assemblySubcontractorTable.LocalStateProvince          = "";
                assemblySubcontractorTable.LastUpdate                  = assemblyTable.LastUpdate;
                long?long = (long?)paramSession.save(assemblySubcontractorTable);
                assemblySubcontractorTable.AssemblySubcontractorId = long;
                if (DatabaseDBUtil.LocalCommunication)
                {
                    paramSubcontractorTable.AssemblySubcontractorSet.Add(assemblySubcontractorTable);
                    paramSession.saveOrUpdate(paramSubcontractorTable);
                    assemblyTable.AssemblySubcontractorSet.Add(assemblySubcontractorTable);
                    paramSession.saveOrUpdate(assemblyTable);
                    assemblySubcontractorTable.SubcontractorTable = paramSubcontractorTable;
                    assemblySubcontractorTable.AssemblyTable      = assemblyTable;
                    paramSession.saveOrUpdate(assemblySubcontractorTable);
                }
                else
                {
                    assemblySubcontractorTable = (AssemblySubcontractorTable)DatabaseDBUtil.associateAssemblyResource(assemblyTable, paramSubcontractorTable, assemblySubcontractorTable);
                    assemblyTable = (AssemblyTable)paramSession.load(typeof(AssemblyTable), assemblyTable.Id);
                }
            }
            if (paramMaterialTable != null)
            {
                paramMaterialTable = (MaterialTable)DatabaseDBUtil.loadBulk(typeof(MaterialTable), new long?[] { paramMaterialTable.MaterialId })[0];
                AssemblyMaterialTable assemblyMaterialTable = new AssemblyMaterialTable();
                assemblyMaterialTable.Factor1                     = BigDecimalMath.ONE;
                assemblyMaterialTable.Factor2                     = BigDecimalMath.ONE;
                assemblyMaterialTable.Factor3                     = BigDecimalMath.ONE;
                assemblyMaterialTable.QuantityPerUnit             = BigDecimalMath.ONE;
                assemblyMaterialTable.QuantityPerUnitFormula      = "";
                assemblyMaterialTable.QuantityPerUnitFormulaState = ResourceToAssignmentTable.QTYPUFORM_NOFORMULA;
                assemblyMaterialTable.LocalFactor                 = BigDecimalMath.ONE;
                assemblyMaterialTable.LocalCountry                = "";
                assemblyMaterialTable.LocalStateProvince          = "";
                assemblyMaterialTable.LastUpdate                  = assemblyTable.LastUpdate;
                long?long = (long?)paramSession.save(assemblyMaterialTable);
                assemblyMaterialTable.AssemblyMaterialId = long;
                if (DatabaseDBUtil.LocalCommunication)
                {
                    paramMaterialTable.AssemblyMaterialSet.Add(assemblyMaterialTable);
                    paramSession.saveOrUpdate(paramMaterialTable);
                    assemblyTable.AssemblyMaterialSet.Add(assemblyMaterialTable);
                    paramSession.saveOrUpdate(assemblyTable);
                    assemblyMaterialTable.MaterialTable = paramMaterialTable;
                    assemblyMaterialTable.AssemblyTable = assemblyTable;
                    paramSession.saveOrUpdate(assemblyMaterialTable);
                }
                else
                {
                    assemblyMaterialTable = (AssemblyMaterialTable)DatabaseDBUtil.associateAssemblyResource(assemblyTable, paramMaterialTable, assemblyMaterialTable);
                    assemblyTable         = (AssemblyTable)paramSession.load(typeof(AssemblyTable), assemblyTable.Id);
                }
            }
            if (paramEquipmentTable != null)
            {
                paramEquipmentTable = (EquipmentTable)DatabaseDBUtil.loadBulk(typeof(EquipmentTable), new long?[] { paramEquipmentTable.EquipmentId })[0];
                AssemblyEquipmentTable assemblyEquipmentTable = new AssemblyEquipmentTable();
                assemblyEquipmentTable.Factor1                     = BigDecimalMath.ONE;
                assemblyEquipmentTable.Factor2                     = BigDecimalMath.ONE;
                assemblyEquipmentTable.Factor3                     = BigDecimalMath.ONE;
                assemblyEquipmentTable.QuantityPerUnit             = BigDecimalMath.ONE;
                assemblyEquipmentTable.QuantityPerUnitFormula      = "";
                assemblyEquipmentTable.QuantityPerUnitFormulaState = ResourceToAssignmentTable.QTYPUFORM_NOFORMULA;
                assemblyEquipmentTable.LocalFactor                 = BigDecimalMath.ONE;
                assemblyEquipmentTable.LocalCountry                = "";
                assemblyEquipmentTable.LocalStateProvince          = "";
                assemblyEquipmentTable.EnergyPrice                 = BigDecimalMath.ZERO;
                assemblyEquipmentTable.FuelRate                    = BigDecimalMath.ZERO;
                assemblyEquipmentTable.LastUpdate                  = assemblyTable.LastUpdate;
                long?long = (long?)paramSession.save(assemblyEquipmentTable);
                assemblyEquipmentTable.AssemblyEquipmentId = long;
                if (DatabaseDBUtil.LocalCommunication)
                {
                    paramEquipmentTable.AssemblyEquipmentSet.Add(assemblyEquipmentTable);
                    paramSession.saveOrUpdate(paramEquipmentTable);
                    assemblyTable.AssemblyEquipmentSet.Add(assemblyEquipmentTable);
                    paramSession.saveOrUpdate(assemblyTable);
                    assemblyEquipmentTable.EquipmentTable = paramEquipmentTable;
                    assemblyEquipmentTable.AssemblyTable  = assemblyTable;
                    paramSession.saveOrUpdate(assemblyEquipmentTable);
                }
                else
                {
                    assemblyEquipmentTable = (AssemblyEquipmentTable)DatabaseDBUtil.associateAssemblyResource(assemblyTable, paramEquipmentTable, assemblyEquipmentTable);
                    assemblyTable          = (AssemblyTable)paramSession.load(typeof(AssemblyTable), assemblyTable.Id);
                }
            }
            assemblyTable = (AssemblyTable)paramSession.load(typeof(AssemblyTable), assemblyTable.Id);
            assemblyTable.recalculate();
            paramSession.update(assemblyTable);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private MasterFormatLoader(String paramString1, String paramString2, String paramString3) throws Exception
        private MasterFormatLoader(string paramString1, string paramString2, string paramString3)
        {
            this.costDataFolder = paramString1;
            this.csiType        = paramString3;
            Session     session     = DatabaseDBUtil.currentSession();
            Transaction transaction = session.beginTransaction();

            try
            {
                if (!string.ReferenceEquals(paramString1, null))
                {
                    loadCSICodes("BCCD", "BCCD", session);
                    loadCSICodes("Civil", "CIVL", session);
                    loadCSICodes("Commercial", "COMM", session);
                    loadCSICodes("Concrete", "CONC", session);
                    loadCSICodes("Commercial Renovation (R&R)", "R&R", session);
                    loadCSICodes("Electrical", "ELEC", session);
                    loadCSICodes("Facility", "FACL", session);
                    loadCSICodes("Green Building", "GRN", session);
                    loadCSICodes("Heavy", "HVY", session);
                    loadCSICodes("Interior", "INTR", session);
                    loadCSICodes("Light Commercial", "LITE", session);
                    loadCSICodes("Master", "MSTR", session);
                    loadCSICodes("Mechanical", "MECH", session);
                    loadCSICodes("Open Shop", "Open", session);
                    loadCSICodes("Plumbing", "PLUM", session);
                    loadCSICodes("Residential", "RESI", session);
                    loadCSICodes("Site Work", "SITE", session);
                }
                if (!string.ReferenceEquals(paramString2, null))
                {
                    this.costDataFolder = paramString2;
                    if (paramString3.Equals("MF14.CSI"))
                    {
                        this.csiType = "CSI14";
                    }
                    else if (paramString3.Equals("MF12.CSI"))
                    {
                        this.csiType = "CSI12";
                    }
                    else if (paramString3.Equals("MF04.CSI"))
                    {
                        this.csiType = "CSI04";
                    }
                    else
                    {
                        this.csiType = "CSI95";
                    }
                    loadCSICodesAss("Assembly", "ASM", session);
                    loadCSICodesAss("Civil", "CVL", session);
                    loadCSICodesAss("Commercial", "COM", session);
                    loadCSICodesAss("Concrete", "CON", session);
                    loadCSICodesAss("Electrical", "ELE", session);
                    loadCSICodesAss("Facility", "FAC", session);
                    loadCSICodesAss("Green Building", "GRN", session);
                    loadCSICodesAss("Heavy", "HVY", session);
                    loadCSICodesAss("Interior", "INT", session);
                    loadCSICodesAss("Master", "ALL", session);
                    loadCSICodesAss("Mechanical", "MEC", session);
                    loadCSICodesAss("Plumbing", "PLU", session);
                    loadCSICodesAss("Site Work", "SIT", session);
                    loadCSICodesAss("Square Foot", "SF", session);
                }
                Console.WriteLine("BEFORE COMMIT " + paramString3);
                transaction.commit();
                Console.WriteLine("AFTER COMMIT " + paramString3);
            }
            catch (Exception exception)
            {
                transaction.rollback();
                DatabaseDBUtil.closeSession();
                throw exception;
            }
            DatabaseDBUtil.closeSession();
        }