public string GetTransactionID() { try { RunningNo _No = new RunningNo(); string _Code = ""; // clsRuningNoEngine _Engine = new clsRuningNoEngine(); GenaricRepository<RunningNo> _RunningNoRepo = new GenaricRepository<RunningNo>(new ItrackContext()); foreach (var item in _RunningNoRepo.GetAll().ToList().Where(x => x.Venue == "TR")) { _No.Prefix = item.Prefix; _No.Starting = item.Starting; _No.Length = item.Length; _Code = _No.GenarateNo(_No, getLedgerCount()); } return _Code; } catch (Exception ex) { Debug.WriteLine(ex.Message); return ""; } }
public string GenarateNo(RunningNo _Nos,int Count) { try { int CurrentNo = _Nos.Starting + Count+1; _Nos.Code = _Nos.Prefix + CurrentNo.ToString().PadLeft(_Nos.Length,'0'); return _Nos.Code; } catch(Exception ex){ Debug.WriteLine(ex.Message); return null; } }
void GetNewCode() { try { RunningNo _No = new RunningNo(); clsRuningNoEngine _Engine = new clsRuningNoEngine(); GenaricRepository<RunningNo> _RunningNoRepo = new GenaricRepository<RunningNo>(new ItrackContext()); foreach (var item in _RunningNoRepo.GetAll().ToList().Where(x => x.Venue == "GRN")) { _No.Prefix = item.Prefix; _No.Starting = item.Starting; _No.Length = item.Length; txtGrnNo.Text = _Engine.GenarateNo(_No, getPoCount()); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }