public int NumRecordsUser(int IdUser)
 {
     try
     {
         String   Query    = String.Format("SELECT COUNT(*) FROM checkInHours WHERE _registry = 1 and idEmployee = {0}", IdUser);
         ModelDAL ModelDAL = new ModelDAL();
         return(ModelDAL.CountRecord(Query.ToString(), ConnectionString));
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.NumRecordsUser: {1}", core, ex));
     }
 }
Beispiel #2
0
 public int DayOfWeekRecord(DateTime DateTimeRecord, int IdUser)
 {
     try
     {
         StringBuilder Query = new StringBuilder();
         Query.AppendLine("SELECT COUNT(*) FROM daysOfWorkEmployee ");
         Query.AppendLine("Join days on days.id = daysOfWorkEmployee.idDays ");
         Query.AppendFormat("WHERE idEmployee = {0} ", IdUser);
         Query.AppendFormat("AND nameIn = '{0}' ", Convert.ToString(DateTimeRecord.DayOfWeek));
         ModelDAL ModelDAL = new ModelDAL();
         return(ModelDAL.CountRecord(Query.ToString(), ConnectionString));
     }catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.DayOfWeekRecord: {1}", core, ex.Message));
     }
 }
        /// <summary>
        /// Verificar si existe una marcacion con los mismo parametros
        /// </summary>
        /// <param name="IdUser"></param>
        /// <param name="DateTimeRecord"></param>
        /// <returns></returns>
        public int IsExistRecord(int IdUser, DateTime DateTimeRecord)
        {
            try
            {
                ModelDAL      ModelDAL = new ModelDAL();
                StringBuilder Query    = new StringBuilder();
                Query.AppendLine("SELECT COUNT(*) FROM checkInHours WHERE ");
                Query.AppendLine("_registry = 1 ");
                Query.AppendFormat("AND idEmployee = {0} ", IdUser);
                Query.AppendFormat("AND dateTimeRecord = '{0}' ", DateTimeRecord.ToString("yyyy-MM-dd HH:mm:ss"));

                return(ModelDAL.CountRecord(Query.ToString(), ConnectionString));
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("{0}.IsExistRecord: {1}", core, ex));
            }
        }