Пример #1
0
        public static DataTable ExecuteReader(Model mdl)
        {
            DataTable dt = new DataTable();
            using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["TestConnectionString"].ToString()))
            {
                cn.Open();
                SqlCommand cm = new SqlCommand(mdl.StoreProcedureName.ToString(), cn);
                cm.CommandType = CommandType.StoredProcedure;
                foreach (SqlParameter p in cm.Parameters)
                {
                    if (p.Direction == ParameterDirection.Input || p.Direction == ParameterDirection.InputOutput)
                    {
                        foreach (PropertyInfo pi in mdl.GetType().GetProperties())
                        {
                            if (p.ParameterName.ToLower().Replace("@", "") == pi.Name.ToLower())
                            {
                                p.Value = FormatObject(p, pi.GetValue(mdl, null));
                                break;
                            }
                        }
                    }

                }
                dt.Load(cm.ExecuteReader());
            }
            return dt;
        }
Пример #2
0
 public DataTable InsertUser(object JobID)
 {
     Model mdl = new Model();
     mdl.StoreProcedureName = "InsertUser";
     mdl.JobID = JobID;
     return SqlServer.ExecuteReader(mdl);
 }
Пример #3
0
 public DataTable JobDetails1(Object JobID)
 {
     Model mdl = new Model();
     mdl.StoreProcedureName = "JobDetails";
     mdl.JobID = JobID;
     return SqlServer.ExecuteReader(mdl);
 }
Пример #4
0
 public DataTable FillSearch(object JobTitle, object JobDescription, object FirstName, object LastName)
 {
     Model mdl = new Model();
     mdl.StoreProcedureName = "FillSearch";
     mdl.JobTitle = JobTitle;
     mdl.JobDescription = JobDescription;
     mdl.FirstName = FirstName;
     mdl.LastName = LastName;
     return SqlServer.ExecuteReader(mdl);
 }
Пример #5
0
 public DataTable SearchUsers(object JobID, object FirstName, object LastName, object JobTitle, object JobDescription)
 {
     Model mdl = new Model();
     mdl.StoreProcedureName = "SearchUsers";
     mdl.JobID = JobID;
     mdl.FirstName = FirstName;
     mdl.LastName = LastName;
     mdl.JobTitle = JobTitle;
     mdl.JobDescription = JobDescription;
     return SqlServer.ExecuteReader(mdl);
 }