Ejemplo n.º 1
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>());
 }
Ejemplo n.º 2
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>());
 }
Ejemplo n.º 3
0
        public static List <CardNo> getAllCardNosList()
        {
            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 <CardNo> lstCardNo = new List <CardNo>();
            SqlConnection conn      = null;

            SqlDataReader reader = null;

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

                String     query   = "select TOP 50 bid from badge where bid is NOT NULL and (len(bid)=11) ";
                SqlCommand command = new SqlCommand(query, conn);


                using (reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        String bid = reader.GetSqlValue(0).ToString().Trim();
                        if (bid.Length == 11 || bid.Length == 12)
                        {
                            CardNo objCardNo = new CardNo();
                            objCardNo.CardNoId    = reader.GetSqlValue(0).ToString().Trim();
                            objCardNo.CardNoValue = reader.GetSqlValue(0).ToString().Trim().Substring(5);
                            lstCardNo.Add(objCardNo);
                        }
                    }
                }
            }
            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();
                }
            }

            lstCardNo = lstCardNo.OrderBy(x => x.CardNoValue).ToList();
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, "Exit Point", Logger.logLevel.Debug);
            return(lstCardNo);
        }
Ejemplo n.º 4
0
        public static List<CardNo> getAllCardNosList()
        {
            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<CardNo> lstCardNo = new List<CardNo>();
            SqlConnection conn = null;

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

                String query = "select TOP 50 bid from badge where bid is NOT NULL and (len(bid)=11) ";
                SqlCommand command = new SqlCommand(query, conn);

                using (reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        String bid = reader.GetSqlValue(0).ToString().Trim();
                        if (bid.Length == 11 || bid.Length == 12)
                        {
                            CardNo objCardNo = new CardNo();
                            objCardNo.CardNoId = reader.GetSqlValue(0).ToString().Trim();
                            objCardNo.CardNoValue = reader.GetSqlValue(0).ToString().Trim().Substring(5);
                            lstCardNo.Add(objCardNo);
                        }
                    }
                }

            }
            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();
                }
            }

            lstCardNo = lstCardNo.OrderBy(x => x.CardNoValue).ToList();
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, "Exit Point", Logger.logLevel.Debug);
            return lstCardNo;
        }
Ejemplo n.º 5
0
        public static List <CardNo> GetCardNoByCompanyAndDivisionList(string companyId, string divisionId)
        {
            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, Logger.logLevel.Debug);

            List <CardNo> lstCardNo = new List <CardNo>();

            if (companyId.Equals("null") && divisionId.Equals("null"))
            {
                return(getAllCardNosList());
            }


            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 TOP 500  B.bid, B.unique_id from CardNo B,person P,department D where B.person_id = P.id and P.department = D.id and D.user1 like @company and D.user2 like @division";
                    query = "select TOP 50 B.bid FROM badge B,person P, department D,rs_company Comp, rs_division Div";
                    query = query + " WHERE B.person_id = P.id AND 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 B.bid is NOT NULL and (len(B.bid)=11 )";
                }
                else if (companyId.Equals("null"))
                {
                    //query = "select B.bid, B.unique_id from CardNo B,person P,department D where B.person_id = P.id and P.department = D.id and D.user2 like @division";
                    query = "select TOP 50 B.bid FROM badge B,person P, department D, rs_division Div";
                    query = query + " WHERE B.person_id = P.id AND P.department = D.id AND Div.divisionId = @division AND D.user2 LIKE Div.divisionName and B.bid is NOT NULL and (len(B.bid)=11 )";
                }
                else
                {
                    //query = "select B.bid, B.unique_id from CardNo B,person P,department D where B.person_id = P.id and P.department = D.id and D.user1 like @company";
                    query = "select TOP 50 B.bid FROM badge B,person P, department D,rs_company Comp";
                    query = query + " WHERE B.person_id = P.id AND P.department = D.id AND Comp.companyId = @company AND D.user1 LIKE Comp.companyName and B.bid is NOT NULL and (len(B.bid)=11 )";
                }

                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 bid = reader.GetSqlValue(0).ToString().Trim();
                        if (bid.Length == 11 || bid.Length == 12)
                        {
                            CardNo objCardNo = new CardNo();
                            objCardNo.CardNoId    = reader.GetSqlValue(0).ToString().Trim();
                            objCardNo.CardNoValue = reader.GetSqlValue(0).ToString().Trim().Substring(5);
                            lstCardNo.Add(objCardNo);
                        }
                    }
                }
            }
            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();
                }
            }

            lstCardNo = lstCardNo.OrderBy(x => x.CardNoValue).ToList();
            Logger.LogDebug(MethodBase.GetCurrentMethod().DeclaringType.ToString(), MethodBase.GetCurrentMethod().Name, "Exit Point", Logger.logLevel.Debug);
            return(lstCardNo);
        }
Ejemplo n.º 6
0
        public static List<CardNo> GetCardNoByCompanyAndDivisionList(string companyId, string divisionId)
        {
            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 , Logger.logLevel.Debug);

            List<CardNo> lstCardNo = new List<CardNo>();
            if (companyId.Equals("null") && divisionId.Equals("null"))
            {
                return getAllCardNosList();
            }

            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 TOP 500  B.bid, B.unique_id from CardNo B,person P,department D where B.person_id = P.id and P.department = D.id and D.user1 like @company and D.user2 like @division";
                    query = "select TOP 50 B.bid FROM badge B,person P, department D,rs_company Comp, rs_division Div";
                    query = query + " WHERE B.person_id = P.id AND 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 B.bid is NOT NULL and (len(B.bid)=11 )";
                }
                else if (companyId.Equals("null"))
                {
                    //query = "select B.bid, B.unique_id from CardNo B,person P,department D where B.person_id = P.id and P.department = D.id and D.user2 like @division";
                    query = "select TOP 50 B.bid FROM badge B,person P, department D, rs_division Div";
                    query = query + " WHERE B.person_id = P.id AND P.department = D.id AND Div.divisionId = @division AND D.user2 LIKE Div.divisionName and B.bid is NOT NULL and (len(B.bid)=11 )";
                }
                else
                {
                    //query = "select B.bid, B.unique_id from CardNo B,person P,department D where B.person_id = P.id and P.department = D.id and D.user1 like @company";
                    query = "select TOP 50 B.bid FROM badge B,person P, department D,rs_company Comp";
                    query = query + " WHERE B.person_id = P.id AND P.department = D.id AND Comp.companyId = @company AND D.user1 LIKE Comp.companyName and B.bid is NOT NULL and (len(B.bid)=11 )";
                }

                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 bid = reader.GetSqlValue(0).ToString().Trim();
                        if (bid.Length == 11 || bid.Length == 12)
                        {
                            CardNo objCardNo = new CardNo();
                            objCardNo.CardNoId = reader.GetSqlValue(0).ToString().Trim();
                            objCardNo.CardNoValue = reader.GetSqlValue(0).ToString().Trim().Substring(5);
                            lstCardNo.Add(objCardNo);
                        }
                    }
                }

            }
            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();
                }
            }

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