protected void BtnSave_Click(object sender, EventArgs e)
        {
            clUsuario cluUsuario = new clUsuario();

            string sterror = string.Empty;
            if (!string.IsNullOrEmpty(TBoxuserLogin.Text))
                cluUsuario.Login = TBoxuserLogin.Text;
            else
                sterror += @"Debe de ingresar la ficha <br \>";
            if (!string.IsNullOrEmpty(TBoxPassword.Text))
                cluUsuario.Password = TBoxPassword.Text;
            else
                sterror += @"Debe de ingresar el password <br \>";
            if (!string.IsNullOrEmpty(TBoxName.Text))
            cluUsuario.Name = TBoxName.Text;
            else
                sterror += @"Debe de ingresar el nombre <br \>";
            if (!string.IsNullOrEmpty(TBoxLastName.Text))
            cluUsuario.LastName = TBoxLastName.Text;
            else
                sterror += @"Debe de ingresar el apellido paterno <br \>";
            if (!string.IsNullOrEmpty(TBoxMiddleName.Text))
            cluUsuario.MiddleName=TBoxMiddleName.Text;
            else
                sterror += @"Debe de ingresar el apellido materno <br \>";

            if (DDLLanguage.SelectedIndex>0)
                cluUsuario.IdLang = DDLLanguage.SelectedValue;
            else
                sterror += @"Debe de seleccionar un idioma <br \>";
            if (DDLRol.SelectedIndex > 0)
                cluUsuario.IdRol = Convert.ToInt32(DDLLanguage.SelectedValue);
            else
                sterror += @"Debe de seleccionar un idioma <br \>";
            cluUsuario.Internal = ChBoxInterno.Checked;
            if (string.IsNullOrEmpty(sterror))
            {
                try
                {
                    if (clConfiguracion.NuevoUsuario(cluUsuario))
                    {
                        Response.Redirect("/Pages/Configuracion/AdministraUsuarios.aspx");
                    }

                }
                catch (Exception ex)
                {

                    clExcepcion.Error(this, ex.Message.ToString());
                }

            }
            else
            {
                clExcepcion.Error(this, sterror);
            }
        }
Example #2
0
        public static Boolean ActualizarDatos(clUsuario cluUsuario)
        {
            Dictionary<string, object> diParametros = new Dictionary<string, object>();
            clConexionMySQL obConn = new clConexionMySQL(NombreConexion);
            diParametros.Add("@id_PersonalData", cluUsuario.IdUsuario );
            diParametros.Add("@PersonalData_Name", cluUsuario.Name);
            diParametros.Add("@PersonalData_LastName",cluUsuario.LastName);
            diParametros.Add("@PersonalData_MiddleName", cluUsuario.MiddleName);
            diParametros.Add("@PersonalData_Level",cluUsuario.Rol);
            diParametros.Add("@user_Login", cluUsuario.Login);
            diParametros.Add("@user_Mail",cluUsuario.Rol);

            DataTable dtUsuario = obConn.GetSPDataTable("REG_SP_AC_DatosPersonales", diParametros);

            return (dtUsuario.Rows.Count > 0);
        }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            clUsuario cluUsuario = new clUsuario();
            cluUsuario.IdUsuario = User.IdUsuario;
            string sterror = string.Empty;
            if (!string.IsNullOrEmpty(TBoxuserLogin.Text))
                cluUsuario.Login = TBoxuserLogin.Text;
            else
                sterror += @"Debe de ingresar la ficha <br \>";
            if (!string.IsNullOrEmpty(TBoxName.Text))
            cluUsuario.Name = TBoxName.Text;
            else
                sterror += @"Debe de ingresar el nombre <br \>";
            if (!string.IsNullOrEmpty(TBoxLastName.Text))
            cluUsuario.LastName = TBoxLastName.Text;
            else
                sterror += @"Debe de ingresar el apellido paterno <br \>";
            if (!string.IsNullOrEmpty(TBoxMiddleName.Text))
            cluUsuario.MiddleName=TBoxMiddleName.Text;
            else
                sterror += @"Debe de ingresar el apellido materno <br \>";

            if (string.IsNullOrEmpty(sterror))
            {
                try
                {
                    if (clConfiguracion.ActualizarDatos(cluUsuario))
                    {
                        clExcepcion.SuccessFunction(this, "Se han guardado con exito", "function() { window.location='/Pages/Configuracion/Config.aspx'}");
                    }

                }
                catch (Exception ex)
                {

                    clExcepcion.Error(this, ex.Message.ToString());
                }

            }
            else
            {
                clExcepcion.Error(this, sterror);
            }
        }
 private void CargarLenguaje()
 {
     clUsuario cluUsuario  = new clUsuario();
     DDLLanguage.DataSource = cluUsuario.GetLanguage();
     DDLLanguage.DataTextField = "Language";
     DDLLanguage.DataValueField = "id_Lang";
     DDLLanguage.DataBind();
     DDLLanguage.Items.Insert(0, new ListItem());
 }
