예제 #1
0
 public static IEnumerable <object> getAllEntiresList(int type)
 {
     if (type == 1)
     {
         return(EmpId.getAllEmpIdList().Cast <object>());
     }
     else if (type == 2)
     {
         return(SSN.getAllSSNList().Cast <object>());
     }
     else if (type == 3)
     {
         return(ZipCode.getAllZipCodeList().Cast <object>());
     }
     else if (type == 4)
     {
         return(Address.getAllCitiesList().Cast <object>());
     }
     else if (type == 5)
     {
         //return Person.getAllPersonList().Cast<object>();
         return(CardNo.getAllCardNosList().Cast <object>());
     }
     return(new List <object>());
 }
예제 #2
0
 public static IEnumerable <object> getAllEntiresList(int type, String companyId, String divisionId, String keyStroke)
 {
     if (type == 1)
     {
         return(EmpId.getEmpByCompanyList(companyId, divisionId, keyStroke).Cast <object>());;
     }
     else if (type == 2)
     {
         return(SSN.getSSNByCompanyList(companyId, divisionId, keyStroke).Cast <object>());;
     }
     else if (type == 3)
     {
         return(ZipCode.getZipByCompanyList(companyId, divisionId, keyStroke).Cast <object>());;
     }
     else if (type == 4)
     {
         return(Address.getCityByCompanyList(companyId, divisionId, keyStroke).Cast <object>());;
     }
     else if (type == 5)
     {
         // return Person.getEmpByCompanyList(companyId, divisionId,keyStroke).Cast<object>();
         return(CardNo.GetCardNoByCompanyAndDivisionList(companyId, divisionId, keyStroke).Cast <object>());
     }
     return(new List <object>());
 }
