示例#1
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L6RP_SNRPFMA_1321 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();
            P_L5RE_SREPBI_0846 realestateParam = new P_L5RE_SREPBI_0846();
            realestateParam.InformationSubmittedBy_Account_RefID        = securityTicket.AccountID;
            realestateParam.LandRegistrationEntry_GroundAreaSize_in_sqm = 0;
            realestateParam.RealestateProperty_ConstructionDate         = new DateTime(0);
            realestateParam.RealestateProperty_InformationDate          = DateTime.Now;
            realestateParam.RealestateProperty_InternalID               = Guid.NewGuid().ToString();
            realestateParam.RealestateProperty_LivingSpace_in_sqm       = 0;
            realestateParam.RealestateProperty_NumberOfResidentialUnits = 0;
            realestateParam.RealestateProperty_RefurbishmentDate        = new DateTime(0);
            realestateParam.RealestateProperty_Title = Parameter.Title;
            realestateParam.RES_RealestateProperty_ConstructionTypeID    = Guid.Empty;
            realestateParam.RES_RealestateProperty_SourceOfInformationID = Guid.Empty;
            realestateParam.RES_RealestateProperty_TypeID = Guid.Empty;
            realestateParam.Longitude = Parameter.Longitude;
            realestateParam.Lattitude = Parameter.Lattitude;

            returnValue.Result = cls_Save_RealestateProperty_BasicInfo.Invoke(Connection, Transaction, realestateParam, securityTicket).Result;



            P_L5LI_SLI_1538 locationInfoParam = new P_L5LI_SLI_1538();
            locationInfoParam.City_Name       = Parameter.City;
            locationInfoParam.City_PostalCode = Parameter.ZipCode;
            locationInfoParam.City_Region     = Parameter.Region;
            L3CTR_GAC_1420[] countries = cls_Get_All_Countries.Invoke(Connection, Transaction, securityTicket).Result;

            if (countries.Any(c => c.Country_ISOCode_Alpha2 == Parameter.Country))
            {
                locationInfoParam.Country_RefID = countries.Where(c => c.Country_ISOCode_Alpha2 == Parameter.Country).Select(c => c.CMN_CountryID).FirstOrDefault();

                ORM_CMN_Address address = new ORM_CMN_Address();
                address.Tenant_RefID    = securityTicket.TenantID;
                address.Country_ISOCode = Parameter.Country;
                address.Save(Connection, Transaction);

                locationInfoParam.AddressID = address.CMN_AddressID;
            }

            locationInfoParam.Province_Name        = Parameter.Province;
            locationInfoParam.Street_Name          = Parameter.StreetName;
            locationInfoParam.Street_Number        = Parameter.StreetNumber;
            locationInfoParam.RealestatePropertyID = returnValue.Result;

            cls_Save_LocationInformation.Invoke(Connection, Transaction, locationInfoParam, securityTicket);

            foreach (var building in Parameter.Buildings)
            {
                P_L5BD_SB_1359 buildingParam = new P_L5BD_SB_1359();
                buildingParam.AppartmentCount        = building.numberOfApartments;
                buildingParam.atticsCount            = building.numberOfAttics;
                buildingParam.basementsCount         = building.numberOfBasements;
                buildingParam.Building_Name          = building.name;
                buildingParam.facadesCount           = building.numberOfFacades;
                buildingParam.hvarcsCount            = building.numberOfHvacrs;
                buildingParam.outdoorfacilitiesCount = building.numberOfOutdoorFacilities;
                buildingParam.RealestatePropertyID   = returnValue.Result;
                buildingParam.roofCount       = building.numberOfRoofs;
                buildingParam.staircasesCount = building.numberOfStaircases;
                buildingParam.Building_Name   = building.name;
                cls_Save_Building.Invoke(Connection, Transaction, buildingParam, securityTicket);
            }
            //Put your code here
            return(returnValue);

            #endregion UserCode
        }
示例#2
0
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_Guid Invoke(DbConnection Connection, DbTransaction Transaction, P_L6RP_SNRPFMA_1321 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
示例#3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_Guid Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L6RP_SNRPFMA_1321 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_Save_NewRealestatePropertiy_For_MobileApp", ex);
            }
            return(functionReturn);
        }
示例#4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_Guid Invoke(string ConnectionString, P_L6RP_SNRPFMA_1321 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }