Пример #1
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            MdlLogin log = new MdlLogin();

            log.setLogin(txtLogin.Text);
            log.setSenha(txtSenha.Text);

            Login ctlLogin = new Login();

            ctlLogin.Verificar(log.getLogin(), log.getSenha());

            if (ctlLogin.Acesso() == true)
            {
                MessageBox.Show("Acesso Permitido", "Parabéns", MessageBoxButtons.OK, MessageBoxIcon.Information);
                frmSettings confg = new frmSettings();
                Close();
                confg.Visible = true;
            }
            else
            {
                MessageBox.Show("Acesso Negado", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtLogin.Text = string.Empty;
                txtSenha.Text = string.Empty;
                txtLogin.Focus();
            }
        }
Пример #2
0
        public JsonResult Logueo(MdlLogin model, string returnUrl, string donde)
        {
            var res  = new RCAU();
            var resu = "";

            try
            {
                res = db.RCAU.Where(m => m.UUSR == model.User && m.USTS == "A" && (m.UTIPO == "POOLASISTENTE" || (m.UMOD == "SRGUSR" || m.UMOD == "ASISTENTE"))).SingleOrDefault();
                if (res != null)
                {
                    if (res.UPASS == model.Password)
                    {
                        //if (res.UACC03 == 1)
                        //{
                        //    res.UMOD = "JEFE";
                        //}
                        SessionManager.Set("VarUsuario", res);
                        resu = "OK";
                    }
                    else
                    {
                        resu = "La contraseña es incorrecta";
                    }
                }
                else
                {
                    resu = "Usuario no existe";
                }
            }
            catch (Exception ex)
            {
                //res = "ERROR: " + ex.Message;
            }

            var tipousr = "";

            if (resu == "OK")
            {
                if (res.UACC01 == null || res.UACC01 == 1)
                {
                    tipousr = "******";
                }

                if (res.UACC02 == 1)
                {
                    tipousr = "******";
                }

                if (res.UACC03 == 1)
                {
                    tipousr = "******";
                }

                if (res.UACC04 == 1)
                {
                    tipousr = "******";
                }
            }


            return(Json(new { result = resu, redir = donde, Tipo = tipousr }));
        }
Пример #3
0
        public JsonResult Logueo(MdlLogin model, string returnUrl, string donde)
        {
            RCAU          mRCAU = new RCAU();
            string        res   = "";
            StringBuilder Error = new StringBuilder();

            try
            {
                mRCAU = db.RCAU.Where(m => m.UUSR == model.User && m.USTS == "A").SingleOrDefault();
                if (res != null)
                {
                    if (mRCAU.UPASS == model.Password)
                    {
                        SessionManager.Set("VarUsuario", res);
                        res = "OK";
                    }
                    else
                    {
                        res = "La contraseña es incorrecta";
                    }
                }
                else
                {
                    res = "Usuario no existe";
                }
            }
            catch (DbEntityValidationException ex)
            {
                Error.AppendLine(ex.ToString());
                foreach (var eve in ex.EntityValidationErrors)
                {
                    Error.AppendLine("");
                    Error.AppendFormat("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Error.AppendLine("");
                        Error.AppendFormat("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage);
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage);
                    }
                }
                res = "ERROR: " + Error.ToString();
            }
            catch (Exception ex)
            {
                res = "ERROR: " + ex.ToString() + ((ex.InnerException != null) ? ex.InnerException.ToString() : "");
            }

            var tipousr = "";

            //if (resu == "OK")
            //{
            //    if (res.UACC01 == null || res.UACC01 == 1)
            //    {
            //        tipousr = "******";
            //    }

            //    if (res.UACC02 == 1)
            //    {
            //        tipousr = "******";
            //    }

            //    if (res.UACC03 == 1)
            //    {
            //        tipousr = "******";
            //    }

            //    if (res.UACC04 == 1)
            //    {
            //        tipousr = "******";
            //    }
            //}


            return(Json(new { result = res, redir = donde, Tipo = tipousr }));
        }