Example #1
0
        protected static FR_Base Execute(DbConnection Connection, DbTransaction Transaction, P_L5RE_DREP_0954 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Base();
            //Put your code here
            ORM_RES_RealestateProperty.Query realestatePropertyQuery = new ORM_RES_RealestateProperty.Query();
            realestatePropertyQuery.RES_RealestatePropertyID = Parameter.RES_RealestatePropertyID;
            realestatePropertyQuery.Tenant_RefID             = securityTicket.TenantID;
            List <ORM_RES_RealestateProperty> realestates = ORM_RES_RealestateProperty.Query.Search(Connection, Transaction, realestatePropertyQuery);
            ORM_RES_RealestateProperty.Query.SoftDelete(Connection, Transaction, realestatePropertyQuery);



            ORM_RES_RealestateProperty_2_PropertyType.Query realestatePropertyType = new ORM_RES_RealestateProperty_2_PropertyType.Query();
            realestatePropertyType.RES_RealestateProperty_Type_RefID = Parameter.RES_RealestatePropertyID;
            realestatePropertyType.Tenant_RefID = securityTicket.TenantID;
            ORM_RES_RealestateProperty_2_PropertyType.Query.SoftDelete(Connection, Transaction, realestatePropertyType);

            ORM_RES_RealestateProperty_2_PropertySourceOfInformation.Query sourceOfInformationQuery = new ORM_RES_RealestateProperty_2_PropertySourceOfInformation.Query();
            sourceOfInformationQuery.RES_RealestateProperty_RefID = Parameter.RES_RealestatePropertyID;
            sourceOfInformationQuery.Tenant_RefID = securityTicket.TenantID;
            ORM_RES_RealestateProperty_2_PropertySourceOfInformation.Query.SoftDelete(Connection, Transaction, sourceOfInformationQuery);

            ORM_RES_RealestateProperty_2_PropertyConstructionType.Query constructionTypeQuery = new ORM_RES_RealestateProperty_2_PropertyConstructionType.Query();
            constructionTypeQuery.RES_RealestateProperty_RefID = Parameter.RES_RealestatePropertyID;
            constructionTypeQuery.Tenant_RefID = securityTicket.TenantID;
            ORM_RES_RealestateProperty_2_PropertyConstructionType.Query.SoftDelete(Connection, Transaction, constructionTypeQuery);


            return(returnValue);

            #endregion UserCode
        }
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5RE_SREPBI_0846 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();
            //Put your code here

            ORM_RES_RealestateProperty realestateProperty = new ORM_RES_RealestateProperty();
            if (Parameter.RES_RealestatePropertyID != Guid.Empty)
            {
                var result = realestateProperty.Load(Connection, Transaction, Parameter.RES_RealestatePropertyID);
                if (result.Status != FR_Status.Success || realestateProperty.RES_RealestatePropertyID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }
            realestateProperty.RealestateProperty_Title                    = Parameter.RealestateProperty_Title;
            realestateProperty.InformationSubmittedBy_Account_RefID        = securityTicket.AccountID;
            realestateProperty.RealestateProperty_InformationDate          = Parameter.RealestateProperty_InformationDate;
            realestateProperty.RealestateProperty_InternalID               = Parameter.RealestateProperty_InternalID;
            realestateProperty.RealestateProperty_ConstructionDate         = Parameter.RealestateProperty_ConstructionDate;
            realestateProperty.RealestateProperty_RefurbishmentDate        = Parameter.RealestateProperty_RefurbishmentDate;
            realestateProperty.RealestateProperty_LivingSpace_in_sqm       = Parameter.RealestateProperty_LivingSpace_in_sqm;
            realestateProperty.RealestateProperty_NumberOfResidentialUnits = Parameter.RealestateProperty_NumberOfResidentialUnits;
            realestateProperty.RealestateProperty_GroundAreaSize_in_sqm    = Parameter.LandRegistrationEntry_GroundAreaSize_in_sqm;
            realestateProperty.Tenant_RefID          = securityTicket.TenantID;
            realestateProperty.Geolocation_Lattitude = Parameter.Lattitude;
            realestateProperty.Geolocation_Longitude = Parameter.Longitude;
            realestateProperty.Save(Connection, Transaction);



            #region ConstructionType

            ORM_RES_RealestateProperty_2_PropertyConstructionType.Query constructionQuery = new ORM_RES_RealestateProperty_2_PropertyConstructionType.Query();
            constructionQuery.RES_RealestateProperty_RefID = realestateProperty.RES_RealestatePropertyID;
            constructionQuery.Tenant_RefID = securityTicket.TenantID;
            List <ORM_RES_RealestateProperty_2_PropertyConstructionType> constructionTypes = ORM_RES_RealestateProperty_2_PropertyConstructionType.Query.Search(Connection, Transaction, constructionQuery);

            if (constructionTypes.Count != 0)
            {
                ORM_RES_RealestateProperty_2_PropertyConstructionType constructionType = constructionTypes[0];
                constructionType.RES_RealestateProperty_ConstructionType_RefID = Parameter.RES_RealestateProperty_ConstructionTypeID;
                constructionType.Save(Connection, Transaction);
            }
            else
            {
                ORM_RES_RealestateProperty_2_PropertyConstructionType constructionType = new ORM_RES_RealestateProperty_2_PropertyConstructionType();
                constructionType.RES_RealestateProperty_ConstructionType_RefID = Parameter.RES_RealestateProperty_ConstructionTypeID;
                constructionType.RES_RealestateProperty_RefID = realestateProperty.RES_RealestatePropertyID;
                constructionType.Tenant_RefID = securityTicket.TenantID;
                constructionType.Save(Connection, Transaction);
            }
            #endregion

            #region sourceOfInformation

            ORM_RES_RealestateProperty_2_PropertySourceOfInformation.Query sourceOfInformationQuery = new ORM_RES_RealestateProperty_2_PropertySourceOfInformation.Query();
            sourceOfInformationQuery.RES_RealestateProperty_RefID = realestateProperty.RES_RealestatePropertyID;
            sourceOfInformationQuery.Tenant_RefID = securityTicket.TenantID;
            List <ORM_RES_RealestateProperty_2_PropertySourceOfInformation> sourceOfInformations = ORM_RES_RealestateProperty_2_PropertySourceOfInformation.Query.Search(Connection, Transaction, sourceOfInformationQuery);

            if (sourceOfInformations.Count != 0)
            {
                ORM_RES_RealestateProperty_2_PropertySourceOfInformation sourceOfInformation = sourceOfInformations[0];
                sourceOfInformation.RES_RealestateProperty_SourceOfInformation_RefID = Parameter.RES_RealestateProperty_SourceOfInformationID;
                sourceOfInformation.Save(Connection, Transaction);
            }
            else
            {
                ORM_RES_RealestateProperty_2_PropertySourceOfInformation sourceOfInformation = new ORM_RES_RealestateProperty_2_PropertySourceOfInformation();
                sourceOfInformation.RES_RealestateProperty_SourceOfInformation_RefID = Parameter.RES_RealestateProperty_SourceOfInformationID;
                sourceOfInformation.RES_RealestateProperty_RefID = realestateProperty.RES_RealestatePropertyID;
                sourceOfInformation.Tenant_RefID = securityTicket.TenantID;
                sourceOfInformation.Save(Connection, Transaction);
            }
            #endregion

            #region PropertyType

            ORM_RES_RealestateProperty_2_PropertyType.Query propertyTypeQuery = new ORM_RES_RealestateProperty_2_PropertyType.Query();
            propertyTypeQuery.RES_RealestateProperty_RefID = realestateProperty.RES_RealestatePropertyID;
            propertyTypeQuery.Tenant_RefID = securityTicket.TenantID;
            List <ORM_RES_RealestateProperty_2_PropertyType> propertyTypes = ORM_RES_RealestateProperty_2_PropertyType.Query.Search(Connection, Transaction, propertyTypeQuery);

            if (propertyTypes.Count != 0)
            {
                ORM_RES_RealestateProperty_2_PropertyType propertyType = propertyTypes[0];
                propertyType.RES_RealestateProperty_Type_RefID = Parameter.RES_RealestateProperty_TypeID;
                propertyType.Save(Connection, Transaction);
            }
            else
            {
                ORM_RES_RealestateProperty_2_PropertyType propertyType = new ORM_RES_RealestateProperty_2_PropertyType();
                propertyType.RES_RealestateProperty_Type_RefID = Parameter.RES_RealestateProperty_TypeID;
                propertyType.RES_RealestateProperty_RefID      = realestateProperty.RES_RealestatePropertyID;
                propertyType.Tenant_RefID = securityTicket.TenantID;
                propertyType.Save(Connection, Transaction);
            }
            #endregion

            returnValue.Result = realestateProperty.RES_RealestatePropertyID;

            return(returnValue);

            #endregion UserCode
        }