Example #1
0
        public void BetweenDate(int id, string fromdate, string todate)
        {
            using (var db = DBConnection.CreateConnection())
            {
                db.Open();

                var sql = "dbo.GET_BETWEEN_DATE";
                var cmd = new SqlCommand(sql, db);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@EMP_ID", id));
                cmd.Parameters.Add(new SqlParameter("@FROM_DATE", fromdate));
                cmd.Parameters.Add(new SqlParameter("@TO_DATE", todate));
                var reader = cmd.ExecuteReader();

                if (!reader.HasRows)
                {
                    return;
                }
                while (reader.Read())
                {
                    var item = new AttendanceItem();
                    item.FNAME   = (string)reader["FIRST_NAME"];
                    item.TIMEIN  = (string)reader["CLOCK_IN"];
                    item.TIMEOUT = (string)reader["CLOCK_OUT"];
                    item.DATE    = (string)reader["LOG_DATE"];

                    StaticSortedListAttendance.staticSortedList.Add(item);
                }
                db.Close();
            }
        }
Example #2
0
        public void GetUserAttendance(int empid)
        {
            using (var db = DBConnection.CreateConnection())
            {
                db.Open();

                var sql = "dbo.GET_ATTENDANCE";
                var cmd = new SqlCommand(sql, db);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@EMP_ID", empid));
                var reader = cmd.ExecuteReader();

                if (!reader.HasRows)
                {
                    return;
                }

                while (reader.Read())
                {
                    var item = new AttendanceItem();
                    item.LOG_ID  = (int)reader["LOG_ID"];
                    item.FNAME   = (string)reader["FIRST_NAME"];
                    item.TIMEIN  = (string)reader["TIME_IN"];
                    item.TIMEOUT = (string)reader["TIME_OUT"];
                    item.DATE    = (string)reader["LOG_DATE"];

                    StaticAttendanceList.staticAttendanceList.Add(item);
                }
                db.Close();
            }
        }
Example #3
0
        public List <AttendanceItem> GetAttendance()
        {
            List <AttendanceItem> itemList = new List <AttendanceItem>();

            using (var db = DBConnection.CreateConnection())
            {
                db.Open();

                var sql    = "dbo.GET_ATTENDANCE";
                var cmd    = new SqlCommand(sql, db);
                var reader = cmd.ExecuteReader();

                if (!reader.HasRows)
                {
                    return(null);
                }

                while (reader.Read())
                {
                    var item = new AttendanceItem();

                    item._LOG_ID   = (int)reader["LOG_ID"];
                    item._EMP_ID   = (int)reader["EMP_ID"];
                    item._TIME_IN  = (string)reader["TIME_IN"];
                    item._TIME_OUT = (string)reader["TIME_OUT"];
                    item._DATE     = (string)reader["DATE"];


                    itemList.Add(item);
                }

                db.Close();
                return(itemList);
            }
        }