Example #1
0
        public SaveResult Update(Account account, int userId, string userName)
        {
            Account oldAccount = BoDB.AccountDb.GetById(account.Id);

            oldAccount.RoleId     = account.RoleId;
            oldAccount.Cellphone  = account.Cellphone;
            oldAccount.Email      = account.Email;
            oldAccount.ModifyBy   = account.ModifyBy;
            oldAccount.ModifyTime = DateTime.UtcNow;

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(AccountBLL).FullName + ".Update";
            actionLog.Username   = userName;
            actionLog.LogContent = "Update Account " + account.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(BoDB.AccountDb.Update(oldAccount)));
        }
Example #2
0
        public SaveResult Deduct(Guid accountId, decimal amount, int userId, string userName)
        {
            GatewayAccount account = FiiiPayEnterpriseDB.AccountsDb.GetById(accountId);

            account.Balance -= amount;

            BalanceStatement bs = new BalanceStatement();

            bs.AccountId = accountId;
            bs.Action    = "Deduct";
            bs.Amount    = amount;
            bs.Balance   = account.Balance;
            bs.Timestamp = DateTime.UtcNow;
            bs.Remark    = "BackOffice Deduct";

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(CryptocurrenciesBLL).FullName + ".Deduct";
            actionLog.Username   = userName;
            actionLog.LogContent = "Deduct GatewayAccount " + accountId;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            FiiiPayEnterpriseDB.AccountsDb.Update(account);
            FiiiPayEnterpriseDB.BalanceStatementDb.Insert(bs);
            return(new SaveResult(true));
        }
Example #3
0
        public SaveResult SaveCreate(AccountRole role, int userId, string userName)
        {
            var hasSameCode = BoDB.AccountRoleDb.IsAny(t => t.Name == role.Name);

            if (hasSameCode)
            {
                return new SaveResult()
                       {
                           Result = false, Message = string.Format("Rolename {0} is exist", role.Name)
                       }
            }
            ;

            role.CreateTime = DateTime.UtcNow;
            BoDB.AccountRoleDb.Insert(role);

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(BORoleBLL).FullName + ".SaveCreate";
            actionLog.Username   = userName;
            actionLog.LogContent = "Create BORole " + role.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(true));
        }
Example #4
0
        public SaveResult SaveEdit(Salesperson sales, int userId, string userName)
        {
            var oldSales = BoDB.SalespersonDb.GetById(sales.Id);

            oldSales.ModifyBy   = sales.ModifyBy;
            oldSales.ModifyTime = DateTime.UtcNow;
            oldSales.SaleName   = sales.SaleName;
            oldSales.Position   = sales.Position;
            oldSales.Gender     = sales.Gender;
            oldSales.Mobile     = sales.Mobile;
            BoDB.SalespersonDb.Update(oldSales);
            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(SalespersonBLL).FullName + ".SaveEdit";
            actionLog.Username   = userName;
            actionLog.LogContent = string.Format("Update Salesperson,ID:{0},SaleName:{1} ", sales.Id, sales.SaleName);
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(true));
        }
Example #5
0
        public SaveResult SaveDelete(int id, int userId, string userName)
        {
            bool hasAccount = BoDB.AccountDb.IsAny(t => t.RoleId == id);

            if (hasAccount)
            {
                return new SaveResult()
                       {
                           Result = false, Message = "There are one or more accounts which is belong to this role"
                       }
            }
            ;

            var result = BoDB.DB.Ado.UseTran(() => {
                BoDB.RoleAuthorityDb.Delete(t => t.RoleId == id);

                BoDB.AccountRoleDb.DeleteById(id);
            });
            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(BORoleBLL).FullName + ".SaveDelete";
            actionLog.Username   = userName;
            actionLog.LogContent = "Delete BORole " + id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(result));
        }
