protected override void Up()
        {
            this.RunCode(db =>
            {
                var ccRepo = RF.Concrete<ClientCategoryRepository>();
                var cclist = ccRepo.GetAll();
                if (cclist.Count == 0)
                {
                    using (var tran = RF.TransactionScope(ccRepo))
                    {
                        var supplier = new ClientCategory { Name = ClientCategory.SupplierName };
                        var customer = new ClientCategory { Name = ClientCategory.CustomerName };
                        RF.Save(supplier);
                        RF.Save(customer);

                        var clientRepo = RF.Concrete<ClientInfoRepository>();
                        clientRepo.Save(new ClientInfo
                        {
                            ClientCategory = supplier,
                            Name = "新新服装加工厂",
                            FaRenDaiBiao = "新新",
                            YouXiang = "[email protected]",
                            KaiHuYinHang = "中国银行",
                        });
                        clientRepo.Save(new ClientInfo
                        {
                            ClientCategory = supplier,
                            Name = "乐多食品加工厂",
                            FaRenDaiBiao = "乐多",
                            YouXiang = "[email protected]",
                            KaiHuYinHang = "中国银行",
                        });
                        clientRepo.Save(new ClientInfo
                        {
                            ClientCategory = supplier,
                            Name = "腾飞服装有限公司",
                            FaRenDaiBiao = "腾飞",
                            YouXiang = "[email protected]",
                            KaiHuYinHang = "中国银行",
                        });
                        clientRepo.Save(new ClientInfo
                        {
                            ClientCategory = customer,
                            Name = "好又多商场",
                            FaRenDaiBiao = "李海",
                            ShouJiaJiBie = ShouJiaJiBie.JiBie_2,
                            YouXiang = "[email protected]",
                            KaiHuYinHang = "中国银行",
                        });

                        tran.Complete();
                    }
                }
            });
        }
Example #2
0
 public int IndexOf(ClientCategory entity)
 {
     return base.IndexOf(entity);
 }
Example #3
0
 public bool Contains(ClientCategory entity)
 {
     return base.Contains(entity);
 }
Example #4
0
 public void Add(ClientCategory entity)
 {
     base.Add(entity);
 }
Example #5
0
 public bool Remove(ClientCategory entity)
 {
     return base.Remove(entity);
 }
Example #6
0
 public void Insert(int index, ClientCategory entity)
 {
     base.Insert(index, entity);
 }
Example #7
0
        public static ClientProfile Create(
            string login,
            string password,
            string clientName,
            string email,
            TradingVolume tradingVolume,
            ClientCategory clientCategory,
            int countryID,
            string locality,
            string rmsStoreID,
            string scopeType,
            string discountCardNumber,
            string howKnow,
            string managerId,
            bool isRestricted,
            string internalFranchName,
            
            string contactPersonPosition,
            string contactPersonName,
            string contactPersonSurname,
            string contactPersonPhone,
            string contactPersonExtPhone,
            string contactPersonFax,
            string contactPersonEmail,
            string deliveryAddress,
            
            string companyName,
            string companyRegistrationID,
            string companyAddress,
            
            string bankName,
            string IBAN,
            string SWIFT,
            string bankAddress,
            
            string directorName,
            string directorSurname,
            
            string correspondentBankName,
            string correspondentIBAN,
            string correspondentSWIFT,
            string correspondentBankAddress,
            int RegisterAs
            )
        {
            if ( string.IsNullOrEmpty( clientName ) )
                throw new ArgumentException( "Client name cannot be empty", "clientName" );
            //    if ( string.IsNullOrEmpty( contactPersonPhone ) )
              //          throw new ArgumentException( "Main phone number must be specified" );

            var profile = new ClientProfile()
            {
                ClientId = "",
                ClientName = clientName,
                Email = email,
                TradingVolume = tradingVolume,
                Category = clientCategory,
                CountryID = countryID,
                Locality = locality,
                RmsStoreId = rmsStoreID,
                ScopeType = scopeType,
                DiscountCardNumber = discountCardNumber,
                HowKnow = howKnow,
                IsRestricted = isRestricted,
                PrepaymentPercent = 0M,
                PersonalMarkup = 0M,
                Balance = 0M,
                DelayCredit = 0M,
                InternalFranchName = internalFranchName,

                ContactPersonPosition = contactPersonPosition,
                ContactPersonName = contactPersonName,
                ContactPersonSurname = contactPersonSurname,
                ContactPersonPhone = contactPersonPhone,
                ContactPersonExtPhone = contactPersonExtPhone,
                ContactPersonFax = contactPersonFax,
                ContactPersonEmail = contactPersonEmail,
                DeliveryAddress = deliveryAddress,

                BankName = bankName,
                IBAN = IBAN,
                SWIFT = SWIFT,
                BankAddress = bankAddress,

                DirectorName = directorName,
                DirectorSurname = directorSurname,

                CorrespondentBankName = correspondentBankName,
                CorrespondentIBAN = correspondentIBAN,
                CorrespondentSWIFT = correspondentSWIFT,
                CorrespondentBankAddress = correspondentBankAddress,
                RegisterAs = RegisterAs
            };

            RmsAuto.Acctg.ClientGroup clientGroup = tradingVolume == TradingVolume.Retail ? RmsAuto.Acctg.ClientGroup.DefaultRetail : RmsAuto.Acctg.ClientGroup.DefaultWholesale;

            using (var DC = new DCFactory<StoreDataContext>())
            {

                var rezIns = DC.DataContext.spInsUsers( login, password, clientName, email, (byte)tradingVolume, (byte)clientCategory,
                countryID, /*regionID,*/ locality, /*contactLastName, contactFirstName, contactMiddleName,
                contactPhone, contactExtPhone,*/ scopeType, howKnow, managerId, "", false, isRestricted,
                (int)clientGroup, 100M, 0M, /*contactFax, scheduleOfice, scheduleStock, shippingAddress,*/
                rmsStoreID, /*discountCardNumber, contactPosition, legalName, IPName, iNN, oGRNIP, kPP, oGRN,
                nDSAggent, oficialAddress, realAddress, account, bankBIC, bankINN, directorPosition,
                directorLastName, directorFirstName, directorMiddleName, balanceManPosition,
                balanceManLastName, balanceManFirstName, balanceManMiddleName,
                balanceManPhone, balanceManEmail,*/ internalFranchName,
                contactPersonPosition, contactPersonName, contactPersonSurname, contactPersonPhone, contactPersonExtPhone,
                contactPersonFax, contactPersonEmail, deliveryAddress, companyName, companyRegistrationID, companyAddress,
                bankName, IBAN, SWIFT, bankAddress, directorName, directorSurname, correspondentBankName,
                correspondentIBAN, correspondentSWIFT, correspondentBankAddress, RegisterAs);
                profile.UserId = rezIns.ToList().FirstOrDefault().UserID.Value;
            }

            return profile;
        }