Exemple #1
0
        public List <GroupManager> GetNewManagers()
        {
            DataTable table = new DataTable("Table");

            using (SqlConnection connection = new SqlConnection("Data Source=DESKTOP-V3VNLNG\\SQLEXPRESS;Database=NAHRO;Trusted_Connection=Yes;"))
            {
                SqlCommand command = new SqlCommand();
                command.Connection  = connection;
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.CommandText = "spGetNewManagers";

                connection.Open();
                SqlDataAdapter adapter = new SqlDataAdapter(command);
                adapter.Fill(table);
            }

            List <GroupManager> employees = new List <GroupManager>();

            employees = Utills.ConvertDataTable <GroupManager>(table);

            return(employees);
        }
Exemple #2
0
        public Agency GetAgencyById(int id)
        {
            DataTable table = new DataTable("Table");

            using (SqlConnection connection = new SqlConnection("Data Source=DESKTOP-V3VNLNG\\SQLEXPRESS;Database=NAHRO;Trusted_Connection=Yes;"))
            {
                SqlCommand command = new SqlCommand();
                command.Connection  = connection;
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.CommandText = "spGetAgencyDetailsById";
                command.Parameters.AddWithValue("@Id", id);
                connection.Open();
                SqlDataAdapter adapter = new SqlDataAdapter(command);
                adapter.Fill(table);
            }

            List <Agency> agencies = new List <Agency>();

            agencies = Utills.ConvertDataTable <Agency>(table);

            return(agencies.FirstOrDefault());
        }