コード例 #1
0
        public string GetVoucherID()
        {
            AVoucher avoucher = new AVoucher();
            var      mylist   = this.ListAvoucher().ToList();

            if (mylist.Count == 0)
            {
                avoucher.AVoucherID = "A00000000001";
            }
            else
            {
                string s = ((from a in mylist
                             select new { a.AVoucherID }).Last()).AVoucherID.ToString();
                int    lastid = Int32.Parse(s.Substring(1, 11)) + 1;
                string myid   = String.Format("{0:00000000000}", lastid);
                string autoid = "A" + myid.ToString();
                avoucher.AVoucherID = autoid;
            }
            return(avoucher.AVoucherID);
        }
コード例 #2
0
 public void Add(AVoucher avoucher)
 {
     db.AVouchers.InsertOnSubmit(avoucher);
 }