protected FR_Base Save(DbConnection Connection, DbTransaction Transaction, string ConnectionString)
        {
            //Standard return type
            FR_Base retStatus = new FR_Base();

            bool cleanupConnection  = false;
            bool cleanupTransaction = false;

            try
            {
                bool saveDictionary = false;
                bool saveORMClass   = !Status_IsAlreadySaved || Status_IsDirty;


                //If Status Is Dirty (Meaning the data has been changed) or Status_IsAlreadySaved (Meaning the data is in the database, when loaded) just return
                if (saveORMClass == false && saveDictionary == false)
                {
                    return(FR_Base.Status_OK);
                }


                #region Verify/Create Connections
                //Create Connection if Connection is null
                if (Connection == null)
                {
                    cleanupConnection = true;
                    Connection        = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }

                //Create Transaction if null
                if (Transaction == null)
                {
                    cleanupTransaction = true;
                    Transaction        = Connection.BeginTransaction();
                }

                #endregion

                #region Dictionary Management

                //Save dictionary management
                if (saveDictionary == true)
                {
                    var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
                    //Save the dictionary or update based on if it has already been saved to the database
                    if (Status_IsAlreadySaved)
                    {
                        loader.Update();
                    }
                    else
                    {
                        loader.Save();
                    }
                }
                #endregion

                #region Command Execution
                if (saveORMClass == true)
                {
                    //Retrieve Querry
                    string Query = "";

                    if (Status_IsAlreadySaved == true)
                    {
                        Query = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("CL1_USR.USR_Groups_2_FunctionLevelRight.SQL.Update.sql")).ReadToEnd();
                    }
                    else
                    {
                        Query = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("CL1_USR.USR_Groups_2_FunctionLevelRight.SQL.Insert.sql")).ReadToEnd();
                    }

                    DbCommand command = Connection.CreateCommand();
                    command.Connection     = Connection;
                    command.Transaction    = Transaction;
                    command.CommandText    = Query;
                    command.CommandTimeout = QueryTimeout;

                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "AssignmentID", _AssignmentID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "USR_Account_FunctionLevelRight_RefID", _USR_Account_FunctionLevelRight_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "USR_Group_RefID", _USR_Group_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Creation_Timestamp", _Creation_Timestamp);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Tenant_RefID", _Tenant_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IsDeleted", _IsDeleted);


                    try
                    {
                        var dbChangeCount = command.ExecuteNonQuery();
                        Status_IsAlreadySaved = true;
                        Status_IsDirty        = false;
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                    #endregion

                    #region Cleanup Transaction/Connection
                    //If we started the transaction, we will commit it
                    if (cleanupTransaction && Transaction != null)
                    {
                        Transaction.Commit();
                    }

                    //If we opened the connection we will close it
                    if (cleanupConnection && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw;
            }

            return(retStatus);
        }
Exemple #2
0
        protected FR_Base Save(DbConnection Connection, DbTransaction Transaction, string ConnectionString)
        {
            //Standard return type
            FR_Base retStatus = new FR_Base();

            bool cleanupConnection  = false;
            bool cleanupTransaction = false;

            try
            {
                bool saveDictionary = false;
                bool saveORMClass   = !Status_IsAlreadySaved || Status_IsDirty;


                //If Status Is Dirty (Meaning the data has been changed) or Status_IsAlreadySaved (Meaning the data is in the database, when loaded) just return
                if (saveORMClass == false && saveDictionary == false)
                {
                    return(FR_Base.Status_OK);
                }


                #region Verify/Create Connections
                //Create Connection if Connection is null
                if (Connection == null)
                {
                    cleanupConnection = true;
                    Connection        = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }

                //Create Transaction if null
                if (Transaction == null)
                {
                    cleanupTransaction = true;
                    Transaction        = Connection.BeginTransaction();
                }

                #endregion

                #region Dictionary Management

                //Save dictionary management
                if (saveDictionary == true)
                {
                    var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
                    //Save the dictionary or update based on if it has already been saved to the database
                    if (Status_IsAlreadySaved)
                    {
                        loader.Update();
                    }
                    else
                    {
                        loader.Save();
                    }
                }
                #endregion

                #region Command Execution
                if (saveORMClass == true)
                {
                    //Retrieve Querry
                    string Query = "";

                    if (Status_IsAlreadySaved == true)
                    {
                        Query = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("CL1_HEC_ACT.HEC_ACT_PlannedAction.SQL.Update.sql")).ReadToEnd();
                    }
                    else
                    {
                        Query = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("CL1_HEC_ACT.HEC_ACT_PlannedAction.SQL.Insert.sql")).ReadToEnd();
                    }

                    DbCommand command = Connection.CreateCommand();
                    command.Connection     = Connection;
                    command.Transaction    = Transaction;
                    command.CommandText    = Query;
                    command.CommandTimeout = QueryTimeout;

                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "HEC_ACT_PlannedActionID", _HEC_ACT_PlannedActionID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "HealthcarePlannedActionITL", _HealthcarePlannedActionITL);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Patient_RefID", _Patient_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Appointment_RefID", _Appointment_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "PlannedFor_Date", _PlannedFor_Date);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IsPerformed", _IsPerformed);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IfPerformed_PerformedAction_RefID", _IfPerformed_PerformedAction_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IsToBePerformedExternally", _IsToBePerformedExternally);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "MedicalPractice_RefID", _MedicalPractice_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "MedicalPracticeType_RefID", _MedicalPracticeType_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ToBePerformedBy_BusinessParticipant_RefID", _ToBePerformedBy_BusinessParticipant_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IsPlannedFollowup", _IsPlannedFollowup);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IfPlannedFollowup_PreviousAction_RefID", _IfPlannedFollowup_PreviousAction_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IsCancelled", _IsCancelled);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IfCancelled_Reason", _IfCancelled_Reason);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Creation_Timestamp", _Creation_Timestamp);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Tenant_RefID", _Tenant_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IsDeleted", _IsDeleted);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Modification_Timestamp", _Modification_Timestamp);


                    try
                    {
                        var dbChangeCount = command.ExecuteNonQuery();
                        Status_IsAlreadySaved = true;
                        Status_IsDirty        = false;
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                    #endregion

                    #region Cleanup Transaction/Connection
                    //If we started the transaction, we will commit it
                    if (cleanupTransaction && Transaction != null)
                    {
                        Transaction.Commit();
                    }

                    //If we opened the connection we will close it
                    if (cleanupConnection && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw;
            }

            return(retStatus);
        }
Exemple #3
0
        protected FR_Base Save(DbConnection Connection, DbTransaction Transaction, string ConnectionString)
        {
            //Standard return type
            FR_Base retStatus = new FR_Base();

            bool cleanupConnection  = false;
            bool cleanupTransaction = false;

            try
            {
                bool saveDictionary = false;
                bool saveORMClass   = !Status_IsAlreadySaved || Status_IsDirty;


                //If Status Is Dirty (Meaning the data has been changed) or Status_IsAlreadySaved (Meaning the data is in the database, when loaded) just return
                if (saveORMClass == false && saveDictionary == false)
                {
                    return(FR_Base.Status_OK);
                }


                #region Verify/Create Connections
                //Create Connection if Connection is null
                if (Connection == null)
                {
                    cleanupConnection = true;
                    Connection        = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }

                //Create Transaction if null
                if (Transaction == null)
                {
                    cleanupTransaction = true;
                    Transaction        = Connection.BeginTransaction();
                }

                #endregion

                #region Dictionary Management

                //Save dictionary management
                if (saveDictionary == true)
                {
                    var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
                    //Save the dictionary or update based on if it has already been saved to the database
                    if (Status_IsAlreadySaved)
                    {
                        loader.Update();
                    }
                    else
                    {
                        loader.Save();
                    }
                }
                #endregion

                #region Command Execution
                if (saveORMClass == true)
                {
                    //Retrieve Querry
                    string Query = "";

                    if (Status_IsAlreadySaved == true)
                    {
                        Query = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("CL1_HEC_DIA_STA.HEC_DIA_STA_Diagnosis_ProcedureUsageStatistic.SQL.Update.sql")).ReadToEnd();
                    }
                    else
                    {
                        Query = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("CL1_HEC_DIA_STA.HEC_DIA_STA_Diagnosis_ProcedureUsageStatistic.SQL.Insert.sql")).ReadToEnd();
                    }

                    DbCommand command = Connection.CreateCommand();
                    command.Connection     = Connection;
                    command.Transaction    = Transaction;
                    command.CommandText    = Query;
                    command.CommandTimeout = QueryTimeout;

                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "HEC_DIA_STA_Diagnosis_ProcedureUsageStatisticsID", _HEC_DIA_STA_Diagnosis_ProcedureUsageStatisticsID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "PotentialProcedure_RefID", _PotentialProcedure_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "PotentialDiagnosis_RefID", _PotentialDiagnosis_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "NumberOfOccurences", _NumberOfOccurences);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IsStatistics_ForDoctor", _IsStatistics_ForDoctor);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IfStatistics_ForDoctor_Doctor_RefID", _IfStatistics_ForDoctor_Doctor_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IsStatistics_ForHCG", _IsStatistics_ForHCG);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IfStatistics_ForHCG_HealthcareCommunityGroup_RefID", _IfStatistics_ForHCG_HealthcareCommunityGroup_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "StatisticsPeriod_From", _StatisticsPeriod_From);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "StatisticsPeriod_Through", _StatisticsPeriod_Through);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IsLatestStatisticsData", _IsLatestStatisticsData);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Creation_Timestamp", _Creation_Timestamp);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Tenant_RefID", _Tenant_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IsDeleted", _IsDeleted);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Modification_Timestamp", _Modification_Timestamp);


                    try
                    {
                        var dbChangeCount = command.ExecuteNonQuery();
                        Status_IsAlreadySaved = true;
                        Status_IsDirty        = false;
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                    #endregion

                    #region Cleanup Transaction/Connection
                    //If we started the transaction, we will commit it
                    if (cleanupTransaction && Transaction != null)
                    {
                        Transaction.Commit();
                    }

                    //If we opened the connection we will close it
                    if (cleanupConnection && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw;
            }

            return(retStatus);
        }
