Beispiel #1
0
        public MoneyMovementJob(ApplicationDbContext dbContext, ISlothService slothService, INotificationService notificationService, IOptions <FinanceSettings> financeSettings)
        {
            _dbContext           = dbContext;
            _slothService        = slothService;
            _notificationService = notificationService;

            _financeSettings = financeSettings.Value;
        }
        public void UpdateFinanceSettings(FinanceSettings entity)
        {
            FinanceSettings info = this.LoadByKey <FinanceSettings>(entity.FinanceId);

            info.UserId      = entity.UserId;
            info.OperateType = entity.OperateType;
            info.OperateRank = entity.OperateRank;
            info.MinMoney    = entity.MinMoney;
            info.MaxMoney    = entity.MaxMoney;
            info.UserId      = entity.UserId;
            info.CreateTime  = DateTime.Now;
            this.Update <FinanceSettings>(info);
        }
Beispiel #3
0
        public void FinanceSetting(string opeType, FinanceSettingsInfo info, string operatorId)
        {
            try
            {
                using (var manage = new UserBalanceManager())
                {
                    if (info != null)
                    {
                        FinanceSettings entity = new FinanceSettings();
                        ObjectConvert.ConverInfoToEntity(info, ref entity);
                        entity.OperatorId = operatorId;
                        entity.CreateTime = DateTime.Now;
                        switch (opeType.ToLower())
                        {
                        case "add":
                            AddFinanceSettings(entity);
                            break;

                        case "update":
                            //UpdateFinanceSettings(entity);
                            manage.UpdateFinanceSettings(entity);
                            break;

                        case "delete":
                            manage.DeleteFinanceSettings(entity.FinanceId.ToString());
                            break;
                        }
                    }
                    else
                    {
                        if (opeType.ToLower() != "delete")
                        {
                            throw new Exception("保存数据失败!");
                        }
                        else
                        {
                            throw new Exception("删除数据失败!");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Beispiel #4
0
 public void AddFinanceSettings(FinanceSettings entity)
 {
     try
     {
         using (var manage = new UserBalanceManager())
         {
             var FinanceInfo = manage.GetFinanceUserByUserId(entity.UserId);
             if (FinanceInfo != null && FinanceInfo.Count > 0)
             {
                 var query = from f in FinanceInfo where f.OperateType == entity.OperateType select f;
                 if (query != null && query.ToList().Count > 0)
                 {
                     throw new Exception("当前用户已存在,不能重复添加!");
                 }
             }
             manage.AddFinanceSettings(entity);
         }
     }
     catch (Exception ex)
     {
         throw new Exception("保存数据失败,原因:" + ex.Message);
     }
 }
 public void AddFinanceSettings(FinanceSettings entity)
 {
     this.Add <FinanceSettings>(entity);
 }