Example #6
0
        public SaveResult SavePermission(int adminId, List <RoleAuthority> roleAuthList, int userId, string userName)
        {
            int roleId = roleAuthList[0].RoleId;

            foreach (var item in roleAuthList)
            {
                item.CreateBy = adminId;

                item.CreateTime = DateTime.UtcNow;
            }

            var result = BoDB.DB.Ado.UseTran(() => {
                BoDB.RoleAuthorityDb.Delete(t => t.RoleId == roleId);
                if (roleAuthList != null)
                {
                    BoDB.RoleAuthorityDb.InsertRange(roleAuthList.ToArray());
                }
            });
            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(BORoleBLL).FullName + ".SavePermission";
            actionLog.Username   = userName;
            var permissionCodes = roleAuthList == null ? "" : (roleAuthList.Select(t => t.PermissionId).ToArray().ToString());

            actionLog.LogContent = string.Format("Save RoleAuthority,roleid:{0},permissioncodes:{1}", roleId, permissionCodes);
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(result));
        }
Example #7
0
        public SaveResult SaveAddPermission(ModulePermission permission, int userId, string userName)
        {
            var module = BoDB.ModuleDb.GetById(permission.ModuleId);

            if (!module.ParentId.HasValue)
            {
                return(new SaveResult(false, "Can't add permission for root module"));
            }

            var hasSameCode = BoDB.ModulePermissionDb.IsAny(t => t.Code == permission.Code);

            if (hasSameCode)
            {
                return(new SaveResult(false, string.Format("The code {0} is exist", permission.Code)));
            }

            permission.CreateTime = DateTime.UtcNow;
            permission.IsDefault  = false;
            BoDB.ModulePermissionDb.Insert(permission);

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(ModuleBLL).FullName + ".SaveAddPermission";
            actionLog.Username   = userName;
            actionLog.LogContent = string.Format("Create ModulePermission,ID:{0},Code:{1} ", permission.Id, permission.Code);
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult());
        }
Example #8
0
        public SaveResult UpdatePassword(UserAccounts account, int userId, string userName, string Type)
        {
            UserAccounts oldAccount = FiiiPayDB.UserAccountDb.GetById(account.Id);

            if (Type.Equals("Password"))
            {
                oldAccount.Password = account.Password;

                var securityVerify = new SecurityVerification(SystemPlatform.FiiiPay);
                securityVerify.DeleteErrorCount(SecurityMethod.Password, account.Id.ToString());
            }
            else if (Type.Equals("PIN"))
            {
                oldAccount.Pin = account.Pin;

                var securityVerify = new SecurityVerification(SystemPlatform.FiiiPay);
                securityVerify.DeleteErrorCount(SecurityMethod.Pin, account.Id.ToString());
            }

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(UserManageBLL).FullName + ".UpdatePassword";
            actionLog.Username   = userName;
            actionLog.LogContent = "Update User Password " + account.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(FiiiPayDB.UserAccountDb.Update(oldAccount)));
        }
        public SaveResult <int> Create(Cryptocurrencies cur, int userId, string userName)
        {
            Cryptocurrencies tmp = FoundationDB.DB.Queryable <Cryptocurrencies>().Where(t => t.Name.Equals(cur.Name)).First();

            if (tmp != null)
            {
                return(new SaveResult <int>(false, "The name already exists.", tmp.Id));
            }
            cur.Withdrawal_Tier = cur.Withdrawal_Tier / 100;
            int newId = FoundationDB.CryptocurrencyDb.InsertReturnIdentity(cur);

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(CryptocurrenciesBLL).FullName + ".Create";
            actionLog.Username   = userName;
            actionLog.LogContent = "Create Cryptocurrencies " + cur.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);
            return(new SaveResult <int>(true, newId));
        }
Example #10
0
        public SaveResult Update(AppVersion model, int userId, string userName)
        {
            var oldModel = FoundationDB.AppVersionDb.GetById(model.Id);

            oldModel.Description   = model.Description;
            oldModel.ForceToUpdate = model.ForceToUpdate;
            oldModel.Url           = model.Url;
            oldModel.Version       = model.Version;

            var updateResult = FoundationDB.AppVersionDb.Update(oldModel);

            if (updateResult)
            {
                int    keyDb = 4;
                string key   = $"Foundation:Version:{model.App}:{model.Platform}";
                Framework.Cache.RedisHelper.KeyDelete(keyDb, key);

                // Create ActionLog
                ActionLog actionLog = new ActionLog();
                actionLog.IPAddress  = GetClientIPAddress();
                actionLog.AccountId  = userId;
                actionLog.CreateTime = DateTime.UtcNow;
                actionLog.ModuleCode = typeof(AppVersionBLL).FullName + ".Update";
                actionLog.Username   = userName;
                actionLog.LogContent = "Update AppVersion " + model.Id;
                ActionLogBLL ab = new ActionLogBLL();
                ab.Create(actionLog);
            }

            return(new SaveResult(updateResult));
        }
