예제 #1
0
        public int getUserDialing(String idUser)
        {
            try
            {
                ModelDAL         ModelDAL         = new ModelDAL();
                StringBuilder    Query            = new StringBuilder();
                UsersDAL         UsersDAL         = new UsersDAL();
                UsersEmployeeDAL UsersEmployeeDAL = new UsersEmployeeDAL();

                Query.AppendLine("select ");
                Query.AppendFormat("{0} ", UsersEmployeeML.DataBase.IdEmployee);
                Query.AppendLine("from ");
                Query.AppendFormat("{0} ", UsersDAL.TableName);
                Query.AppendFormat("left join {0} on ", UsersEmployeeDAL.TableName);
                Query.AppendFormat("{0}.{1} = {2}.{3} ", UsersDAL.TableName, UsersML.DataBase.Id, UsersEmployeeDAL.TableName, UsersEmployeeML.DataBase.IdEmployee);
                Query.AppendLine("where ");
                Query.AppendFormat("{0}.{1} = {2}", UsersEmployeeDAL.TableName, UsersEmployeeML.DataBase.IdUser, idUser);

                DataTable Response = ModelDAL.DataTableRecord(Query.ToString(), ConnectionString);
                if (Response.Rows.Count > 0)
                {
                    return((int)Response.Rows[0][UsersEmployeeML.DataBase.IdEmployee]);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("{0}.getUserDialing: {1}", core, ex.Message));
            }
        }
예제 #2
0
        public int Save(UsersML User)
        {
            try
            {
                ModelDAL ModelDAL = new ModelDAL();
                String   Response = ModelDAL.InsertModel(User, TableName, IdUserSession);

                SqlConnection Conexion = new SqlConnection
                {
                    ConnectionString = ConnectionString
                };

                using (SqlCommand cmd2 = new SqlCommand(Response.ToString(), Conexion))
                {
                    Conexion.Open();
                    int newID = (Int32)cmd2.ExecuteScalar();

                    if (Conexion.State == System.Data.ConnectionState.Open)
                    {
                        Conexion.Close();
                    }
                    return(newID);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("{0}.save : {1}", core, ex));
            }
        }
예제 #3
0
 public void InsertNumUser(int number)
 {
     try
     {
         ModelDAL ModelDAL = new ModelDAL();
         //String Query = String.Format("Update")
     }
     catch (Exception ex)
     {
         throw new Exception(string.Format("InsertNumUser: {0}", ex.Message));
     }
 }
예제 #4
0
 public int Save(CompanyML company)
 {
     try
     {
         ModelDAL ModelDAL = new ModelDAL();
         return(Convert.ToInt32(ModelDAL.InsertModel(company, TableName, IdUserSession, ConnectionString)));
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.save : {1}", core, ex));
     }
 }
예제 #5
0
 public DataTable GetIdEntity(int id)
 {
     try
     {
         String   Query    = String.Format("SELECT * FROM {0} WHERE _registry = 1 AND id={1}", TableName, id);
         ModelDAL ModelDAL = new ModelDAL();
         return(ModelDAL.DataTableRecord(Query, ConnectionString));
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.GetIdEntity : {1}", core, ex));
     }
 }
예제 #6
0
 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));
     }
 }
예제 #7
0
 /// <summary>
 /// Obtiene la ultima Marcacion del empleado
 /// </summary>
 /// <param name="IdUser"></param>
 /// <returns></returns>
 public DataTable DataTableOldRecord(int IdUser)
 {
     try
     {
         ModelDAL ModelDAL = new ModelDAL();
         String   Query    = String.Format("SELECT TOP 1 dateTimeRecord FROM checkInHours WHERE idEmployee = {0} ORDER BY id DESC", IdUser);
         return(ModelDAL.DataTableRecord(Query.ToString(), ConnectionString));
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.DataTableOldRecord: {1}", core, ex.Message));
     }
 }
예제 #8
0
 public int Delete(CompanyML Company)
 {
     try
     {
         ModelDAL ModelDAL = new ModelDAL();
         ModelDAL.DeleteModel(Company, TableName, IdUserSession, ConnectionString);
         return(Company.Id);
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.delete: {1}", core, ex));
     }
 }
예제 #9
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));
     }
 }
예제 #10
0
        /// <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));
            }
        }
