Esempio n. 1
0
        protected void btnGenerarRestrCR_Click(object sender, EventArgs e)
        {
            RESTRICCION restriccion = new RESTRICCION();

            if (RadioButtonList1.SelectedValue.ToString().Equals("Temporal"))
            {
                restriccion.TIPO_PROHIBICION = 1144;
            }
            else if (RadioButtonList1.SelectedValue.ToString().Equals("Permanente"))
            {
                restriccion.TIPO_PROHIBICION = 1145;
            }

            restriccion.TIPO_GRAVISIMA = Convert.ToInt32(txtGravisimaCR.Text);
            restriccion.TIPO_GRAVE     = Convert.ToInt32(txtGraveCR.Text);
            restriccion.TIPO_LEVE      = Convert.ToInt32(txtLeveCR.Text);
            if (txtDiasTempCR.Text == null || txtDiasTempCR.Text == "")
            {
                restriccion.DIAS_PROH = 0;
            }
            else
            {
                restriccion.DIAS_PROH = Convert.ToInt32(txtDiasTempCR.Text);
            }


            int idRestriccion = NegocioRestriccion.Instancia.InsertarRestriccion(restriccion);

            lblInfoCR.Text      = "La restricción ha sido creada satisfactoriamente";
            lblInfoCR.ForeColor = System.Drawing.Color.Gray;
            lblInfoCR.Visible   = true;
        }
        public int Crear(RESTRICCION dto)
        {
            int idRestriccion = 0;

            using (SRI con = new SRI())
            {
                dto.ID_RESTRICCION = NuevoID();
                con.RESTRICCION.AddObject(dto);
                con.SaveChanges();
            }



            return(idRestriccion);
        }
 public int InsertarRestriccion(RESTRICCION dto)
 {
     return(RestriccionDao.Instancia.Crear(dto));
 }