Example #5
0
        public static Boolean NuevoUsuario(clUsuario cluUsuario)
        {
            Dictionary<string, object> diParametros = new Dictionary<string, object>();
            clConexionMySQL obConn = new clConexionMySQL(NombreConexion);
            diParametros.Add("@id_PersonalData", cluUsuario.IdUsuario);
            diParametros.Add("@PersonalData_Name", cluUsuario.Name);
            diParametros.Add("@PersonalData_LastName", cluUsuario.LastName);
            diParametros.Add("@PersonalData_MiddleName", cluUsuario.MiddleName);
            diParametros.Add("@PersonalData_Level", cluUsuario.Rol);
            diParametros.Add("@user_Login", cluUsuario.Login);
            diParametros.Add("@user_Password", cluUsuario.Password);
            diParametros.Add("@user_Mail", cluUsuario.Rol);
            diParametros.Add("@user_InternalEmp", cluUsuario.Internal);
            diParametros.Add("@user_idLang", cluUsuario.IdLang);
            diParametros.Add("@rel_IdRole", cluUsuario.IdRol);

            DataTable dtUsuario = obConn.GetSPDataTable("REG_SP_AC_DatosPersonales", diParametros);

            return (dtUsuario.Rows.Count > 0);
        }
        private void CargarDatos(string stFiltro)
        {
            clUsuario cluUsuario = new clUsuario();
            DataTable dtResultadoBusqueda = cluUsuario.GetUsuariosAdministrar(stFiltro);

            if (!String.IsNullOrEmpty(ViewState["SortExprValue"] as string))
            {

                String stSortExp = ViewState["SortExprValue"].ToString();

                if (dtResultadoBusqueda.Rows.Count > 0 & !String.IsNullOrEmpty(stSortExp))
                {
                    DataView dataView = new DataView(dtResultadoBusqueda);

                    SortDirection sortDirect = (SortDirection)ViewState["SortDirection"];

                    dataView.Sort = stSortExp + " " + ConvertSortDirectionToSql(sortDirect);

                    dtResultadoBusqueda = dataView.ToTable();

                    dataView.Dispose();
                }
            }

            GViewUsuarios.DataSource = dtResultadoBusqueda;
            GViewUsuarios.DataBind();
            GViewUsuarios.PageIndex = 0;

            //     LblResultadosbusqueda1.Text = String.Format("Resultados obtenidos: {0} ", dtResultadoBusqueda.Rows.Count);

            dtResultadoBusqueda.Dispose();

            //if (GViewUsuarios.Rows.Count == 0)
            //    NoData1.Visible = true;
            //else NoData1.Visible = false;
        }
Example #7
0
 public static void CrearSesionUsuario(clUsuario Persona)
 {
     HttpContext.Current.Session[strKEY] = Persona;
 }