public List <Topic> getTopic(string topic_id) { try { instance = new SqlDBInstance(); List <Topic> topic = new List <Topic>(); dt = new DataTable(); string cmd_get = @"SELECT t.T_ID,t.Topic_Name,t.Topic_Txt,s.CRNT_DATE,s.NEXT_DATE,s.INTERVAL_COUNT FROM Tbl_GLP_Topic t inner join tblSpaceRepatation s on t.T_ID = s.TOPIC_ID"; dt = instance.getDatatable(cmd_get); foreach (DataRow w in dt.Rows) { topic.Add(new Topic() { TOPIC_ID = w[0].ToString(), TOPIC_NAME = w[1].ToString(), TOPIC_TEXT = w[2].ToString(), CRNT_DATE = Convert.ToDateTime(w[3]).ToString("dd-MM-yyyy"), NEXT_DATE = Convert.ToDateTime(w[4]).ToString("dd-MM-yyyy"), INTERVAL = w[5].ToString() }); } return(topic); } catch (Exception ex) { throw new Exception(ex.Message + "\n" + ex.StackTrace); } }
public List <Users> getUserList() { try { List <Users> lstUsers = new List <Users>(); DataTable dt; dt = new SqlDBInstance().getDatatable(@"SELECT Usr_Id,Usr_Name,Usr_Pass,Created_Date FROM Tbl_GLP_Users"); foreach (DataRow w in dt.Rows) { lstUsers.Add(new Users() { USER_ID = w[0].ToString(), USER_NAME = w[1].ToString(), USER_PASS = w[2].ToString(), CREATED_DATE = w[3].ToString() }); } return(lstUsers); } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <TestTable> getTestTable() { try { DataTable dt = new DataTable(); List <TestTable> lst = new List <TestTable>(); dt = new SqlDBInstance().getDatatable("SELECT S_ID,STATE_NAME FROM TEST_TABLE"); foreach (DataRow w in dt.Rows) { lst.Add(new TestTable() { STATE_ID = Convert.ToInt32(w[0].ToString()), STATE_NAME = w[1].ToString() }); } return(lst); } catch (Exception ex) { throw new Exception(ex.Message); } }