コード例 #1
0
ファイル: RegistroProducto.aspx.cs プロジェクト: VariniaD/CRM
    protected void registrarProducto(object sender, EventArgs e)
    {
        msgError.Text = "";



        try
        {
            string nombre      = (nombreTxt.Text).Trim();
            string descripcion = (descripcionTxt.Text).Trim();



            if (nombre.Equals(""))
            {
                msgError.Text = "Ingrese un Nombre";
                return;
            }
            if (descripcion.Equals(""))
            {
                msgError.Text = "Ingrese la descripcion";
                return;
            }
            if (LineaNegocio_ProductoTxt.Equals(""))
            {
                msgError.Text = "Ingrese un Linea Negocio";
                return;
            }
            if (descripcion.Length < 15)
            {
                msgError.Text = "la descripcion tiene que ser mayor a 15 ";
                return;
            }



            ProductoDAO producto = new ProductoDAO();
            producto.nombre                = nombre;
            producto.descripcion           = descripcion;
            producto.LineaNegocio_Producto = Convert.ToInt32(LineaNegocio_ProductoTxt.SelectedValue);


            ProductoDto.InsertProducto(producto);
            Response.Redirect("index.aspx");
        }
        catch (Exception E) {
            msgError.Text = "Error al optener los datos" + E.Message;
        }
    }
コード例 #2
0
ファイル: RegistroEmpresa.aspx.cs プロジェクト: VariniaD/CRM
    protected void registrarEmpresa(object sender, EventArgs e)
    {
        msgError.Text = "";



        try
        {
            string nombre      = (nombreTxt.Text).Trim();
            string descripcion = (descripcionTxt.Text).Trim();



            if (nombre.Equals(""))
            {
                msgError.Text = "Ingrese un Nombre";
                return;
            }
            if (descripcion.Equals(""))
            {
                msgError.Text = "Ingrese la descripcion";
                return;
            }
            if (LineaNegocio_ProductoTxt.Equals(""))
            {
                msgError.Text = "Ingrese una Emrpesa";
                return;
            }
            if (descripcion.Length < 15)
            {
                msgError.Text = "la descripcion tiene que ser mayor a 15 ";
                return;
            }


            EmpresaDAO empresa = new EmpresaDAO();
            empresa.nombre          = nombre;
            empresa.descripcion     = descripcion;
            empresa.Usuario_Empresa = Convert.ToInt32(LineaNegocio_ProductoTxt.SelectedValue);


            EmpresaDto.InsertEmpresa(empresa);
            Response.Redirect("index.aspx");
        }
        catch (Exception E) {
            msgError.Text = "Error al optener los datos";
        }
    }