Ejemplo n.º 1
0
        public List <StudentLogEntityDC> GetAllStudentLogs(string Search, string AccountID, string StartDate, string EndDate, int PageIndex, int PageSize, out int Count)

        {
            List <StudentLogEntityDC> productResponse = new List <StudentLogEntityDC>();
            StudentLogEntityDC        member          = new StudentLogEntityDC();
            LogDAL LogsDAL = new LogDAL();

            productResponse = LogsDAL.GetAllStudentLogs(Search, AccountID, StartDate, EndDate, PageIndex, PageSize, out Count);
            return(productResponse);
        }
Ejemplo n.º 2
0
        public List <StudentLogEntityDC> GetAllStudentLogs(string Search, string AccountID, string StartDate, string EndDate, int PageIndex, int PageSize, out int Count)
        {
            StudentLogListEntity      Members    = new StudentLogListEntity();
            List <StudentLogEntityDC> MemberList = new List <StudentLogEntityDC>();

            using (DbConnection conn = Reedley.CreateConnection())
            {
                conn.Open();
                try
                {
                    using (DbCommand sprocCmd = conn.CreateCommand())
                    {
                        sprocCmd.CommandType = CommandType.StoredProcedure;
                        sprocCmd.CommandText = sp_GetAllStudentLogs;
                        sprocCmd.Parameters.Add(new SqlParameter("@Search", Search.ToStringDefault())
                        {
                            SqlDbType = SqlDbType.NVarChar
                        });
                        if (AccountID != "")
                        {
                            sprocCmd.Parameters.Add(new SqlParameter("@AccountID", AccountID.ToGuid())
                            {
                                SqlDbType = SqlDbType.UniqueIdentifier
                            });
                        }
                        if (StartDate != "" && StartDate != null)
                        {
                            sprocCmd.Parameters.Add(new SqlParameter("@DateTimeStart", StartDate.ToDateTime())
                            {
                                SqlDbType = SqlDbType.DateTime
                            });
                        }
                        if (EndDate != "" && EndDate != null)
                        {
                            sprocCmd.Parameters.Add(new SqlParameter("@DateTimeEnd", EndDate.ToDateTime())
                            {
                                SqlDbType = SqlDbType.DateTime
                            });
                        }
                        sprocCmd.Parameters.Add(new SqlParameter("@PageIndex", PageIndex.ToInt())
                        {
                            SqlDbType = SqlDbType.Int
                        });
                        sprocCmd.Parameters.Add(new SqlParameter("@PageSize", PageSize.ToInt())
                        {
                            SqlDbType = SqlDbType.Int
                        });


                        var CountResult = sprocCmd.CreateParameter();
                        CountResult.ParameterName = "@Count";
                        CountResult.Direction     = ParameterDirection.Output;
                        CountResult.DbType        = DbType.Int32;
                        sprocCmd.Parameters.Add(CountResult);

                        using (IDataReader sprocReader = Reedley.ExecuteReader(sprocCmd))
                        {
                            while (sprocReader.Read())
                            {
                                StudentLogEntityDC Member = new StudentLogEntityDC();
                                Member.MemberID         = sprocReader["MemberID"].ToGuid();
                                Member.FirstName        = sprocReader["FirstName"].ToStringDefault();
                                Member.LastName         = sprocReader["LastName"].ToStringDefault();
                                Member.IDNumber         = sprocReader["IDNumber"].ToStringDefault();
                                Member.Affiliation      = sprocReader["Affiliation"].ToStringDefault();
                                Member.Department       = sprocReader["Department"].ToStringDefault();
                                Member.RFID             = sprocReader["RFID"].ToStringDefault();
                                Member.DateTimeStamp    = sprocReader["DateTimeStamp"].ToStringDefault();
                                Member.LogType          = sprocReader["LogType"].ToStringDefault();
                                Member.GateTerminalName = sprocReader["GateTerminalName"].ToStringDefault();
                                MemberList.Add(Member);
                            }
                        }
                        Members.StudentLogList = MemberList;
                        Count = CountResult.Value.ToInt();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    if (conn != null)
                    {
                        conn.Close();
                    }
                }
            }

            return(MemberList);
        }