예제 #3
0
        public static List <EmpId> getAllEmpIdList()
        {
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, "Entry Point", Logger.logLevel.Info);
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, "", Logger.logLevel.Debug);


            List <EmpId> lstEmp = new List <EmpId>();
            //Dictionary<String, String> dictEmp = new Dictionary<string, string>();
            SqlConnection conn = null;

            SqlDataReader reader = null;

            try
            {
                // create and open a connection object
                conn = ConnectionManager.getConnection();
                conn.Open();

                String     query   = "select  TOP 50  employee from person group by employee";
                SqlCommand command = new SqlCommand(query, conn);


                using (reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        String strEmpId = reader.GetSqlValue(0).ToString().Trim();
                        if (!(strEmpId.Equals("null") || strEmpId.Equals("NULL") || strEmpId.Equals("Null") || strEmpId.Equals("")))
                        {
                            EmpId empObj = new EmpId();
                            empObj.key   = strEmpId;
                            empObj.value = strEmpId;
                            lstEmp.Add(empObj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                var stackTrace = new StackTrace(ex, true);
                var line       = stackTrace.GetFrame(0).GetFileLineNumber();
                Logger.LogExceptions(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, ex.Message, line.ToString(), Logger.logLevel.Exception);
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                if (reader != null)
                {
                    reader.Close();
                }
            }

            lstEmp = lstEmp.OrderBy(x => x.value).ToList();
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, "Exit Point", Logger.logLevel.Debug);
            return(lstEmp);
        }
예제 #4
0
        public static Dictionary <String, String> getAllEntires(int type, String companyId, String divisionId, String keyStroke)
        {
            if (type == 1)
            {
                return(EmpId.getEmpByCompany(companyId, divisionId, keyStroke));
            }
            else if (type == 2)
            {
                return(SSN.getSSNByCompany(companyId, divisionId, keyStroke));
            }
            else if (type == 3)
            {
                return(ZipCode.getZipByCompany(companyId, divisionId, keyStroke));
            }
            else if (type == 4)
            {
                return(Address.getCityByCompany(companyId, divisionId, keyStroke));
            }

            return(new Dictionary <string, string>());
        }
예제 #5
0
        public static Dictionary <String, String> getAllEntires(int type)
        {
            if (type == 1)
            {
                return(EmpId.getAllEmpId());
            }
            else if (type == 2)
            {
                return(SSN.getAllSSN());
            }
            else if (type == 3)
            {
                return(ZipCode.getAllZipCode());
            }
            else if (type == 4)
            {
                return(Address.getAllCities());
            }

            return(new Dictionary <string, string>());
        }
예제 #6
0
        public static List <EmpId> getEmpByCompanyList(String companyId, String divisionId, String keyStroke)
        {
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, "Entry Point", Logger.logLevel.Info);
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, companyId + divisionId + keyStroke, Logger.logLevel.Debug);


            List <EmpId> lstEmp = new List <EmpId>();

            SqlConnection conn   = null;
            SqlDataReader reader = null;

            try
            {
                // create and open a connection object
                conn = ConnectionManager.getConnection();
                conn.Open();


                String query;
                if (companyId.Equals("null") && divisionId.Equals("null"))
                {
                    query = "select distinct TOP 50 employee from person  where employee LIKE '%" + keyStroke + "%'";
                }

                else if (!companyId.Equals("null") && !divisionId.Equals("null"))
                {
                    //query = "select TOP 500  P.id from person P,department D where P.department = D.id and D.user1 like @company and D.user2 like @division group by P.id";
                    query = "select distinct TOP 50  P.employee FROM person P, department D,rs_company Comp, rs_division Div";
                    query = query + " WHERE P.department = D.id AND Comp.companyId = @company AND Div.divisionId = @division AND D.user1 LIKE Comp.companyName AND D.user2 LIKE Div.divisionName AND P.employee LIKE '%" + keyStroke + "%'";
                }
                else if (companyId.Equals("null"))
                {
                    // query = "select TOP 500  P.id from person P,department D where P.department = D.id and  D.user2 like @division group by P.id";
                    query = "select distinct TOP 50  P.employee FROM person P, department D, rs_division Div";
                    query = query + " WHERE P.department = D.id AND Div.divisionId = @division AND D.user2 LIKE Div.divisionName AND P.employee LIKE '%" + keyStroke + "%'";
                }
                else
                {
                    // query = "select TOP 500  P.id from person P,department D where P.department = D.id and D.user1 like @company group by P.id";
                    query = "select distinct TOP 50  P.employee FROM person P, department D,rs_company Comp";
                    query = query + " WHERE P.department = D.id AND Comp.companyId = @company AND  D.user1 LIKE Comp.companyName AND P.employee LIKE '%" + keyStroke + "%'";
                }

                SqlCommand command = new SqlCommand(query, conn);
                command.Parameters.AddWithValue("@company", companyId.Trim());
                command.Parameters.AddWithValue("@division", divisionId.Trim());


                using (reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        String strEmpId = reader.GetSqlValue(0).ToString().Trim();
                        if (!(strEmpId.Equals("null") || strEmpId.Equals("NULL") || strEmpId.Equals("Null") || strEmpId.Equals("")))
                        {
                            EmpId empObj = new EmpId();
                            empObj.key   = strEmpId;
                            empObj.value = strEmpId;
                            lstEmp.Add(empObj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                var stackTrace = new StackTrace(ex, true);
                var line       = stackTrace.GetFrame(0).GetFileLineNumber();
                Logger.LogExceptions(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, ex.Message, line.ToString(), Logger.logLevel.Exception);
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                if (reader != null)
                {
                    reader.Close();
                }
            }

            lstEmp = lstEmp.OrderBy(x => x.value).ToList();
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, "Exit Point", Logger.logLevel.Debug);
            return(lstEmp);
        }
예제 #7
0
        public static List<EmpId> getAllEmpIdList()
        {
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, "Entry Point", Logger.logLevel.Info);
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, "", Logger.logLevel.Debug);

            List<EmpId> lstEmp = new List<EmpId>();
            //Dictionary<String, String> dictEmp = new Dictionary<string, string>();
            SqlConnection conn = null;

            SqlDataReader reader = null;
            try
            {
                // create and open a connection object
                conn = ConnectionManager.getConnection();
                conn.Open();

                String query = "select  TOP 50  employee from person group by employee";
                SqlCommand command = new SqlCommand(query, conn);

                using (reader = command.ExecuteReader())
                {

                    while (reader.Read())
                    {
                        String strEmpId = reader.GetSqlValue(0).ToString().Trim();
                        if (!(strEmpId.Equals("null") || strEmpId.Equals("NULL") || strEmpId.Equals("Null") || strEmpId.Equals("")))
                        {
                            EmpId empObj = new EmpId();
                            empObj.key = strEmpId;
                            empObj.value = strEmpId;
                            lstEmp.Add(empObj);
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                var stackTrace = new StackTrace(ex, true);
                var line = stackTrace.GetFrame(0).GetFileLineNumber();
                Logger.LogExceptions(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, ex.Message, line.ToString(), Logger.logLevel.Exception);
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                if (reader != null)
                {
                    reader.Close();
                }
            }

            lstEmp = lstEmp.OrderBy(x => x.value).ToList();
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, "Exit Point", Logger.logLevel.Debug);
            return lstEmp;
        }
예제 #8
0
        public static List<EmpId> getEmpByCompanyList(String companyId, String divisionId, String keyStroke)
        {
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, "Entry Point", Logger.logLevel.Info);
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, companyId + divisionId + keyStroke, Logger.logLevel.Debug);

            List<EmpId> lstEmp = new List<EmpId>();

            SqlConnection conn = null;
            SqlDataReader reader = null;
            try
            {
                // create and open a connection object
                conn = ConnectionManager.getConnection();
                conn.Open();

                String query;
                if (companyId.Equals("null") && divisionId.Equals("null"))
                {
                    query = "select distinct TOP 50 employee from person  where employee LIKE '%" + keyStroke + "%'";
                }

                else if (!companyId.Equals("null") && !divisionId.Equals("null"))
                {
                    //query = "select TOP 500  P.id from person P,department D where P.department = D.id and D.user1 like @company and D.user2 like @division group by P.id";
                    query = "select distinct TOP 50  P.employee FROM person P, department D,rs_company Comp, rs_division Div";
                    query = query + " WHERE P.department = D.id AND Comp.companyId = @company AND Div.divisionId = @division AND D.user1 LIKE Comp.companyName AND D.user2 LIKE Div.divisionName AND P.employee LIKE '%" + keyStroke + "%'";
                }
                else if (companyId.Equals("null"))
                {
                    // query = "select TOP 500  P.id from person P,department D where P.department = D.id and  D.user2 like @division group by P.id";
                    query = "select distinct TOP 50  P.employee FROM person P, department D, rs_division Div";
                    query = query + " WHERE P.department = D.id AND Div.divisionId = @division AND D.user2 LIKE Div.divisionName AND P.employee LIKE '%" + keyStroke + "%'";
                }
                else
                {
                    // query = "select TOP 500  P.id from person P,department D where P.department = D.id and D.user1 like @company group by P.id";
                    query = "select distinct TOP 50  P.employee FROM person P, department D,rs_company Comp";
                    query = query + " WHERE P.department = D.id AND Comp.companyId = @company AND  D.user1 LIKE Comp.companyName AND P.employee LIKE '%" + keyStroke + "%'";
                }

                SqlCommand command = new SqlCommand(query, conn);
                command.Parameters.AddWithValue("@company", companyId.Trim());
                command.Parameters.AddWithValue("@division", divisionId.Trim());

                using (reader = command.ExecuteReader())
                {

                    while (reader.Read())
                    {
                        String strEmpId = reader.GetSqlValue(0).ToString().Trim();
                        if (!(strEmpId.Equals("null") || strEmpId.Equals("NULL") || strEmpId.Equals("Null") || strEmpId.Equals("")))
                        {
                            EmpId empObj = new EmpId();
                            empObj.key = strEmpId;
                            empObj.value = strEmpId;
                            lstEmp.Add(empObj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                var stackTrace = new StackTrace(ex, true);
                var line = stackTrace.GetFrame(0).GetFileLineNumber();
                Logger.LogExceptions(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, ex.Message, line.ToString(), Logger.logLevel.Exception);
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
                if (reader != null)
                {
                    reader.Close();
                }
            }

            lstEmp = lstEmp.OrderBy(x => x.value).ToList();
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, "Exit Point", Logger.logLevel.Debug);
            return lstEmp;
        }