public DataTable SignIn2([FromBody] ApiService ias)
        {
            DB_Users USER = new DB_Users();

            USER.StrCon = strCon;
            DataTable dt2  = USER.login(ias.usr, ias.pwd);
            DataTable dt   = new DataTable();
            JObject   obj  = new JObject();
            DB_Users  user = new DB_Users();

            if (dt2.Rows.Count > 0)
            {
                dt = dt2;
                DataRow dr2 = dt2.Rows[0];
            }
            else
            {
                dt.Clear();
                dt.Columns.Add("error");
                dt.Columns.Add("mensaje");
                DataRow row = dt.NewRow();
                row["error"]   = "1";
                row["mensaje"] = USER.Message;
                dt.Rows.Add(row);
            }
            return(dt2);
        }
Ejemplo n.º 2
0
        protected void btnIngresar_Click(object sender, EventArgs e)
        {
            lblMensaje.Visible = false;
            DB_Users LibUser = new DB_Users();

            LibUser.StrCon = axVarSes.Lee <string>("StrCon");
            DataTable dt = LibUser.login(tbUser.Text, tbPassword.Text);

            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];


                LibUser.UserId = Convert.ToInt32(dr["user_id"].ToString());
                if (Convert.ToInt32(axVarSes.Lee <string>("ErrorCounter")) >= 3)
                {
                    LibUser.LockAccount();
                    lblMensaje.Visible = true;
                    lblMensaje.Text    = "Cuenta de usuario bloqueada.";
                }
                else
                {
                    axVarSes.Escribe("strUser", dr["first_name"] + " " + dr["last_name"]);
                    axVarSes.Escribe("strUserAccount", dr["user_account"].ToString());
                    axVarSes.Escribe("strPassword", dr["passwd"].ToString());
                    axVarSes.Escribe("strUserID", dr["user_id"].ToString());
                    axVarSes.Escribe("strUserKind", dr["kind"].ToString());
                    Response.Redirect("~/Forms/Index.aspx");
                }
            }
            else
            {
                lblMensaje.Visible = true;
                lblMensaje.Text    = LibUser.Message;
                axVarSes.Escribe("ErrorCounter", (Convert.ToInt16(axVarSes.Lee <string>("ErrorCounter")) + 1).ToString());
            }
        }