Beispiel #1
0
        /// <summary>
        /// 添加段规则
        /// </summary>
        /// zouql 16.07.06
        /// <param name="sr">段规则实体</param>
        /// <param name="messages">消息</param>
        /// <returns>结果</returns>
        public bool Create(SegmentRulesInfo sr, out string messages)
        {
            messages = string.Empty;

            bool b = false;

            if (CheckSeed(sr))
            {
                b = SegmentRulesMapper.Create(sr) > 0;
            }
            else
            {
                messages = "该记录已存在!";
            }

            return(b);
        }
Beispiel #2
0
        /// <summary>
        /// 检查种子是否已被使用
        /// </summary>
        /// zouql 16.07.06
        /// <param name="sr">实体</param>
        /// <returns>结果</returns>
        public bool CheckSeed(SegmentRulesInfo sr)
        {
            var p = SegmentRulesMapper.CheckSeed(sr);

            return(p == null ? true : false);
        }
Beispiel #3
0
 /// <summary>
 /// 修改段规则
 /// </summary>
 /// zouql 16.07.06
 /// <param name="sr">段规则实体</param>
 /// <returns>结果</returns>
 public bool Modify(SegmentRulesInfo sr)
 {
     return(SegmentRulesMapper.Modify(sr) > 0);
 }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="segments">需要的段标识</param>
        /// <param name="segmentRules">段规则ID</param>
        /// <param name="mates">数据元标识</param>
        protected void Find(string[] segments, string[] segmentRules, string[] mates, MessageInfo data)
        {
            SegmentRulesInfo Rules = new SegmentRulesInfo();
            // 段
            var segs = new Dictionary <string, bool>();
            // 段规则
            var segsRule = new Dictionary <string, string>();
            // 数据元
            var meta = new Dictionary <string, string>();

            //将数据段转换成字典类型并且都设置为False
            segments.ToList().ForEach(m => segs.Add(m, false));

            //修改段属性
            foreach (var item in data.GetType().GetProperties())
            {
                if (segments.Contains(item.Name))
                {
                    segs[item.Name] = true;
                }
            }

            //将数据段规则转换成字典类型并且都设置为False
            segmentRules.ToList().ForEach(m => segsRule.Add(m, null));
            //修改段规则属性
            foreach (var item in data.GetType().GetProperties())
            {
                List <Dictionary <string, string> > list = (List <Dictionary <string, string> >)item.GetValue(data);

                if (list != null)
                {
                    foreach (Dictionary <string, string> dic in list)
                    {
                        foreach (var info in dic)
                        {
                            if (segmentRules.Contains(info.Key))
                            {
                                segsRule[info.Key] = info.Value;
                            }
                        }
                    }
                }
            }


            //将数据元转换成字典类型并且都设置为False
            mates.ToList().ForEach(m => meta.Add(m, null));
            //修改数据元属性
            foreach (var item in data.GetType().GetProperties())
            {
                List <Dictionary <string, string> > list = (List <Dictionary <string, string> >)item.GetValue(data);

                if (list != null)
                {
                    foreach (Dictionary <string, string> dic in list)
                    {
                        foreach (var info in dic)
                        {
                            Rules = new DAL.BankCredit.SegmentRulesMapper().Find(Convert.ToInt32(info.Key.Substring(1, info.Key.Length - 1)));

                            if (mates.Contains(Rules.MetaCode.ToString()))
                            {
                                meta[Rules.MetaCode.ToString()] = info.Value;
                            }
                        }
                    }
                }
            }

            PData = new Parameters
            {
                Segments     = segs,
                SegmentRules = segsRule,
                Mates        = meta,
            };
        }
 public IHttpActionResult Modify(SegmentRulesInfo value)
 {
     return(Segmentrule.Modify(value) ? (IHttpActionResult)Ok() : BadRequest("保存失败"));
 }
        public IHttpActionResult Create(SegmentRulesInfo value)
        {
            string messages = string.Empty;

            return(Segmentrule.Create(value, out messages) ? (IHttpActionResult)Ok() : BadRequest(messages));
        }