Example #11
0
        public SaveResult <int> Create(Currency cur, List <PriceInfos> list, int userId, string userName)
        {
            Currency tmp = FoundationDB.DB.Queryable <Currency>().Where(t => t.Name.Equals(cur.Name)).First();

            if (tmp != null)
            {
                return(new SaveResult <int>(false, "The name already exists.", tmp.ID));
            }

            if (cur.IsFixedPrice)
            {
                FoundationDB.PriceInfoDb.InsertRange(list.ToArray());
            }

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(CryptocurrenciesBLL).FullName + ".Create";
            actionLog.Username   = userName;
            actionLog.LogContent = "Create Currency " + cur.ID;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);
            return(new SaveResult <int>(true, FoundationDB.CurrencyDb.InsertReturnIdentity(cur)));
        }
Example #12
0
        public SaveResult Create(InvestorAccounts investor, int userId, string userName)
        {
            if (CheckNameExt(investor.Username))
            {
                return(new SaveResult(false, "This username already exists!"));
            }

            int id = FiiiPayDB.InvestorAccountDb.InsertReturnIdentity(investor);

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(AccountBLL).FullName + ".Create";
            actionLog.Username   = userName;
            actionLog.LogContent = "Create Investor " + id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);


            return(new SaveResult(true));
        }
Example #13
0
        public SaveResult SaveEdit(Agent agent, int userId, string userName)
        {
            var oldAgent = BoDB.AgentDb.GetById(agent.Id);

            oldAgent.ModifyBy    = agent.ModifyBy;
            oldAgent.ModifyTime  = DateTime.UtcNow;
            oldAgent.CompanyName = agent.CompanyName;
            oldAgent.ContactName = agent.ContactName;
            oldAgent.ContactWay  = agent.ContactWay;
            oldAgent.SaleId      = agent.SaleId;
            oldAgent.CountryId   = agent.CountryId;
            oldAgent.StateId     = agent.StateId;
            oldAgent.CityId      = agent.CityId;
            BoDB.AgentDb.Update(oldAgent);

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(AgentBLL).FullName + ".SaveEdit";
            actionLog.Username   = userName;
            actionLog.LogContent = "Update Agent " + agent.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(true));
        }
Example #14
0
        public SaveResult Update(Advertisings adv, int userId, string userName)
        {
            Advertisings oldAdv = FiiiPayDB.AdvertisingDb.GetById(adv.Id);

            if (adv.PictureEn != Guid.Empty)
            {
                oldAdv.PictureEn = adv.PictureEn;
            }
            if (adv.PictureZh != Guid.Empty)
            {
                oldAdv.PictureZh = adv.PictureZh;
            }
            oldAdv.LinkType  = adv.LinkType;
            oldAdv.Link      = adv.Link;
            oldAdv.Title     = adv.Title;
            oldAdv.Status    = adv.Status;
            oldAdv.StartDate = adv.StartDate;
            oldAdv.EndDate   = adv.EndDate;
            oldAdv.Version   = oldAdv.Version + 1;

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(CryptocurrenciesBLL).FullName + ".Update";
            actionLog.Username   = userName;
            actionLog.LogContent = "Update Advertisings " + adv.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(FiiiPayDB.AdvertisingDb.Update(oldAdv)));
        }
