public RGResponse <List <RoomGuideDataStructure.RoomMembers> > GetRoomMembers() { DataTable Members = new DataTable(); List <RoomGuideDataStructure.RoomMembers> roomMembersList = new List <RoomGuideDataStructure.RoomMembers>(); RoomGuideDataStructure.RoomMembers roomMembers = new RoomGuideDataStructure.RoomMembers(); RGResponse <List <RoomGuideDataStructure.RoomMembers> > resp = new RGResponse <List <RoomGuideDataStructure.RoomMembers> >(null); try { RGUtitlity.DataService dataService = new RGUtitlity.DataService(); string query = @"SELECT * FROM bachelorGuide.dbo.[Members] "; Members = dataService.ExecuteDataTable(query); if (Members.Rows.Count <= 0) { roomMembersList = (from temp in new string[] { string.Empty } select new RoomGuideDataStructure.RoomMembers { FirstName = string.Empty, Id = string.Empty, LastName = string.Empty, MailId = string.Empty, PhoneNumber = 0, }).ToList(); } else { for (int index = 0; index <= Members.Rows.Count - 1; index++) { roomMembersList.Add(RetriveMemberObject(Members.Rows[index])); } } resp = new RGResponse <List <RoomGuideDataStructure.RoomMembers> >(RGResult.Success, roomMembersList, ""); } catch (Exception exception) { resp = new RGResponse <List <RoomGuideDataStructure.RoomMembers> >(RGResult.Success, null, "Error occured."); } return(resp); }
public RGResponse <string> IsVaildUser(string userName, string password) { try { DataTable userTable = new DataTable(); RGResponse <string> resp = new RGResponse <string>(null); RGUtitlity.DataService dataService = new RGUtitlity.DataService(); string query = @"SELECT * FROM bachelorGuide.dbo.[USERS] WHERE USERNAME = '******' AND PASSWORD = '******'"; userTable = dataService.ExecuteDataTable(query); if (userTable.Rows.Count > 0) { return(new RGResponse <string>(RGResult.Success, "Valid User", "")); } else { return(new RGResponse <string>(RGResult.Failure, "Invalid User", "welldone")); } } catch (Exception ex) { return(new RGResponse <string>(RGResult.Failure, "Invalid User", ex.ToString())); } }