示例#1
0
 private void UpdateControlsWithDeltailGlobal()
 {
     DTO.DTOSql deltail = busSql.GetSqlDeltail();
     dd_typeconfig.selectedIndex = deltail.Server == "localhost" ? 0 : 1;
     cb_db.Text            = deltail.DB;
     cb_server.Text        = deltail.Server;
     dd_auth.selectedIndex = deltail.AuthWin ? 0 : 1;
     txb_user.Text         = deltail.User;
     txb_password.Text     = deltail.Pass;
     UpdateControlsWithAuthention();
 }
示例#2
0
 public void Config(DTO.DTOSql deltail, Shared.SInvokeEvent callback)
 {
     new Shared.SSequence()
     .Then(() =>
     {
         DAO.DAOSql sql = new DAO.DAOSql(deltail);
         callback.Wait(null);
         if (sql.IsActive())
         {
             callback.Success(null);
             sql.SetDeltailGlobal();
             sql.SaveDeltailFileXML();
         }
         else
         {
             callback.Error(null);
         }
     })
     .Start();
 }
示例#3
0
        /// <summary>
        /// Khi người dùng click cấu hình
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_config_Click(object sender, EventArgs e)
        {
            DTO.DTOSql sqlDeltail = new DTO.DTOSql();
            sqlDeltail.AuthWin = dd_auth.selectedValue != TYPE_AUTH_SQL;
            sqlDeltail.Server  = cb_server.Text;
            sqlDeltail.DB      = cb_db.Text;
            sqlDeltail.User    = txb_user.Text;
            sqlDeltail.Pass    = txb_password.Text;

            SInvokeEvent cb = new SInvokeEvent(this);

            cb.Wait = (obj) =>
            {
                FGuest.showWaiting(true);
            };

            cb.Error = (obj) =>
            {
                SFunction.SetTimeOut(
                    () => {
                    Invoke((Action)(() => FGuest.showWaiting(false)));
                    MessageBox.Show("Cấu hình bị lỗi!");
                }
                    , 500);
            };

            cb.Success = (obj) =>
            {
                SFunction.SetTimeOut(
                    () => {
                    Invoke((Action)(() => FGuest.showWaiting(false)));
                    MessageBox.Show("Cấu hình thành công!");
                }
                    , 500);
            };

            busSql.Config(sqlDeltail, cb);
        }