Example #15
0
        public SaveResult SaveEdit(Module module, int userId, string userName)
        {
            var  oldModule   = BoDB.ModuleDb.GetById(module.Id);
            bool codeChanged = oldModule.Code != module.Code;

            if (codeChanged)
            {
                var sameCodeEnity = BoDB.ModuleDb.IsAny(t => t.Code == module.Code);

                if (sameCodeEnity)
                {
                    return new SaveResult()
                           {
                               Result = false, Message = string.Format("Code {0} is exist", module.Code)
                           }
                }
                ;
            }


            oldModule.ModifyBy    = module.ModifyBy;
            oldModule.ModifyTime  = DateTime.UtcNow;
            oldModule.Code        = module.Code;
            oldModule.Icon        = module.Icon;
            oldModule.Name        = module.Name;
            oldModule.PathAddress = module.PathAddress;
            oldModule.ParentId    = module.ParentId;
            oldModule.Sort        = module.Sort;

            BoDB.ModuleDb.Update(oldModule);

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(ModuleBLL).FullName + ".SaveEdit";
            actionLog.Username   = userName;
            actionLog.LogContent = "Update Module " + module.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            //以下推荐方法报错
            //BoDB.DB.Updateable<Module>().UpdateColumns(t => new
            //{
            //    ModifyBy = module.ModifyBy,
            //    ModifyTime = DateTime.UtcNow,
            //    Code = module.Code,
            //    Icon = module.Icon,
            //    Name = module.Name,
            //    PathAddress = module.PathAddress,
            //    ParentId = module.ParentId,
            //    Sort = module.Sort
            //}).Where(t => t.Id == module.Id).ExecuteCommand();

            return(new SaveResult(true, "Save Success"));
        }
Example #16
0
        public SaveResult Update(Currency cur, List <PriceInfos> priceList, int userId, string userName)
        {
            Currency tmp = FoundationDB.DB.Queryable <Currency>().Where(t => t.Name.Equals(cur.Name)).First();

            if (tmp != null && cur.ID != tmp.ID)
            {
                return(new SaveResult(false, "The name already exists."));
            }
            Currency oldCur = FoundationDB.CurrencyDb.GetById(cur.ID);

            oldCur.Name         = cur.Name;
            oldCur.IsFixedPrice = cur.IsFixedPrice;
            oldCur.Code         = cur.Code;
            oldCur.Name_CN      = cur.Name_CN;

            StringBuilder sb = new StringBuilder();

            if (cur.IsFixedPrice)
            {
                int count = 0;
                priceList.ForEach(data =>
                {
                    sb.Append(" Update dbo.PriceInfo " +
                              "SET " +
                              "[Price]=@Price" + count.ToString() +
                              " WHERE [CryptoID]=@CryptoId" + count.ToString() + " and [CurrencyID] = @CurrencyID" + count.ToString() + "; ");
                    count++;
                });
                count = 0;
                SugarParameter[] Paras = new SugarParameter[(priceList.Count * 3)];
                int paraCount          = 0;
                priceList.ForEach(data =>
                {
                    Paras[count] = new SugarParameter("@Price" + paraCount.ToString(), priceList[paraCount].Price);
                    count++;
                    Paras[count] = new SugarParameter("@CryptoID" + paraCount.ToString(), priceList[paraCount].CryptoID);
                    count++;
                    Paras[count] = new SugarParameter("@CurrencyID" + paraCount.ToString(), priceList[paraCount].CurrencyID);
                    count++;
                    paraCount++;
                });
                FoundationDB.DB.Ado.ExecuteCommand(sb.ToString(), Paras);
            }

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(CryptocurrenciesBLL).FullName + ".Update";
            actionLog.Username   = userName;
            actionLog.LogContent = "Update Currency " + cur.ID;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(FoundationDB.CurrencyDb.Update(oldCur)));
        }
Example #17
0
        public SaveResult Create(GatewayAccountViewModel model, int userId, string userName)
        {
            GatewayAccount account = new GatewayAccount();

            account.Id       = model.Id;
            account.Username = model.Username;
            account.Password = PasswordHasher.HashPassword(model.Password);

            account.PhoneCode        = "";
            account.Cellphone        = "";
            account.MerchantName     = "";
            account.Balance          = 0;
            account.Status           = GayewayAccountStatus.Active;
            account.CallbackUrl      = "";
            account.IsVerifiedEmail  = false;
            account.CountryId        = 0;
            account.Currency         = "";
            account.RegistrationDate = DateTime.UtcNow;
            account.SecretKey        = "";
            account.IsAllowPayment   = true;

            GatewayProfile profile = new GatewayProfile();

            profile.AccountId          = model.Id;
            profile.CompanyName        = model.CompanyName;
            profile.Cellphone          = "";
            profile.LicenseNo          = model.LicenseNo;
            profile.LastName           = model.LastName;
            profile.FirstName          = model.FirstName;
            profile.IdentityDocNo      = model.IdentityDocNo;
            profile.IdentityDocType    = model.IdentityDocType;
            profile.IdentityExpiryDate = DateTime.UtcNow;
            profile.Address1           = "";
            profile.City                 = "";
            profile.State                = "";
            profile.Postcode             = "";
            profile.Country              = 0;
            profile.FrontIdentityImage   = model.FrontIdentityImage;
            profile.BackIdentityImage    = model.BackIdentityImage;
            profile.HandHoldWithCard     = model.HandHoldWithCard;
            profile.BusinessLicenseImage = model.BusinessLicenseImage;

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(CryptocurrenciesBLL).FullName + ".Create";
            actionLog.Username   = userName;
            actionLog.LogContent = "Create GatewayAccount " + model.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            FiiiPayEnterpriseDB.AccountsDb.Insert(account);
            FiiiPayEnterpriseDB.ProfilesDb.Insert(profile);
            return(new SaveResult(true));
        }
