/// <summary> /// Creating master entries for GL Updating /// </summary> /// <param name="type"> 0- Cash, 1- Cheque, 2- Transfer</param> public object CreateMasterEntry(int type, object nextNoObj) { object retObj; retObj = new object(); switch (type) { case 0: cashnn = new CashNN(); cashnn = (CashNN)nextNoObj; cashnn = InsertCashMaster(cashnn); retObj = cashnn; break; case 1: chqnn = new ChequeNN(); chqnn = (ChequeNN)nextNoObj; chqnn = InsertChequeMaster(chqnn); retObj = chqnn; break; case 2: trnn = new TransferNN(); trnn = (TransferNN)nextNoObj; trnn = InsertTransferMaster(trnn); retObj = trnn; break; } //strsql = " "; return(retObj); }
public ChequeNN GetChequeLastNo() { ChequeNN lastChq = new ChequeNN(); strsql = "Select top 1 * from indCH Order by Ind Desc"; table = db.GetDataTable(strsql, DBAccess.GL); if (table.Rows.Count == 1) { lastChq.ind = int.Parse(table.Rows[0]["ind"].ToString()); lastChq.ws = table.Rows[0]["ws"].ToString(); lastChq.st = DateTime.Parse(table.Rows[0]["st"].ToString()); } return(lastChq); }
/// <summary> /// Insert Cheque master entry /// </summary> /// <param name="chqnn"></param> /// <returns>Chq master object</returns> private ChequeNN InsertChequeMaster(ChequeNN chqnn) { //throw new NotImplementedException(); chqnn.ws = Environment.MachineName + DateTime.Now.ToShortTimeString().Trim(); strsql = "Insert into indCH Values ('" + chqnn.ws + "',GETDATE())"; db = new DBAccess(); db.ExecuteQuery(strsql, DBAccess.GL); //strsql = "Select top 1 * from indCH Order by Ind Desc"; //table = db.GetDataTable(strsql, DBAccess.GL); //if (table.Rows.Count == 1) //{ // chqnn.ind = int.Parse(table.Rows[0]["ind"].ToString()); // chqnn.ws = table.Rows[0]["ws"].ToString(); // chqnn.st = DateTime.Parse(table.Rows[0]["st"].ToString()); //} chqnn = GetChequeLastNo(); return(chqnn); }