Exemple #4
0
        protected FR_Base Save(DbConnection Connection, DbTransaction Transaction, string ConnectionString)
        {
            //Standard return type
            FR_Base retStatus = new FR_Base();

            bool cleanupConnection  = false;
            bool cleanupTransaction = false;

            try
            {
                bool saveDictionary = false;
                bool saveORMClass   = !Status_IsAlreadySaved || Status_IsDirty;


                //If Status Is Dirty (Meaning the data has been changed) or Status_IsAlreadySaved (Meaning the data is in the database, when loaded) just return
                if (saveORMClass == false && saveDictionary == false)
                {
                    return(FR_Base.Status_OK);
                }


                #region Verify/Create Connections
                //Create Connection if Connection is null
                if (Connection == null)
                {
                    cleanupConnection = true;
                    Connection        = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }

                //Create Transaction if null
                if (Transaction == null)
                {
                    cleanupTransaction = true;
                    Transaction        = Connection.BeginTransaction();
                }

                #endregion

                #region Dictionary Management

                //Save dictionary management
                if (saveDictionary == true)
                {
                    var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
                    //Save the dictionary or update based on if it has already been saved to the database
                    if (Status_IsAlreadySaved)
                    {
                        loader.Update();
                    }
                    else
                    {
                        loader.Save();
                    }
                }
                #endregion

                #region Command Execution
                if (saveORMClass == true)
                {
                    //Retrieve Querry
                    string Query = "";

                    if (Status_IsAlreadySaved == true)
                    {
                        Query = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("CL1_ORD_CUO_RFP.ORD_CUO_RFP_IssuedProposalResponse_Position.SQL.Update.sql")).ReadToEnd();
                    }
                    else
                    {
                        Query = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("CL1_ORD_CUO_RFP.ORD_CUO_RFP_IssuedProposalResponse_Position.SQL.Insert.sql")).ReadToEnd();
                    }

                    DbCommand command = Connection.CreateCommand();
                    command.Connection     = Connection;
                    command.Transaction    = Transaction;
                    command.CommandText    = Query;
                    command.CommandTimeout = QueryTimeout;

                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ORD_CUO_RFP_IssuedProposalResponse_PositionID", _ORD_CUO_RFP_IssuedProposalResponse_PositionID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ProposalResponsePositionITPL", _ProposalResponsePositionITPL);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IssuedProposalResponseHeader_RefID", _IssuedProposalResponseHeader_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "CMN_PRO_Product_RefID", _CMN_PRO_Product_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "CMN_PRO_Product_Variant_RefID", _CMN_PRO_Product_Variant_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "CMN_PRO_Product_Release_RefID", _CMN_PRO_Product_Release_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "CreatedFrom_RequestForProposal_Position_RefID", _CreatedFrom_RequestForProposal_Position_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Quantity", _Quantity);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "TotalPrice_WithoutTax", _TotalPrice_WithoutTax);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "TotalPrice_IncludingTax", _TotalPrice_IncludingTax);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "PricePerUnit_WithoutTax", _PricePerUnit_WithoutTax);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "PricePerUnit_IncludingTax", _PricePerUnit_IncludingTax);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IsReplacementProduct", _IsReplacementProduct);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Creation_Timestamp", _Creation_Timestamp);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Tenant_RefID", _Tenant_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IsDeleted", _IsDeleted);


                    try
                    {
                        var dbChangeCount = command.ExecuteNonQuery();
                        Status_IsAlreadySaved = true;
                        Status_IsDirty        = false;
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                    #endregion

                    #region Cleanup Transaction/Connection
                    //If we started the transaction, we will commit it
                    if (cleanupTransaction && Transaction != null)
                    {
                        Transaction.Commit();
                    }

                    //If we opened the connection we will close it
                    if (cleanupConnection && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw;
            }

            return(retStatus);
        }
        protected FR_Base Save(DbConnection Connection, DbTransaction Transaction, string ConnectionString)
        {
            //Standard return type
            FR_Base retStatus = new FR_Base();

            bool cleanupConnection  = false;
            bool cleanupTransaction = false;

            try
            {
                bool saveDictionary = false;
                bool saveORMClass   = !Status_IsAlreadySaved || Status_IsDirty;


                //If Status Is Dirty (Meaning the data has been changed) or Status_IsAlreadySaved (Meaning the data is in the database, when loaded) just return
                if (saveORMClass == false && saveDictionary == false)
                {
                    return(FR_Base.Status_OK);
                }


                #region Verify/Create Connections
                //Create Connection if Connection is null
                if (Connection == null)
                {
                    cleanupConnection = true;
                    Connection        = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }

                //Create Transaction if null
                if (Transaction == null)
                {
                    cleanupTransaction = true;
                    Transaction        = Connection.BeginTransaction();
                }

                #endregion

                #region Dictionary Management

                //Save dictionary management
                if (saveDictionary == true)
                {
                    var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
                    //Save the dictionary or update based on if it has already been saved to the database
                    if (Status_IsAlreadySaved)
                    {
                        loader.Update();
                    }
                    else
                    {
                        loader.Save();
                    }
                }
                #endregion

                #region Command Execution
                if (saveORMClass == true)
                {
                    //Retrieve Querry
                    string Query = "";

                    if (Status_IsAlreadySaved == true)
                    {
                        Query = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("CL1_CMN_BPT_STR.CMN_BPT_STR_Office_SettingsProfile.SQL.Update.sql")).ReadToEnd();
                    }
                    else
                    {
                        Query = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("CL1_CMN_BPT_STR.CMN_BPT_STR_Office_SettingsProfile.SQL.Insert.sql")).ReadToEnd();
                    }

                    DbCommand command = Connection.CreateCommand();
                    command.Connection     = Connection;
                    command.Transaction    = Transaction;
                    command.CommandText    = Query;
                    command.CommandTimeout = QueryTimeout;

                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "CMN_BPT_STR_Office_SettingsProfileID", _CMN_BPT_STR_Office_SettingsProfileID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Office_RefID", _Office_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "AdulthoodAge", _AdulthoodAge);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "RestWarningThreshold_Adults_in_mins", _RestWarningThreshold_Adults_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "RestWarningThreshold_NonAdults_in_mins", _RestWarningThreshold_NonAdults_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "RestMinimumThresholdl_Adults_in_mins", _RestMinimumThresholdl_Adults_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "RestMinimumThresholdl_NonAdults_in_mins", _RestMinimumThresholdl_NonAdults_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "WorkTimeWarningTreshold_Adults_in_mins", _WorkTimeWarningTreshold_Adults_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "WorkTimeWarningTreshold_NonAdults_in_mins", _WorkTimeWarningTreshold_NonAdults_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "WorkTimeMaximumTreshold_Adults_in_mins", _WorkTimeMaximumTreshold_Adults_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "WorkTimeMaximumTreshold_NonAdults_in_mins", _WorkTimeMaximumTreshold_NonAdults_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "WorkStartTimeWarning_NonAdults_in_mins", _WorkStartTimeWarning_NonAdults_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "WorkStartTimeMinimum_NonAdults_in_mins", _WorkStartTimeMinimum_NonAdults_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "WorkEndTimeWarning_NonAdults_in_mins", _WorkEndTimeWarning_NonAdults_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "WorkEndTimeMaximum_NonAdults_in_mins", _WorkEndTimeMaximum_NonAdults_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "WorktimeBalancePeriod_in_months", _WorktimeBalancePeriod_in_months);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "WorkdayStart_in_mins", _WorkdayStart_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "RoosterGridMinimumPlanningUnit_in_mins", _RoosterGridMinimumPlanningUnit_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "MaximumPreWork_Period_in_mins", _MaximumPreWork_Period_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "MaximumPostWork_Period_in_mins", _MaximumPostWork_Period_in_mins);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Creation_Timestamp", _Creation_Timestamp);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "Tenant_RefID", _Tenant_RefID);
                    CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "IsDeleted", _IsDeleted);


                    try
                    {
                        var dbChangeCount = command.ExecuteNonQuery();
                        Status_IsAlreadySaved = true;
                        Status_IsDirty        = false;
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                    #endregion

                    #region Cleanup Transaction/Connection
                    //If we started the transaction, we will commit it
                    if (cleanupTransaction && Transaction != null)
                    {
                        Transaction.Commit();
                    }

                    //If we opened the connection we will close it
                    if (cleanupConnection && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw ex;
            }

            return(retStatus);
        }