Exemple #1
0
 private void btn_acceder_Click(object sender, EventArgs e)
 {
     if (txt_usuario.Text != "" && txt_pass.Text != "")
     {
         clsConn cls = new clsConn();
         if (cls.login(txt_usuario.Text, txt_pass.Text) == "t")
         {
             /* if (!cls.checkPermiso(txt_usuario.Text))
              * {
              *   MessageBox.Show("El usuario " + txt_usuario.Text + " no tiene permisos para acceder al sistema.", "Error",
              *   MessageBoxButtons.OK, MessageBoxIcon.Error);
              *   clean();
              * }*/
             GestionarHuella gHuella = new GestionarHuella(false, 0);
             gHuella.Show();
             this.Hide();
         }
         else if (cls.login(txt_usuario.Text, txt_pass.Text) == "f")
         {
             MessageBox.Show("Credenciales incorrectas.", "Error",
                             MessageBoxButtons.OK, MessageBoxIcon.Error);
             clean();
         }
         else
         {
             MessageBox.Show("La base de datos está desconectada.", "Alerta",
                             MessageBoxButtons.OK, MessageBoxIcon.Information);
             clean();
         }
     }
 }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //抓值
            string cAccount  = Request["Account"];
            string cPassword = Request["Password"];

            clsConn       clsConn = new clsConn();
            SqlConnection Conn    = clsConn.GetConnection();

            RPaWorkLibrary.Encryption RPa_EN = new RPaWorkLibrary.Encryption();
            //這段要寫認證機制Start--------------------------------
            string sAccount  = Request["Account"];
            string sPassword = Request["Password"];

            string     sCheckPsw    = "SELECT cPassword FROM DEF_UserBook WHERE cAccount = @Account";
            SqlCommand sc_CheckUser = new SqlCommand(sCheckPsw, Conn);
            sc_CheckUser.Parameters.Add(new SqlParameter("@Account", SqlDbType.NVarChar));

            sc_CheckUser.Parameters["@Account"].Value = sAccount;

            SqlDataReader sdr_CheckUser;
            sdr_CheckUser = sc_CheckUser.ExecuteReader();
            DataTable dt_CheckUser = new DataTable();
            dt_CheckUser.Load(sdr_CheckUser);


            if (dt_CheckUser.Rows.Count <= 0)
            {
                Response.Write("<script>alert('帳號或密碼輸入錯誤');</script>");
                Response.Write("<script>location.href='Default.aspx';</script>");
                Response.End();
            }

            string sEncryptionPws = RPa_EN.EnCodeString(sPassword);

            if (dt_CheckUser.Rows[0]["cPassword"].ToString() != sEncryptionPws)
            {
                Response.Write("<script>alert('帳號或密碼輸入錯誤');</script>");
                Response.Write("<script>location.href='Default.aspx';</script>");
                Response.End();
            }

            //認證中....
            //這段要寫認證機制End----------------------------------
            Session["Account"] = cAccount;
            Response.Write("<script>window.parent.location.reload();</script>");
        }
        catch (Exception ex)
        {
            throw new Exception("帳號驗證時發生錯誤 - " + ex.Message);
        }
    }
Exemple #3
0
        private void Relojes_Load(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            clsConn   clsConn = new clsConn();
            DataTable table   = new DataTable();

            table.Columns.Add("IP", typeof(string));
            table.Columns.Add("LUGAR", typeof(string));
            relojes = clsConn.getRelojes();
            int i = 0;

            while (relojes[i, 0] != null)
            {
                table.Rows.Add(relojes[i, 0], relojes[i, 1]);
                i++;
            }
            progreso = 80 / i;
            grid_relojes.DataSource = table;
            grid_relojes.Refresh();
            this.Cursor = Cursors.Default;
        }