Example #18
0
        public SaveResult Update(GatewayAccountViewModel model, int userId, string userName)
        {
            GatewayAccount account = FiiiPayEnterpriseDB.AccountsDb.GetById(model.Id);

            account.Id       = model.Id;
            account.Username = model.Username;
            if (!string.IsNullOrWhiteSpace(model.Password))
            {
                account.Password = PasswordHasher.HashPassword(model.Password);
            }

            GatewayProfile profile = FiiiPayEnterpriseDB.ProfilesDb.GetById(model.Id);

            profile.AccountId       = model.Id;
            profile.CompanyName     = model.CompanyName;
            profile.LicenseNo       = model.LicenseNo;
            profile.LastName        = model.LastName;
            profile.FirstName       = model.FirstName;
            profile.IdentityDocNo   = model.IdentityDocNo;
            profile.IdentityDocType = model.IdentityDocType;

            if (model.FrontIdentityImage != Guid.Empty)
            {
                profile.FrontIdentityImage = model.FrontIdentityImage;
            }
            if (model.BackIdentityImage != Guid.Empty)
            {
                profile.BackIdentityImage = model.BackIdentityImage;
            }
            if (model.HandHoldWithCard != Guid.Empty)
            {
                profile.HandHoldWithCard = model.HandHoldWithCard;
            }
            if (model.BusinessLicenseImage != Guid.Empty)
            {
                profile.BusinessLicenseImage = model.BusinessLicenseImage;
            }

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(CryptocurrenciesBLL).FullName + ".Update";
            actionLog.Username   = userName;
            actionLog.LogContent = "Update GatewayAccount " + model.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            FiiiPayEnterpriseDB.AccountsDb.Update(account);
            FiiiPayEnterpriseDB.ProfilesDb.Update(profile);
            return(new SaveResult(true));
        }
Example #19
0
        public SaveResult Update(CountryViewModel country, int userId, string userName)
        {
            CountryAgent agent = new CountryAgent();

            if (!agent.CheckProfileRouters(country.ProfileServerAddress, country.ProfileClientKey, country.ProfileSecretKey))
            {
                return(new SaveResult(false, "ProfilesRouters connection failed"));
            }
            var oldCountry = FoundationDB.CountryDb.GetById(country.Id);

            var result = BoDB.DB.Ado.UseTran(() =>
            {
                ProfileRouters pr = new ProfileRouters()
                {
                    Country       = country.Id,
                    ServerAddress = country.ProfileServerAddress,
                    ClientKey     = country.ProfileClientKey,
                    SecretKey     = country.ProfileSecretKey
                };
                FoundationDB.ProfileRouterDb.Update(pr);

                oldCountry.Name      = country.Name;
                oldCountry.Name_CN   = country.Name_CN;
                oldCountry.Status    = country.Status;
                oldCountry.PhoneCode = country.PhoneCode;
                oldCountry.PinYin    = country.PinYin;
                //oldCountry.IsHot = country.IsHot;
                //oldCountry.CustomerService = country.CustomerService;
                oldCountry.FiatCurrency   = country.FiatCurrency;
                oldCountry.Code           = country.Code;
                oldCountry.IsSupportStore = country.IsSupportStore;
                //oldCountry.FiatCurrencySymbol = country.FiatCurrencySymbol;
                oldCountry.NationalFlagURL = country.NationalFlagURL;
                FoundationDB.CountryDb.Update(oldCountry);
            });



            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(BORoleBLL).FullName + ".Update";
            actionLog.Username   = userName;
            actionLog.LogContent = "Update Country " + country.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);



            return(new SaveResult(true));
        }