예제 #11
0
 public int Insert(UsersEmployeeML usersEmployee)
 {
     try
     {
         ModelDAL      ModelDAL = new ModelDAL();
         String        Response = ModelDAL.InsertModel(usersEmployee, TableName, IdUserSession);
         SqlConnection Conexion = new SqlConnection
         {
             ConnectionString = ConnectionString
         };
         Conexion.Open();
         SqlCommand cmd2 = new SqlCommand(Response.ToString(), Conexion);
         return(cmd2.ExecuteNonQuery());
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.Insert : {1}", core, ex));
     }
 }
예제 #12
0
 public void Delete(UsersEmployeeML usersEmployee)
 {
     try
     {
         ModelDAL      ModelDAL = new ModelDAL();
         String        Response = ModelDAL.DeleteModel(usersEmployee, TableName, IdUserSession);
         SqlConnection Conexion = new SqlConnection()
         {
             ConnectionString = ConnectionString
         };
         Conexion.Open();
         SqlCommand cmd2 = new SqlCommand(Response.ToString(), Conexion);
         cmd2.ExecuteNonQuery();
         Conexion.Close();
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.delete: {1}", core, ex));
     }
 }
예제 #13
0
 public int Update(MigrationHistoryML MigrationHistory)
 {
     try
     {
         ModelDAL      ModelDAL = new ModelDAL();
         String        Response = ModelDAL.UpdateModel(MigrationHistory, TableName, IdUserSession);
         SqlConnection Conexion = new SqlConnection()
         {
             ConnectionString = ConnectionString
         };
         Conexion.Open();
         SqlCommand cmd2 = new SqlCommand(Response.ToString(), Conexion);
         cmd2.ExecuteNonQuery();
         return(MigrationHistory.Id);
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.update: {1}", core, ex));
     }
 }
 public int Update(AbsenteeismAssignmentML Absenteeismassignment)
 {
     try
     {
         ModelDAL      ModelDAL = new ModelDAL();
         String        Response = ModelDAL.UpdateModel(Absenteeismassignment, TableName, IdUserSession);
         SqlConnection Conexion = new SqlConnection()
         {
             ConnectionString = ConnectionString
         };
         Conexion.Open();
         SqlCommand cmd2 = new SqlCommand(Response.ToString(), Conexion);
         cmd2.ExecuteNonQuery();
         Conexion.Close();
         return(Absenteeismassignment.Id);
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.update: {1}", core, ex));
     }
 }
예제 #15
0
        public int Save(MigrationHistoryML MigrationHistory)
        {
            ModelDAL      data     = new ModelDAL();
            String        Response = data.InsertModel(MigrationHistory, TableName, IdUserSession);
            SqlConnection Conexion = new SqlConnection
            {
                ConnectionString = ConnectionString
            };

            using (SqlCommand cmd2 = new SqlCommand(Response.ToString(), Conexion))
            {
                Conexion.Open();
                int newID = (Int32)cmd2.ExecuteScalar();

                if (Conexion.State == System.Data.ConnectionState.Open)
                {
                    Conexion.Close();
                }
                return(newID);
            }
        }
예제 #16
0
        public int Update(DaysOfWorkEmployeeML DaysOfWorkEmployee)
        {
            try
            {
                ModelDAL      ModelDAL = new ModelDAL();
                String        Response = ModelDAL.UpdateModel(DaysOfWorkEmployee, TableName, IdUserSession);
                SqlConnection Conexion = new SqlConnection()
                {
                    ConnectionString = ConnectionString
                };
                Conexion.Open();
                SqlCommand cmd2 = new SqlCommand(Response.ToString(), Conexion);
                cmd2.ExecuteNonQuery();
                Conexion.Close();

                return(DaysOfWorkEmployee.Id);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("{0}.update: {1}", core, ex));
            }
        }
예제 #17
0
        public DataTable All(String Type)
        {
            try
            {
                ModelDAL ModelDAL = new ModelDAL();
                String   Query    = "";
                if (Type == "All")
                {
                    Query = String.Format("SELECT * FROM {0} WHERE _registry = 1", TableName);
                }
                else
                {
                    Query = String.Format("SELECT {0}.[id] ,{0}.[name] as Turno,{0}.[Description] as Descripcion,{0}.[TimeEntry] as HoraEntrada,{0}.[StartEntry] as IniciaEntrada,{0}.[LimitEntry] as LimiteEntrada,{0}.[Departuretime] as HoraSalida,{0}.[LimitDeparture] as LimiteSalida, {0}.[HoursJornada] as HorasJornada  FROM {0} where {0}._registry = 1", TableName);
                }

                DataTable dtTurnos = ModelDAL.DataTableRecord(Query, ConnectionString);

                return(dtTurnos);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("{0}.All : {1}", core, ex));
            }
        }