Esempio n. 1
0
        ///Это вроде не надо
        //public static void RegisterClient(ClientRegistrationData regData, Func<Guid, string> makeActivationUrl)
        //{
        //    if( regData == null )
        //        throw new ArgumentNullException( "regData" );
        //    if( makeActivationUrl == null )
        //        throw new ArgumentNullException( "makeActivationUrl" );
        //    var maintUid = Guid.NewGuid();
        //    UserMaintDac.AddEntry(
        //        new UserMaintEntry
        //        {
        //            EntryUid = maintUid,
        //            EntryPurpose = UserMaintEntryPurpose.NewClientRegistration,
        //            RegistrationData = regData,
        //            Username = regData.Login,
        //        } );
        //    MailEngine.SendMail(
        //        new MailAddress( regData.Email, regData.ClientCategory == ClientCategory.Legal ? regData.ContactName : regData.ClientName ),
        //        new ClientActivationAlert
        //        {
        //            ActivationUrl = makeActivationUrl( maintUid ),
        //            DaysToLive = GetDaysToLive( UserMaintEntryPurpose.NewClientRegistration ).GetValueOrDefault()
        //        } );
        //}
        //deas 29.03.2011 task3563
        // регистрация клиента с расширенным профилем
        public static void RegisterClient( ClientRegistrationDataExt regDataExt, Func<Guid, string> makeActivationUrl )
        {
            if ( regDataExt == null )
                throw new ArgumentNullException( "regData" );
            if ( makeActivationUrl == null )
                throw new ArgumentNullException( "makeActivationUrl" );

            var maintUid = Guid.NewGuid();

            UserMaintDac.AddEntry(
                new UserMaintEntry
                {
                    EntryUid = maintUid,
                    EntryPurpose = UserMaintEntryPurpose.NewClientRegistration,
                    RegistrationDataExt = regDataExt,
                    Username = regDataExt.Login,
                } );

            //deas 18.04.2011 task3846
            // рассылка писем в зависимости от объемов закупок клиента
            switch ( regDataExt.TradingVolume )
            {
                case TradingVolume.Wholesale:
                    MailEngine.SendMail(
                        new MailAddress( regDataExt.Email, regDataExt.ClientName ),
                        new ClientActivationAlertWhSl
                        {
                            ActivationUrl = makeActivationUrl( maintUid ),
                            DaysToLive = GetDaysToLive( UserMaintEntryPurpose.NewClientRegistration ).GetValueOrDefault()
                        } );
                    break;
                case TradingVolume.Retail:
                    MailEngine.SendMail(
                        new MailAddress( regDataExt.Email, regDataExt.ClientName ),
                        new ClientActivationAlertRet
                        {
                            ActivationUrl = makeActivationUrl( maintUid ),
                            DaysToLive = GetDaysToLive( UserMaintEntryPurpose.NewClientRegistration ).GetValueOrDefault(),
                            RetailUrl = UrlManager.MakeAbsoluteUrl( "/Roz.aspx" )
                        } );
                    break;
                default:
                    //старый код
                    MailEngine.SendMail(
                        new MailAddress( regDataExt.Email, regDataExt.ClientName ),
                        new ClientActivationAlertWhSl
                        {
                            ActivationUrl = makeActivationUrl( maintUid ),
                            DaysToLive = GetDaysToLive( UserMaintEntryPurpose.NewClientRegistration ).GetValueOrDefault()
                        } );
                    break;
            }
        }
Esempio n. 2
0
        //public static string CreateClient( ClientRegistrationData regData, string managerId, bool isRestricted )
        //{
        //    if( regData == null )
        //        throw new ArgumentNullException( "regData" );
        //    return ClientProfile.Create(
        //                regData.ClientName,
        //                regData.ClientCategory,
        //                regData.TradingVolume,
        //                regData.ShippingAddress,
        //                regData.RmsStoreId,
        //                regData.Email,
        //                regData.ContactName,
        //                regData.MainPhone,
        //                regData.AuxPhone1,
        //                regData.AuxPhone2,
        //                regData.FieldOfAction,
        //                regData.DiscountCardNumber,
        //                managerId,
        //                isRestricted ).ClientId;
        //}
        //deas 29.03.2011 task3563
        //новая процедура регистрации клиента с измененным профилем
        /// <summary>
        /// Регистрация клиента с расширенным профилем
        /// </summary>
        /// <param name="regDataExt">Профиль клиента</param>
        /// <param name="managerId">Код менеджера</param>
        /// <param name="isRestricted">Ограниченный доступ</param>
        /// <returns>Код 1С клиента</returns>
        public static int CreateClient( ClientRegistrationDataExt regDataExt, string managerId, bool isRestricted, string InternalFranchName)
        {
            dcCommonDataContext DC = new dcCommonDataContext();
            if ( regDataExt == null )
                throw new ArgumentNullException( "regDataExt" );
            return ClientProfile.Create(
                "","",
                regDataExt.ClientName,
                regDataExt.Email,
                regDataExt.TradingVolume,
                regDataExt.ClientCategory,
                regDataExt.CountryID,
                regDataExt.Locality,
                regDataExt.RmsStoreID,
                regDataExt.ScopeType,
                regDataExt.DiscountCardNumber,
                regDataExt.HowKnow,
                managerId,
                isRestricted,
                InternalFranchName,

                regDataExt.ContactPersonPosition,
                regDataExt.ContactPersonName,
                regDataExt.ContactPersonSurname,
                regDataExt.ContactPersonPhone,
                regDataExt.ContactPersonExtPhone,
                regDataExt.ContactPersonFax,
                regDataExt.ContactPersonEmail,
                regDataExt.DeliveryAddress,

                regDataExt.CompanyName,
                regDataExt.CompanyRegistrationID,
                regDataExt.CompanyAddress,

                regDataExt.BankName,
                regDataExt.IBAN,
                regDataExt.SWIFT,
                regDataExt.BankAddress,

                regDataExt.DirectorName,
                regDataExt.DirectorSurname,

                regDataExt.CorrespondentBankName,
                regDataExt.CorrespondentIBAN,
                regDataExt.CorrespondentSWIFT,
                regDataExt.CorrespondentBankAddress,
                regDataExt.RegisterAs).UserId;
        }