Ejemplo n.º 1
0
        public clsJustification obtieneVistaPreviaJustificacion(int JustificacionId, string tag)
        {
            clsJustification us  = null;
            SqlCommand       cmd = null;
            SqlDataReader    dr  = null;
            SqlConnection    cn  = null;

            try
            {
                cn  = clsConnection.GetConnection();
                cmd = new SqlCommand("xp_sP_ObtieneDatos_Tag", cn);
                cmd.Parameters.AddWithValue("@JUSTIFICACIONID", JustificacionId);
                cmd.Parameters.AddWithValue("@TAGID", tag);
                cmd.CommandType = CommandType.StoredProcedure;
                dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    us         = new clsJustification();
                    us.JustTag = dr[0].ToString();
                }
            }
            catch (Exception ex)
            {
                //Base.Errors.Add(new BaseEntity.ListError(ex, "Error on user in dao"));
            }
            finally { clsConnection.DisposeCommand(cmd); }
            return(us);
        }
Ejemplo n.º 2
0
        public int SaveJustificacion2(ref BaseEntity Entity, clsJustification objAsgJust)
        {
            int           i   = 0;
            SqlCommand    cmd = null;
            SqlConnection cn  = clsConnection.GetConnection();

            try
            {
                cmd             = new SqlCommand("sp_xP_Guardar_Asignacion_Justificacion", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@EmpresaId", objAsgJust.EmpresaId);
                cmd.Parameters.AddWithValue("@Archivo", objAsgJust.Archivo);
                cmd.Parameters.AddWithValue("@EmpleadoId", objAsgJust.EmpleadoId);
                cmd.Parameters.AddWithValue("@JustificacionPlantillaId", objAsgJust.justificacion.ID);
                cmd.Parameters.AddWithValue("@Motivo", objAsgJust.Motivo);
                cmd.Parameters.AddWithValue("@Fecha", objAsgJust.Fecha);
                if (objAsgJust.TardanzaId == 0)
                {
                    cmd.Parameters.AddWithValue("@TardanzaId", null);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@TardanzaId", objAsgJust.TardanzaId);
                }
                if (objAsgJust.InasistenciaId == 0)
                {
                    cmd.Parameters.AddWithValue("@InasistenciaId", null);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@InasistenciaId", objAsgJust.InasistenciaId);
                }

                cmd.Parameters.AddWithValue("@CreatedBy", objAsgJust.Createdby);

                i = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Entity.Errors.Add(new BaseEntity.ListError(ex, "Error saving Memorandum"));
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(i);
        }
Ejemplo n.º 3
0
        public int UpdateJustificacion2(ref BaseEntity Base, clsJustification objJust)
        {
            SqlCommand cmd       = null;
            int        isCorrect = 0;

            try
            {
                cmd             = new SqlCommand("sp_xP_Editar_Asignacion_Justificacion", clsConnection.GetConnection());
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@JustificacionId", objJust.ID);
                cmd.Parameters.AddWithValue("@Archivo", objJust.Archivo);
                cmd.Parameters.AddWithValue("@EmpleadoId", objJust.EmpleadoId);
                cmd.Parameters.AddWithValue("@JustificacionPlantillaId", objJust.justificacion.ID);
                cmd.Parameters.AddWithValue("@Motivo", objJust.Motivo);
                cmd.Parameters.AddWithValue("@Fecha", objJust.Fecha);

                if (objJust.TardanzaId == 0)
                {
                    cmd.Parameters.AddWithValue("@TardanzaId", null);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@TardanzaId", objJust.TardanzaId);
                }
                if (objJust.InasistenciaId == 0)
                {
                    cmd.Parameters.AddWithValue("@InasistenciaId", null);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@InasistenciaId", objJust.InasistenciaId);
                }
                cmd.Parameters.AddWithValue("@LastUpdateBy", objJust.Updatedby);

                isCorrect = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                isCorrect = 0;
                Base.Errors.Add(new BaseEntity.ListError(ex, "An error occurred on Save Justificación"));
            }
            finally { cmd.Connection.Close(); }
            return(isCorrect);
        }
Ejemplo n.º 4
0
        public clsJustification SearchJustificacion(ref BaseEntity Base, int loanId)
        {
            clsJustification busq = null;
            SqlDataReader    dr   = null;
            SqlCommand       cmd  = null;

            try
            {
                cmd = new SqlCommand("sp_xP_Buscar_Asignacion_Justificacion", clsConnection.GetConnection());
                cmd.Parameters.AddWithValue("@prmId", loanId);
                cmd.CommandType = CommandType.StoredProcedure;
                dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    busq           = new clsJustification();
                    busq.ID        = Convert.ToInt32(dr["IDJUSTIFICACION"]);
                    busq.EmpresaId = Convert.ToInt32(dr["IDEMPRESA"]);
                    busq.Archivo   = dr["DOCUMENTO"].ToString();

                    //obtener empleado de lista (id, nombre)
                    clsEmployee objEmp = new clsEmployee();
                    objEmp.Name     = dr["NOMBEMPLEADO"].ToString(); //nombre
                    busq.EmpleadoId = Convert.ToInt32(dr["EmpleadoId"]);
                    busq.employee   = objEmp;                        //guardo valores en mi objeto tipo clase

                    //obtener valor del combo (id)
                    clsTemplateJustification objTM = new clsTemplateJustification();
                    objTM.ID           = Convert.ToInt32(dr["IDPLANTILLAJUSTIFICACION"]);
                    busq.justificacion = objTM;

                    //
                    busq.Motivo = dr["RAZON"].ToString();
                    busq.Fecha  = Convert.ToDateTime(dr["FECHA"].ToString());
                }
            }
            catch (Exception ex)
            {
                busq = null;
                Base.Errors.Add(new BaseEntity.ListError(ex, "Error Justificación search"));
            }
            return(busq);
        }