Example #20
0
        public SaveResult <int> Create(CountryViewModel country, int userId, string userName)
        {
            CountryAgent agent = new CountryAgent();

            if (!agent.CheckProfileRouters(country.ProfileServerAddress, country.ProfileClientKey, country.ProfileSecretKey))
            {
                return(new SaveResult <int>(false, "ProfilesRouters connection failed"));
            }
            var model = new Countries();

            model.Name      = country.Name;
            model.Name_CN   = country.Name_CN;
            model.PhoneCode = country.PhoneCode;
            model.PinYin    = country.PinYin;
            model.Status    = country.Status;
            //model.IsHot = country.IsHot;
            model.IsSupportStore = country.IsSupportStore;
            //model.CustomerService = country.CustomerService;
            model.FiatCurrency = country.FiatCurrency;
            model.Code         = country.Code;
            //model.FiatCurrencySymbol = country.FiatCurrencySymbol;
            model.NationalFlagURL = country.NationalFlagURL;
            int countryId = FoundationDB.CountryDb.InsertReturnIdentity(model);

            var tran = BoDB.DB.Ado.UseTran(() =>
            {
                ProfileRouters pr = new ProfileRouters()
                {
                    Country       = countryId,
                    ServerAddress = country.ProfileServerAddress,
                    ClientKey     = country.ProfileClientKey,
                    SecretKey     = country.ProfileSecretKey
                };
                FoundationDB.ProfileRouterDb.Insert(pr);
            });


            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(BORoleBLL).FullName + ".Create";
            actionLog.Username   = userName;
            actionLog.LogContent = "Create Country " + country.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);
            var result = new SaveResult <int>();

            result.Data = countryId;
            return(result);
        }
Example #21
0
        public SaveResult UpdateBatch(Dictionary <string, List <string> > list, int userId, string userName)
        {
            if (list == null || list.Count <= 0)
            {
                return(new SaveResult(true));
            }
            int                   count = 0, groupCount = 0;
            StringBuilder         sb        = new StringBuilder();
            StringBuilder         logSb     = new StringBuilder();
            List <SugarParameter> paramList = new List <SugarParameter>();

            foreach (var item in list)
            {
                if (item.Value == null)
                {
                    continue;
                }
                item.Value.ForEach(data =>
                {
                    var nv = data.Split(',');

                    sb.Append($"Update dbo.MasterSettings SET [Value]=@Value{count} WHERE [Name]=@Name{count} and [Group] = @Group{groupCount}; ");
                    logSb.AppendFormat($"{0}={1},", nv[0], nv[1]);

                    paramList.Add(new SugarParameter("@Name" + count, nv[0]));
                    paramList.Add(new SugarParameter("@Value" + count, nv[1]));

                    count++;
                });
                paramList.Add(new SugarParameter("@Group" + groupCount, item.Key));
                groupCount++;
            }

            var sr = FoundationDB.DB.Ado.UseTran(() =>
            {
                FoundationDB.DB.Ado.ExecuteCommand(sb.ToString(), paramList.ToArray());
            });

            if (sr.IsSuccess)
            {
                // Create ActionLog
                ActionLog actionLog = new ActionLog();
                actionLog.IPAddress  = GetClientIPAddress();
                actionLog.AccountId  = userId;
                actionLog.CreateTime = DateTime.UtcNow;
                actionLog.ModuleCode = typeof(MasterSettingBLL).FullName + ".UpdateBatch";
                actionLog.Username   = userName;
                actionLog.LogContent = string.Format("Update MasterSetting, Values:{0}", logSb.ToString().TrimEnd(','));
                ActionLogBLL ab = new ActionLogBLL();
                ab.Create(actionLog);
            }

            return(new SaveResult(sr.IsSuccess, sr.ErrorMessage));
        }
Example #22
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="account"></param>
        /// <param name="userId"></param>
        /// <param name="userName"></param>
        /// <returns></returns>
        public SaveResult UpdatePassword(AdvanceOrders account, int userId, string userName)
        {
            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.Now;
            actionLog.ModuleCode = typeof(AccountBLL).FullName + ".Update";
            actionLog.Username   = userName;
            actionLog.LogContent = "Update AdvanceOrders " + account.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(BoDB.AdvanceOrderDb.Update(account)));
        }
