private string isAvailable(string asseCodeToCheck) { int count = dbConnect.Count("select count(*) from (select * from tblborrowdetail a left join tblasset b on a.strBorDAsseCode = b.strAsseCode where a.dtmBorDDateReturned is null and a.strBorDAsseCode = '" + asseCodeToCheck + "') as t;"); switch (count) { case 0: return("Available"); default: return("Borrowed"); } }
private bool isStudent() { bool retBool = false; int count = dbConnect.Count("select count(*) from tblName where strNameCode = '" + biBorrowerCode + "' and intNameType = 1;"); if (count == 1) { retBool = true; } return(retBool); }
//--------------------------------------------------OTHERS---------------------------------------------------------------- public bool doesItemTypeExist(string itemToSearch) { bool returnBool = false; int count = dbConnect.Count("select count(*) from tblItemType where strItemName = '" + itemToSearch + "' and boolItemIsDel = false;"); if (count > 0) { returnBool = true; } return(returnBool); }
//-----Mj method private void getUserandPass() { int count = dbConnect.Count("select count(*) from tblAdmin;"); if (count == 0) { dbConnect.Insert("insert into tbladmin values ('admin','user','pass','name','*****@*****.**','emailpass','message',false);"); MessageBox.Show("First application usage. Temporary values:\nName: name\nUser: user\nPassword: pass\nEmail: [email protected]\nEmail Password: emailpass\nMessage: message\nPlease change this values in the settings later."); } //to get username and pass string[] columns = { "strAdmUser", "strAdmPass" }; List <object>[] rs = dbConnect.Select("select * from tblAdmin where strAdmCode = 'admin';", columns); user = rs[0].ElementAt(0).ToString(); pass = rs[1].ElementAt(0).ToString(); }