Пример #1
0
        public override bool Remove(Info_matchTb info)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <long>((r, id) =>
            {
                if (r.Remove <Model.Tb_matchTb>()
                    .Where().And(Model.Tb_matchTb.Table.MatchTb_Id, id)
                    .EndWhere()
                    .Save() < 1)
                {
                    return(false);
                }
                return(true);
            }, info.MatchTb_Id)
            .Append <long>((r, id) =>
            {
                if (r.Remove <Model.Tb_matchTb_item>()
                    .Where().And(Model.Tb_matchTb_item.Table.MatchTb_Id, id)
                    .EndWhere()
                    .Save() < 0)
                {
                    return(false);
                }
                return(true);
            }, info.MatchTb_Id);

            return(exeBatchTrans.Save());
        }
Пример #2
0
        public bool Commit(Info_matchTb info)
        {
            ExeBatchTrans exeBatchTrans = this.BatchTrans();

            exeBatchTrans.Append <Info_matchTb>((r, i) => {
                return(r.Update <Model.Tb_matchTb>()
                       .Set().Field(Model.Tb_matchTb.Table.MatchTb_State, (int)Enum.MatchTbState.Valid)
                       .EndSet()
                       .Where()
                       .And(Model.Tb_matchTb.Table.MatchTb_Id, i.MatchTb_Id)
                       .EndWhere()
                       .Save() > 0 ? true : false);
            }, info);


            return(exeBatchTrans.Save());
        }
Пример #3
0
 public override bool Add(Info_matchTb t)
 {
     t.MatchTb_Id    = NewId();
     t.MatchTb_State = (int)Enum.MatchTbState.New;
     return(this.Add(this.Repository, t));
 }
Пример #4
0
        public Dictionary <string, object> GetMatchTbVars(Info_matchTb info)
        {
            Dictionary <string, object> dicVar = new Dictionary <string, object>();

            //获得维护的基础数据

            Dictionary <string, object> dicInput = new Dictionary <string, object>();

            foreach (var v in this.MatchTbTmp.VarInputs)
            {
                string varName = "${" + v.Name + "}";
                object value   = Miles.Coro.Common.MemberAccessor.DelegatedExpressionMemberAccessor.Instance.GetValue(info, v.Name);
                dicInput.Add(varName, value);
                dicVar.Add(varName, value);
            }

            Dictionary <string, object> dicCal = new Dictionary <string, object>();

            foreach (var v in this.MatchTbTmp.VarCals)
            {
                string varName = Report.ReportTemplateBase.Format2VarString(v.Name);
                object value   = ReportTemplateBase.ParseFormula(v.Formula, dicInput);

                dicCal.Add(varName, value);
                dicVar.Add(varName, value);
            }

            //十字撑计算
            List <RanageFormula> szcFormulas = null;

            if (info.Tent_Length < 26)
            {
                //30米以下
                szcFormulas = this.MatchTbTmp.SzcLt30;
            }
            else
            {
                //30米以上
                szcFormulas = this.MatchTbTmp.SzcGt30;
            }

            var query = from i in szcFormulas
                        orderby i.DL ascending
                        select i;

            decimal unit_SpecNum = -1;

            decimal.TryParse(dicVar["${unit_SpecNum}"].ToString(), out unit_SpecNum);
            decimal szcValue = 0;

            foreach (var v in query)
            {
                if (unit_SpecNum <= v.UL && unit_SpecNum >= v.DL)
                {
                    szcValue = v.RT;
                    break;
                }
            }
            dicVar.Add("${szc_Value}", szcValue);

            decimal allWeight = info.Items.Sum(i => i.ItemWeight);

            dicVar.Add("${All_Weight}", allWeight);
            return(dicVar);
        }