private static void InsertData(Ledger obj, string newDB) { if (CheckData(obj, newDB) == false) { obj.Ledgergroup_id = CLedgergroup_exten.GetId_Name(obj.Ledgergroup_id); CLedger.Insert(obj, new DAL()); } ; }
private Ledger CollectData() { Ledger fobj = new Ledger() { Ledger_id = vId, Ledger_name = txt_ledger_name.Text, Ledgergroup_id = CLedgergroup_exten.GetId_Name(txt_ledgergroup_id.Text), Active_id = Core.Stative, Notes = txt_notes.Text, User_id = Current.User }; return(fobj); }
private static bool CheckData(Ledger obj, string newDB) { string q = "USE " + newDB + "; "; q += "SELECT * FROM " + LEDGER.LEDGER_TBL + " WHERE " + LEDGER.LEDGER_NAME + " = '" + obj.Ledger_name + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { obj.Ledger_id = redr[LEDGER.LEDGER_ID].ToString(); obj.Ledgergroup_id = CLedgergroup_exten.GetId_Name(obj.Ledgergroup_id); CLedger.Update(obj, new DAL()); return(true); } return(false); } }