protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         User_lg user = new User_lg();
         Account_lg account = new Account_lg();
         Data data = new Data();
         if (user.isLogin(Session) == true)
         {
             data.add("user_id", user.getUserSession(Session));
             name.Text = user.getUser(data).getString("name");
             Data accountList = account.select(data);
             if (accountList.Count > 0)
             {
                 hidden_account.Value = "1";
             }
             else
             {
                 hidden_account.Value = "0";
             }
             balance.Text = account.select(data).getString("balance");
             Data result = account.selectTransaction(data);
             transaction.DataSource = result.Source;
             transaction.DataBind();
         }
         else
         {
             go("../Transaction/Login.aspx");
         }
     }
 }
 protected void loginOnClick(object sender, EventArgs e)
 {
     User_lg user = new User_lg();
     Data list = user.login(Param);
     if (list.Count > 0)
     {
         user.setUserSession(Session, list);
         go("../Transaction/Account.aspx");
     }
 }
 protected void createOnClick(object sender, EventArgs e)
 {
     Data data = new Data();
     Account_lg account = new Account_lg();
     Lucene_lg lucene = new Lucene_lg();
     User_lg user = new User_lg();
     data.add("user_id", user.getUserSession(Session));
     account.insert(data);
     lucene.addLucene(data);
     go("../Transaction/Account.aspx");
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     User_lg user = new User_lg();
     if (user.isLogin(Session) == true)
     {
         Data data = new Data();
         Lucene_lg lucene = new Lucene_lg();
         Data result = lucene.searchLucene(Param);
         account.DataSource = result.Source;
         account.DataBind();
     }
     else
     {
         go("../Transaction/Login.aspx");
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        User_lg user = new User_lg();

        if (user.isLogin(Session) == true)
        {
            Data data = new Data();
            target_id.Value = Param.getString("user_id");
            data.add("user_id", user.getUserSession(Session));
            from.Text = user.getUser(data).getString("name");
            to.Text = user.getUser(Param).getString("name");
        }
        else
        {
            go("../Transaction/Login.aspx");
        }
    }
 public void addLucene(Data data)
 {
     User_lg user = new User_lg();
     Data list = user.luceneSelect(data);
     Lucene.Net.Store.Directory directory = FSDirectory.Open(new DirectoryInfo("C:\\Visual Studio 2010\\Transaction" + "\\LuceneIndex"));
     var analyzer = new StandardAnalyzer(Version.LUCENE_29);
     var writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);
     for (int i = 0; i < list.Count; i++)
     {
         Document document = new Document();
         document.Add(new Field("id", list.getValue(i, "id").ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED));
         document.Add(new Field("name", list.getValue(i, "name").ToString(), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
         document.Add(new Field("username", list.getValue(i, "username").ToString(), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
         writer.AddDocument(document);
         writer.Optimize();
         writer.Commit();
     }
     writer.Dispose();
 }
 protected void confirmOnClick(object sender, EventArgs e)
 {
     User_lg user = new User_lg();
     Data data = new Data();
     Account_lg account = new Account_lg();
     Data targetUser = new Data();
     targetUser.add("user_id", Param.getString("target_id"));
     data.add("user_id", user.getUserSession(Session));
     Data userAccount = account.select(data);
     Data targetAccount = account.select(targetUser);
     account.transfer(userAccount, targetAccount, Param);
     Data tData = new Data();
     tData.add("from_id", user.getUserSession(Session));
     tData.add("to_id", Param.getString("target_id"));
     tData.add("amount", Param.getString("balance"));
     tData.add("from_name", user.getUser(data).getString("name"));
     tData.add("to_name", user.getUser(targetUser).getString("name"));
     account.transaction(tData);
     go("../Transaction/Account.aspx");
 }
    protected void registerOnClick(object sender, EventArgs e)
    {
        User_lg user = new User_lg();
        Validation_lg validate = new Validation_lg();
        error_Length.Text = validate.registerError(Param).Item1;
        error_Upper.Text = validate.registerError(Param).Item2;
        error_Number.Text = validate.registerError(Param).Item3;
        error_Symbol.Text = validate.registerError(Param).Item4;

        captcha.ValidateCaptcha(captcha_txt.Text.Trim());
        if (captcha.UserValidated)
        {
            if (validate.registerError(Param).Item5 == false)
            {
                user.insert(Param);
                go("../Transaction/Login.aspx");
            }
        }
        else
        {
            lblMessage.ForeColor = System.Drawing.Color.Red;
            lblMessage.Text = "Invalid Captcha";
        }
    }