Esempio n. 1
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!base.IsPostBack)
     {
         cn.justwin.Domain.EasyUI.Treasury   treasury = new cn.justwin.Domain.EasyUI.Treasury();
         cn.justwin.Domain.EasyUI.Treasury[] t        = treasury.GetTreasury().ToArray <cn.justwin.Domain.EasyUI.Treasury>();
         this.hfldTreasuryJson.Value = JsonHelper.JsonSerializer <cn.justwin.Domain.EasyUI.Treasury[]>(t);
         this.hfldDepotType.Value    = StockParameter.DepotType;
     }
 }
Esempio n. 2
0
        public void AddChildren(Treasury trea, List <SmTreasury> all)
        {
            Func <SmTreasury, bool> predicate = null;

            if (trea.Children == null)
            {
                trea.Children = new List <Treasury>();
            }
            List <SmTreasury> list = new List <SmTreasury>();

            if (trea.Code == "0")
            {
                list = (from t in all
                        where t.tcode.Length == 3
                        orderby t.tcode
                        select t).ToList <SmTreasury>();
            }
            else
            {
                if (predicate == null)
                {
                    predicate = t => (t.tcode.Length == (trea.Code.Length + 3)) && t.tcode.StartsWith(trea.Code);
                }
                list = (from t in all.Where <SmTreasury>(predicate)
                        orderby t.tcode
                        select t).ToList <SmTreasury>();
            }
            foreach (SmTreasury treasury in list)
            {
                Treasury treasury2 = new Treasury {
                    Id   = treasury.tid,
                    Code = treasury.tcode,
                    Text = treasury.tname
                };
                if (this.ContainsChildren(treasury.tcode, all))
                {
                    treasury2.State = "open";
                    this.AddChildren(treasury2, all);
                }
                if (treasury.tflag == "1")
                {
                    treasury2.Text = treasury2.Text + "(总库)";
                }
                trea.Children.Add(treasury2);
            }
        }
Esempio n. 3
0
        public IList <Treasury> GetTreasury()
        {
            List <Treasury>   list     = new List <Treasury>();
            List <SmTreasury> all      = new SmTreasuryService().ToList <SmTreasury>();
            SmTreasury        treasury = (from t in all
                                          where t.tcode == "0"
                                          select t).FirstOrDefault <SmTreasury>();
            Treasury trea = new Treasury {
                Id    = treasury.tid,
                Code  = treasury.tcode,
                Text  = treasury.tname,
                State = "open"
            };

            if (treasury.tflag == "1")
            {
                trea.Text = trea.Text + "(总库)";
            }
            this.AddChildren(trea, all);
            list.Add(trea);
            return(list);
        }