Example #23
0
        public SaveResult Update(List <string> KeyPairValues, int userId, string userName, string group)
        {
            int           count      = 0;
            StringBuilder sb         = new StringBuilder();
            string        logContent = "";

            KeyPairValues.ForEach(data =>
            {
                sb.Append(" Update dbo.MasterSettings " +
                          "SET " +
                          "[Value]=@Value" + count.ToString() +
                          " WHERE [Name]=@Name" + count.ToString() + " and [Group] = @Group; ");
                count++;
            });

            count = 0;
            int paraCount = 0;

            // Connect to database.
            SugarParameter[] Paras = new SugarParameter[(KeyPairValues.Count * 2) + 1];
            // Set parameter values.
            KeyPairValues.ForEach(data =>
            {
                Paras[count] = new SugarParameter("@Value" + paraCount.ToString(), KeyPairValues[paraCount].Split(',')[1]);
                count++;
                Paras[count] = new SugarParameter("@Name" + paraCount.ToString(), KeyPairValues[paraCount].Split(',')[0]);
                logContent  += KeyPairValues[paraCount].Split(',')[1] + ",";
                count++;
                paraCount++;
            });
            Paras[KeyPairValues.Count * 2] = new SugarParameter("@Group", group);

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(MasterSettingBLL).FullName + ".Update";
            actionLog.Username   = userName;
            actionLog.LogContent = string.Format("Update MasterSetting, Values:{0}", logContent.TrimEnd(','));
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(FoundationDB.DB.Ado.ExecuteCommand(sb.ToString(), Paras) > 0));
        }
Example #24
0
        public SaveResult Update(Feedbacks fb, int userId, string userName)
        {
            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(FeedbacksBLL).FullName + ".Update";
            actionLog.Username   = userName;
            actionLog.LogContent = "Update Feedbacks " + fb.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(FiiiPayDB.FeedbacksDb.Update(fb)));
        }
Example #25
0
        public SaveResult DeleteById(int id, int userId, string userName)
        {
            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(POSBLL).FullName + ".DeleteById";
            actionLog.Username   = userName;
            actionLog.LogContent = "Delete POS " + id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(FiiiPayDB.POSDb.DeleteById(id)));
        }
Example #26
0
        public SaveResult Delete(int Id, int userId, string userName)
        {
            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(AccountBLL).FullName + ".Update";
            actionLog.Username   = userName;
            actionLog.LogContent = "Delete PriceInfos " + Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(FoundationDB.PriceInfoDb.DeleteById(Id)));
        }
Example #27
0
        public SaveResult BatchDelete(string ids, int userId, string userName)
        {
            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(AccountBLL).FullName + ".BatchDelete";
            actionLog.Username   = userName;
            actionLog.LogContent = "BatchDelete Account " + ids;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(BoDB.AccountDb.DeleteByIds(ids.Split(','))));
        }
Example #28
0
        public SaveResult Create(PriceInfos model, int userId, string userName)
        {
            model.LastUpdateDate = DateTime.UtcNow;
            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(AccountBLL).FullName + ".Create";
            actionLog.Username   = userName;
            actionLog.LogContent = "Create PriceInfos " + model.ID;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(FoundationDB.PriceInfoDb.Insert(model)));
        }
Example #29
0
        public SaveResult Delete(int agentId, int userId, string userName)
        {
            BoDB.AgentDb.DeleteById(agentId);
            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(AgentBLL).FullName + ".Delete";
            actionLog.Username   = userName;
            actionLog.LogContent = "Delete Agent " + agentId;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(true));
        }
Example #30
0
        public SaveResult <int> Create(Advertisings adv, int userId, string userName)
        {
            adv.Version    = 1;
            adv.CreateTime = DateTime.Now;
            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(CryptocurrenciesBLL).FullName + ".Create";
            actionLog.Username   = userName;
            actionLog.LogContent = "Create Advertisings " + adv.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);
            return(new SaveResult <int>(true, FiiiPayDB.AdvertisingDb.InsertReturnIdentity(adv)));
        }