示例#1
0
 private DAOFactory()
 {
     string DataBasePath = string.Empty;
     #if DEBUG
     DataBasePath = FileUtils.GetAppDataFolder() + Path.DirectorySeparatorChar + Constants.DEBUG_DB_FILE;
     #else
     DataBasePath = FileUtils.GetAppDataFolder() + Path.DirectorySeparatorChar + Constants.DB_FILE;
     #endif
     //File.Delete(DataBasePath);
     if (!File.Exists(DataBasePath))
     {
         SQLiteConnection.CreateFile(DataBasePath);
         SQLiteDBHelper.EncryptDatabase(DataBasePath, Constants.DB_PASSWORD);
     }
     dbHelper = new SQLiteDBHelper(DataBasePath, Constants.DB_PASSWORD);
     keywordDAO = new KeywordDAO(dbHelper);
     vpnDAO = new VpnDAO(dbHelper);
     inquiryDAO = new InquiryDAO(dbHelper);
     profileDAO = new ProfileDAO(dbHelper);
 }
示例#2
0
 void LoadDataview()
 {
     inquiryDAO = DAOFactory.Instance.GetInquiryDAO();
     this.dataGridView.DataBindings.Clear();
     this.dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
     DataTable dt = new DataTable();
     dt.Columns.Add("Check", typeof(Boolean));
     dt.Columns.Add("Content", typeof(string));
     dt.Columns.Add("SendNum", typeof(string));
     dt.Columns.Add("MsgId", typeof(Int32));
     this.dataGridView.DataSource = dt;
     DataGridViewColumn column0 = this.dataGridView.Columns[0];
     column0.HeaderText = "Check";
     column0.Width = 100;
     DataGridViewColumn column = this.dataGridView.Columns[1];
     column.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
     column.HeaderText = "Content";
     column.Width = 550;
     DataGridViewColumn column2 = this.dataGridView.Columns[2];
     column2.HeaderText = "SendNum";
     column2.Width = 100;
     DataGridViewColumn column3 = this.dataGridView.Columns[3];
     column3.HeaderText = "Id";
     column3.Width = 10;
     column3.Visible = false;
     List<InquiryMessages> accountList = inquiryDAO.GetInquiryMessages();
     if (accountList.Count > 0)
     {
         foreach (InquiryMessages item in accountList)
         {
             DataRow row = dt.NewRow();
             row["Check"] = false;
             row["Content"] = item.Content;
             row["SendNum"] = item.SendNum;
             row["MsgId"] = item.MsgId;
             dt.Rows.Add(row);
         }
     }
 }
示例#3
0
 public AccountForm()
 {
     InitializeComponent();
     inquiryDAO = DAOFactory.Instance.GetInquiryDAO();
     LoadDataview();
 }