Exemplo n.º 1
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5CU_CACDA_1644 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();
            //Put your code here

            if (Parameter.IsCompany)
            {
                ORM_CMN_COM_CompanyInfo_Address.Query queryComAdressIsDefault = new ORM_CMN_COM_CompanyInfo_Address.Query();
                queryComAdressIsDefault.IsDefault         = true;
                queryComAdressIsDefault.CompanyInfo_RefID = Parameter.CompanyInfoID;
                queryComAdressIsDefault.IsBilling         = Parameter.IsBilling;
                queryComAdressIsDefault.IsShipping        = !Parameter.IsBilling;

                List <ORM_CMN_COM_CompanyInfo_Address> companyAdresses = ORM_CMN_COM_CompanyInfo_Address.Query.Search(Connection, Transaction, queryComAdressIsDefault);
                if (companyAdresses.Count != 0 || companyAdresses != null)
                {
                    foreach (ORM_CMN_COM_CompanyInfo_Address item1 in companyAdresses)
                    {
                        item1.IsDefault = false;
                        item1.Save(Connection, Transaction);
                    }
                }
            }
            else
            {
                ORM_CMN_PER_PersonInfo_2_Address.Query queryPerAdressIsDefault = new ORM_CMN_PER_PersonInfo_2_Address.Query();
                queryPerAdressIsDefault.IsPrimary = true;
                queryPerAdressIsDefault.CMN_PER_PersonInfo_RefID = Parameter.PersonInfoID;
                queryPerAdressIsDefault.IsAddress_Billing        = Parameter.IsBilling;
                queryPerAdressIsDefault.IsAddress_Shipping       = !Parameter.IsBilling;

                List <ORM_CMN_PER_PersonInfo_2_Address> personAdresses = ORM_CMN_PER_PersonInfo_2_Address.Query.Search(Connection, Transaction, queryPerAdressIsDefault);
                if (personAdresses.Count != 0 || personAdresses != null)
                {
                    foreach (ORM_CMN_PER_PersonInfo_2_Address item1 in personAdresses)
                    {
                        item1.IsPrimary = false;
                        item1.Save(Connection, Transaction);
                    }
                }
            }

            return(returnValue);

            #endregion UserCode
        }
Exemplo n.º 2
0
 ///<summary>
 /// Ivokes the method with the given Connection, leaving it open if no exceptions occured
 ///<summary>
 public static FR_Guid Invoke(DbConnection Connection, P_L5CU_CACDA_1644 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, null, null, Parameter, securityTicket));
 }
Exemplo n.º 3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_Guid Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5CU_CACDA_1644 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_Guid functionReturn = new FR_Guid();

            try
            {
                if (cleanupConnection == true)
                {
                    Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                if (cleanupTransaction == true)
                {
                    Transaction = Connection.BeginTransaction();
                }

                functionReturn = Execute(Connection, Transaction, Parameter, securityTicket);

                #region Cleanup Connection/Transaction
                //Commit the transaction
                if (cleanupTransaction == true)
                {
                    Transaction.Commit();
                }
                //Close the connection
                if (cleanupConnection == true)
                {
                    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 new Exception("Exception occured in method cls_Clear_All_Customer_Default_Addresses", ex);
            }
            return(functionReturn);
        }