Exemple #1
0
        public List <T> Find(U _Search_VM)
        {
            DataTable temp = null;
            GenericDataTableMapper <T> _fillMachine = new GenericDataTableMapper <T>();

            try
            {
                SqlParametersGenerator _SqlParametersGenerator = new SqlParametersGenerator();
                List <SqlParameter>    sqlParameters           = _SqlParametersGenerator.Generate <U>(_Search_VM);
                List <T> lst = new StartUp().ExecuteQuery <T>(Find_SP, sqlParameters);
                if (lst == null)
                {
                    return(new List <T>());
                }
                return(lst);
            }
            catch (Exception ex)
            {
                return(new List <T>());
            }
            finally
            {
                if (temp != null)
                {
                    temp.Dispose();
                }
            }
        }
Exemple #2
0
        public int Delete(T _Search_VM)
        {
            DataTable temp   = null;
            int       Result = 0;
            GenericDataTableMapper <T> _fillMachine = new GenericDataTableMapper <T>();

            try
            {
                SqlParametersGenerator _SqlParametersGenerator = new SqlParametersGenerator()
                {
                    CheckForNull = false
                };
                List <SqlParameter> sqlParameters = _SqlParametersGenerator.Generate <T>(_Search_VM);
                return(new StartUp().ExecuteNonQuery(Delete_SP, sqlParameters));
            }
            catch (Exception ex)
            {
                return(-1);
            }
            finally
            {
                if (temp != null)
                {
                    temp.Dispose();
                }
            }
        }
Exemple #3
0
        public int DeleteWithResult(T _Search_VM)
        {
            DataTable temp   = null;
            int       Result = 0;
            GenericDataTableMapper <T> _fillMachine = new GenericDataTableMapper <T>();

            try
            {
                SqlParameter result = new SqlParameter("@Result", SqlDbType.Int);
                result.Direction = ParameterDirection.Output;
                result.Value     = 0;
                SqlParametersGenerator _SqlParametersGenerator = new SqlParametersGenerator()
                {
                    CheckForNull = false
                };
                List <SqlParameter> sqlParameters = _SqlParametersGenerator.Generate <T>(_Search_VM);
                sqlParameters.Add(result);
                new StartUp().ExecuteNonQuery(Delete_SP, sqlParameters);
                int.TryParse(result.Value.ToString(), out Result);
                return(Result);
            }
            catch (Exception ex)
            {
                return(-1);
            }
            finally
            {
                if (temp != null)
                {
                    temp.Dispose();
                }
            }
        }
Exemple #4
0
        public int Update(T _Search_VM)
        {
            DataTable temp = null;
            GenericDataTableMapper <T> _fillMachine = new GenericDataTableMapper <T>();

            try
            {
                //SqlParameter result = new SqlParameter("@Result", SqlDbType.Int);
                //result.Direction = ParameterDirection.Output;
                SqlParametersGenerator _SqlParametersGenerator = new SqlParametersGenerator();
                List <SqlParameter>    sqlParameters           = _SqlParametersGenerator.Generate <T>(_Search_VM);
                // sqlParameters.Add(result);
                return(new StartUp().ExecuteNonQuery(Update_SP, sqlParameters));
            }
            catch (Exception ex)
            {
                return(-2);
            }
            finally
            {
                if (temp != null)
                {
                    temp.Dispose();
                }
            }
        }
Exemple #5
0
        public List <T> FindList(U _RadiologistSearch_VM)
        {
            GenericDataTableMapper <T> _fillMachine = new GenericDataTableMapper <T>();

            try
            {
                SqlParametersGenerator _SqlParametersGenerator = new SqlParametersGenerator();
                List <SqlParameter>    sqlParameters           = _SqlParametersGenerator.Generate <U>(_RadiologistSearch_VM);
                List <T> lst = new StartUp().ExecuteQuery <T>(Find_SP, sqlParameters);
                return(lst);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
            }
        }