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"))); }
/// <summary> /// Trading Update /// </summary> /// <param name="item"></param> /// <returns></returns> async public Task <string> UpdateTrading(Trading item) { return(await Save <Trading>(EntityState.Modified, item)); }
/// <summary> /// Trading Delete /// </summary> /// <param name="item"></param> /// <returns></returns> async public Task <string> DeleteTrading(Trading item) { return(await Save <Trading>(EntityState.Deleted, item)); }
/// <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)); }