public SingleVacaciones(Vacaciones reg)
        {
            InitializeComponent();
            vacaciones = reg;
            this.DataContext = vacaciones;

            btnActualizar.Visibility = Visibility.Visible;
            btnGuardar.Visibility = Visibility.Collapsed;
        }
示例#2
0
        public string Create(Vacaciones obj)
        {

            CreateDAC objDAC = new CreateDAC();
            if (objDAC.CreateRecord(obj) == true)
                return "Registro almacenado con éxito.";
            else
                return "No se pudo almacenar el regitro.";
        }
示例#3
0
        public bool UpdateRecord(Vacaciones obj, int idVacaciones)
        {
            SqlConnection con = new SqlConnection(Info.sqlSet());
            SqlCommand cmd = new SqlCommand("SP_Vacaciones_Update", con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@IdVacaciones", idVacaciones);
            cmd.Parameters.AddWithValue("@Inicio", obj.Inicio);
            cmd.Parameters.AddWithValue("@Fin", obj.Fin);
            cmd.Parameters.AddWithValue("@Activa", obj.Activa);
            con.Open();

            if (cmd.ExecuteNonQuery() > 0)
            {
                con.Close();
                return true;
            }
            else
            {
                con.Close();
                return false;
            }
        }
示例#4
0
        public List<Vacaciones> readVacaciones()
        {
            List<Vacaciones> vacacionesList = new List<Vacaciones>();

            using (SqlConnection con = new SqlConnection(Info.sqlSet()))
            {
                SqlCommand cmd = new SqlCommand("SP_Vacaciones_SelectAll", con);
                cmd.CommandType = CommandType.StoredProcedure;

                con.Open();

                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    // Loop through each record.
                    while (reader.Read())
                    {
                        Vacaciones tmp = new Vacaciones();

                        tmp.IdVacaciones = (reader.GetValue(0) != DBNull.Value) ? Convert.ToInt32(reader.GetValue(0)) : tmp.IdVacaciones;
                        tmp.Inicio = (reader.GetValue(1) != DBNull.Value) ? Convert.ToDateTime(reader.GetValue(1)) : tmp.Inicio;
                        tmp.Fin = (reader.GetValue(2) != DBNull.Value) ? Convert.ToDateTime(reader.GetValue(2)) : tmp.Fin;
                        tmp.Activa = (reader.GetValue(3) != DBNull.Value) ? Convert.ToBoolean(reader.GetValue(3)) : tmp.Activa;

                        vacacionesList.Add(tmp);
                    }
                }

                con.Close();
            }

            return vacacionesList;
        }
示例#5
0
        public Vacaciones readOneVacaciones(int idVacaciones)
        {
            Vacaciones vacaciones = new Vacaciones();

            using (SqlConnection con = new SqlConnection(Info.sqlSet()))
            {
                SqlCommand cmd = new SqlCommand("SP_Vacaciones_SelectRow", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@IdVacaciones", idVacaciones);

                con.Open();

                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    // Loop through each record.
                    while (reader.Read())
                    {
                        Vacaciones tmp = new Vacaciones();

                        tmp.IdVacaciones = (reader.GetValue(0) != DBNull.Value) ? Convert.ToInt32(reader.GetValue(0)) : tmp.IdVacaciones;
                        tmp.Inicio = (reader.GetValue(1) != DBNull.Value) ? Convert.ToDateTime(reader.GetValue(1)) : tmp.Inicio;
                        tmp.Fin = (reader.GetValue(2) != DBNull.Value) ? Convert.ToDateTime(reader.GetValue(2)) : tmp.Fin;
                        tmp.Activa = (reader.GetValue(3) != DBNull.Value) ? Convert.ToBoolean(reader.GetValue(3)) : tmp.Activa;

                        vacaciones = tmp;
                    }
                }

                con.Close();
            }

            return vacaciones;
        }
示例#6
0
        public string Update(Vacaciones obj, int idVacaciones)
        {

            UpdateDAC objDAC = new UpdateDAC();
            if (objDAC.UpdateRecord(obj, idVacaciones) == true)
                return "Registro almacenado con éxito.";
            else
                return "No se pudo almacenar el regitro.";
        }