Esempio n. 1
0
        /// <summary>
        /// fetches different kinds of lookups
        /// </summary>
        /// <param name="t"></param>
        /// <param name="Id"></param>
        /// <param name="search"></param>
        /// <returns></returns>
        public static DataTable RetrieveLookup(dbTable t, int Id = 0, String search = "")
        {
            List <parmStructure> lstParms = new List <parmStructure>();
            String sp = "";

            switch (t)
            {
            case dbTable.employee:
                if (Id != 0)
                {
                    lstParms.Add(new parmStructure("@id", Id, ParameterDirection.Input, SqlDbType.Int));
                }
                else if (search != "")
                {
                    lstParms.Add(new parmStructure("@search", search, ParameterDirection.Input, SqlDbType.VarChar, 50));
                }
                sp = "EmployeeLookup";
                break;

            case dbTable.department:
                sp = "DepartmentLookup";
                break;

            case dbTable.job:
                sp = "JobLookup";
                break;

            default:
                throw new Exception("There was an error at the SQL layer");
            }
            return(DataAccess.GetData(sp, lstParms));
        }
Esempio n. 2
0
        /// <summary>
        /// creates a look up from a database table
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public static List <Lookup> Create(dbTable t)
        {
            DataTable dt = EmployeeSQL.Retrieve(t);

            return(RePackage(dt));
        }