Пример #1
0
 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");
         }
     }
 }
Пример #2
0
        public Data searchLucene(Data data)
        {
            Account_lg account = new Account_lg();
            List<string> item = new List<string>();
            Lucene.Net.Store.Directory directory = FSDirectory.Open(new DirectoryInfo("C:\\Visual Studio 2010\\Transaction" + "\\LuceneIndex"));
            var analyzer = new StandardAnalyzer(Version.LUCENE_29);
            IndexReader reader = IndexReader.Open(directory, true);
            IndexSearcher searcher = new IndexSearcher(reader);

            MultiFieldQueryParser parser = new MultiFieldQueryParser(Lucene.Net.Util.Version.LUCENE_29, new string[] { "name", "username" }, analyzer);  //search for multifield
            Query query = parser.Parse((data.getString("search")) + "*"); //cant search blank text with wildcard as first character

            TopScoreDocCollector collector = TopScoreDocCollector.Create(1000, true);
            searcher.Search(query, collector);
            ScoreDoc[] hits = collector.TopDocs().ScoreDocs;
            int count = hits.Length;

            for (int i = 0; i < count; i++)
            {
                int docId = hits[i].Doc;
                float score = hits[i].Score;

                Document doc = searcher.Doc(docId);

                string id = doc.Get("id");
                item.Add(id);
            }
            Data list = account.selectUser(data, item.ToArray());
            reader.Dispose();
            searcher.Dispose();

            return list;
        }
Пример #3
0
 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");
 }
Пример #4
0
 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");
 }