コード例 #1
0
        public bool InsertIncomeLimitGroupGobal(byte type, string str, string remark)
        {
            IncomeGroupLimitGroup g = new IncomeGroupLimitGroup()
            {
                Id            = Guid.NewGuid(),
                CompanyId     = CurrentCompany.CompanyId,
                IncomeGroupId = null,
                Remark        = remark,
                Limitation    = new List <IncomeGroupLimit>()
            };
            var limitStr = str.Split('^');

            if (type == 2)
            {
                for (int i = 0; i < limitStr.Length; i++)
                {
                    var currLimit = limitStr[i].Split(',');
                    var limit     = new IncomeGroupLimit();
                    limit.Id            = Guid.NewGuid();
                    limit.IncomeId      = g.Id;
                    limit.IsOwnerPolicy = currLimit[0] == "1";
                    limit.Airlines      = currLimit[1];
                    limit.Type          = (PeriodType)byte.Parse(currLimit[2]);
                    limit.Price         = int.Parse(currLimit[4]);
                    limit.Period        = new List <IncomeGroupPeriod>();
                    if (limit.Type == PeriodType.Interval)
                    {
                        var currPeriod = currLimit[3].Split(';');
                        for (int j = 0; j < currPeriod.Length; j++)
                        {
                            var currValue = currPeriod[j].Split('|');
                            limit.Period.Add(new IncomeGroupPeriod {
                                DeductId = limit.Id, StartPeriod = decimal.Parse(currValue[0]), EndPeriod = decimal.Parse(currValue[1]), Period = decimal.Parse(currValue[2])
                            });
                        }
                    }
                    else
                    {
                        limit.Period.Add(new IncomeGroupPeriod {
                            DeductId = limit.Id, StartPeriod = 0, EndPeriod = 1, Period = decimal.Parse(currLimit[3])
                        });
                    }
                    g.Limitation.Add(limit);
                }
            }
            IncomeGroupLimitService.InsertIncomeGroupLimitGlobal((IncomeGroupLimitType)type, g);
            return(true);
        }
コード例 #2
0
        /// <summary>
        /// 查询上级公司的收益设置信息 有可能为空,即没有设置信息
        /// </summary>
        /// <param name="superId">上级编号</param>
        /// <param name="purchseId">当前公司编号</param>
        /// <returns></returns>
        public static IncomeGroupLimitGroup QueryIncomeGroupLimitGroup(Guid superId, Guid purchseId)
        {
            IncomeGroupLimitGroup  limit = null;
            PurchaseLimitationType type  = CompanyService.QueryLimitationType(superId);
            var repository = Factory.CreateIncomeGroupLimitRespository();

            if (type == PurchaseLimitationType.Global)
            {
                limit = repository.QueryIncomeGroupLimitGroupByCompanyId(superId);
            }
            else if (type == PurchaseLimitationType.Each)
            {
                limit = repository.IncomeGroupLimitGroup(superId, purchseId);
            }
            return(limit);
        }
コード例 #3
0
        /// <summary>
        /// 全局收益设置
        /// </summary>
        /// <param name="type"></param>
        /// <param name="setting"></param>
        public static void InsertIncomeGroupLimitGlobal(IncomeGroupLimitType type, IncomeGroupLimitGroup setting)
        {
            var repository = Factory.CreateIncomeGroupLimitRespository();

            repository.InsertIncomeGroupLimitGlobal(type, setting);
        }
コード例 #4
0
        /// <summary>
        /// 修改收益设置
        /// </summary>
        /// <param name="setting"></param>
        public static void UpdateIncomeGroupLimit(IncomeGroupLimitGroup setting)
        {
            var repository = Factory.CreateIncomeGroupLimitRespository();

            repository.InsertIncomeGroupLimit(setting);
        }