private static void InsertData(Defaultcompany obj, string newDB) { if (CheckData(obj, newDB) == false) { CDefaultcompany.Insert(obj, new DAL()); } ; }
private void Btn_default_Click(object sender, EventArgs e) { Defaultcompany obj = new Defaultcompany() { Defaultcompany_id = "1", Company_id = Current.Company_id, Acy_id = GetSelectedPkValue() }; CDefaultcompany.Update(obj, new DAL()); Load_sacy(); }
private void Btn_removedefault_Click(object sender, EventArgs e) { Defaultcompany obj = new Defaultcompany() { Defaultcompany_id = "1", Company_id = "NO", Acy_id = "NO" }; CDefaultcompany.Update(obj, new DAL()); Load_sacy(); }
private static bool CheckData(Defaultcompany obj, string newDB) { string q = "USE " + newDB + "; "; q += "SELECT * FROM " + DEFAULTCOMPANY.DEFAULTCOMPANY_TBL + " WHERE " + DEFAULTCOMPANY.DEFAULTCOMPANY_NAME + " = '" + obj.Defaultcompany_name + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { obj.Defaultcompany_id = redr[DEFAULTCOMPANY.DEFAULTCOMPANY_ID].ToString(); CDefaultcompany.Update(obj, new DAL()); return(true); } return(false); } }