Example #1
0
        private string GetNewTransNo_Trading(Trading item)
        {
            ///T20171007001
            string xNewTransNo = string.Format("T{0}", item.TradeDate.ToString("yyyyMMdd"));
            int    xNewNo      = 1;
            var    xData       = LookupTrading(new TradingQueryViewModel()
            {
                TradeDate_S = item.TradeDate,
                TradeDate_E = item.TradeDate
            })
                                 .Where(w => w.TransNo.StartsWith(xNewTransNo))
                                 .OrderByDescending(o => o.TransNo)
                                 .FirstOrDefault();

            if (xData != null)
            {
                xNewNo = int.Parse(xData.TransNo.Substring(xData.TransNo.Length - 3)) + 1;
            }

            return(string.Concat(xNewTransNo, xNewNo.ToString("000")));
        }
Example #2
0
 /// <summary>
 /// Trading Update
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 async public Task <string> UpdateTrading(Trading item)
 {
     return(await Save <Trading>(EntityState.Modified, item));
 }
Example #3
0
 /// <summary>
 /// Trading Delete
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 async public Task <string> DeleteTrading(Trading item)
 {
     return(await Save <Trading>(EntityState.Deleted, item));
 }
Example #4
0
 /// <summary>
 /// Trading Add
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 async public Task <string> AddTrading(Trading item)
 {
     item.TransNo = GetNewTransNo_Trading(item);
     return(await Save <Trading>(EntityState.Added, item));
 }