Example #1
0
 //select all data from database
 public string getAll()
 {
     try
     {
         obj_con.clearParameter();
         DataTable dt = ConvertDatareadertoDataTable(obj_con.ExecuteReader("sp_Admin_selectall", CommandType.StoredProcedure));
         obj_con.CommitTransaction();
         obj_con.closeConnection();
         return(SessionUtilities.ConvertDataTableTojSonString(dt));
     }
     catch (Exception ex)
     {
         throw new Exception("sp_Admin_selectall:" + ex.Message);
     }
 }
Example #2
0
        public List <System.Web.Mvc.SelectListItem> GetProjectName()
        {
            try
            {
                obj_con.clearParameter();

                DataTable dt = ConvertDatareadertoDataTable(obj_con.ExecuteReader("Sp_mstProject_GetProjectName", CommandType.StoredProcedure));
                obj_con.CommitTransaction();
                obj_con.closeConnection();
                List <System.Web.Mvc.SelectListItem> lst  = new List <System.Web.Mvc.SelectListItem>();
                System.Web.Mvc.SelectListItem        sli1 = new System.Web.Mvc.SelectListItem();
                sli1.Text  = "Select All";
                sli1.Value = "-1";
                lst.Add(sli1);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    System.Web.Mvc.SelectListItem sli = new System.Web.Mvc.SelectListItem();
                    sli.Text  = Convert.ToString(dt.Rows[i][1]);
                    sli.Value = Convert.ToString(dt.Rows[i][0]);

                    lst.Add(sli);
                }
                return(lst);
            }
            catch (Exception ex)
            {
                throw new Exception("Sp_mstProject_GetProjectName");
            }
            finally
            {
                obj_con.closeConnection();
            }
        }
Example #3
0
//select all data from database
        public List <usersClass> getAll()
        {
            try
            {
                obj_con.clearParameter();
                DataTable dt = ConvertDatareadertoDataTable(obj_con.ExecuteReader("sp_users_selectall", CommandType.StoredProcedure));
                obj_con.CommitTransaction();
                obj_con.closeConnection();
                return(ConvertToList(dt));
            }
            catch (Exception ex)
            {
                throw new Exception("sp_users_selectall");
            }
        }
Example #4
0
 public void Dispose()
 {
     obj_con.closeConnection();
     System.GC.SuppressFinalize(this);
 }