Example #1
0
        protected void btGuardar_Click(object sender, EventArgs e)
        {
            RN.Entidades.Localidad lo = new RN.Entidades.Localidad();

            lo.Slocacion_nm = txtnombre.Text;
            lo.Slocacion_desc = txtdesc.Text;
            int x = Convert.ToInt32(ddlsubarea.SelectedItem.Value);
            lo.Isubarea = x;
               /// Boolean b = (cbestado.SelectedIndex.ToString()).Equals("1");
              ///  lo.Sstado = b;

            if (string.IsNullOrEmpty(txtcodigo.Text))
            {
                int codigo = CLocalidad.Insertar(lo);
                txtcodigo.Text = codigo.ToString();
                string s = ddlsubarea.SelectedItem.Value;
                cargarLocalidad();

            }
            else
            {
                lo.Ilocacion_id = Convert.ToInt32(txtcodigo.Text);
                CLocalidad.Actualizar(lo);
                //lblmensaje.Text = "DATOS ACTUALIZADOS";
                cargarLocalidad();
            }
            limpiar();
        }
Example #2
0
        public static int Insertar(Localidad objProxy)
        {
            ValidationException x = new ValidationException();

            if (string.IsNullOrEmpty(objProxy.Slocacion_nm))
                x.AgregarError("Ingrese el nombre del nombre");

            if (string.IsNullOrEmpty(objProxy.Slocacion_desc))
                x.AgregarError("Ingrese el nombre del descripcion");

            if (objProxy.Sstado)
                x.AgregarError("Ingrese el nombre del estado");

            if (objProxy.Isubarea<=0)
                x.AgregarError("Ingrese el sub-area");

            //if (x.Cantidad > 0)
            //    throw x;

            DAOLocalidad daoProxy = new DAOLocalidad();
            return daoProxy.Insert(objProxy.Slocacion_nm, objProxy.Slocacion_desc, objProxy.Sstado, objProxy.Isubarea);
        }
Example #3
0
        public static bool Actualizar(Localidad objProxy)
        {
            ValidationException x = new ValidationException();
            if (objProxy.Ilocacion_id <= 0)
                x.AgregarError("Ingrese el código");

            if (string.IsNullOrEmpty(objProxy.Slocacion_nm))
                x.AgregarError("Ingrese el nombre");

            if (string.IsNullOrEmpty(objProxy.Slocacion_desc))
                x.AgregarError("Ingrese el descripcion");

            if (objProxy.Sstado)
                x.AgregarError("Ingrese el estado");

            if (objProxy.Isubarea <= 0)
                x.AgregarError("Ingrese el código Subarea");

            if (x.Cantidad > 0)
                throw x;
            DAOLocalidad daoProxy = new DAOLocalidad();
            return daoProxy.Actualizar(objProxy.Ilocacion_id, objProxy.Slocacion_nm, objProxy.Slocacion_desc, objProxy.Sstado, objProxy.Isubarea);
        }
Example #4
0
 private static Localidad Cargar(DataRow fila)
 {
     Localidad objProxy = new Localidad();
     objProxy.Ilocacion_id = Convert.ToInt32(fila["iLocation_id"]);
     objProxy.Slocacion_nm = fila["sLocation_name"].ToString();
     objProxy.Slocacion_desc = fila["sLocation_desc"].ToString();
     objProxy.Sstado = Convert.ToBoolean(fila["SStatus"]);
     objProxy.Isubarea = Convert.ToInt32(fila["iSubArea_id"]);
       //  objProxy.Subarea = fila["sSubArea_name"].ToString();
     return objProxy;
 }