Exemplo n.º 1
0
        /// <summary>
        /// Admins the V m_ test connection completed event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        void adminVM_TestConnectionCompletedEvent(object sender, SimpleMvvmToolkit.NotificationEventArgs <Exception> e)
        {
            btnTestConn.IsEnabled = true;
            //if (e.Message.ToString().ToLower() == "true")
            if ((bool)sender)
            {
                MessageBox.Show("Connection is successful");
                btnStep1Next.IsEnabled = true;
                localDto = new DatasourceDto();
                localDto.DatasourceName = tbDSName.Text;


                //if (rad)
                //{

                //}

                //localDto.DatasourceConnectionString = con.GetConnectionString();
                //localDto.DatasourceType = con.DatabaseType;
                //localDto.DatabaseName = con.DatabaseName;
                //localDto.ServerName = con.ServerName;
                Connection newCon = con;
                localDto.Connection = newCon;
            }
            else
            {
                btnStep1Next.IsEnabled = false;
                MessageBox.Show("Test Connection has failed.");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles the Click event of the btnTestConn control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs" /> instance containing the event data.</param>
        private void btnTestConn_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (ApplicationViewModel.Instance.DemoMode)
            {
                MessageBox.Show("Connection is successful");
                btnStep1Next.IsEnabled = true;
                localDto = new DatasourceDto();
                localDto.DatasourceName = tbDSName.Text;

                return;
            }

            if (ValidateStep1())
            {
                //string connStr = CreateConnectionString();
                con              = new Connection();
                con.ServerName   = tbServerName.Text;
                con.DatabaseName = tbDbName.Text;
                con.UserId       = tbUserId.Text;
                con.Password     = tbPassword.Password;
                con.PortNumber   = tbPort.Text;

                //if (radMySql.IsChecked == true)
                //{
                //    con.DatabaseType = DataBaseTypeEnum.MySQL;
                //}
                //else
                //{
                //    con.DatabaseType = DataBaseTypeEnum.SQLServer;
                //}

                switch (cmbDBType.SelectedItem.ToString())
                {
                case "MySQL":
                    con.DatabaseType = DataBaseTypeEnum.MySQL;
                    break;

                case "PostgreSQL":
                    con.DatabaseType = DataBaseTypeEnum.PostgreSQL;
                    break;

                case "SQLServer":
                    con.DatabaseType = DataBaseTypeEnum.SQLServer;
                    break;

                default:
                    break;
                }

                btnTestConn.IsEnabled = false;
                adminVM.TestConnection(con);
                adminVM.TestConnectionCompletedEvent -= new EventHandler <SimpleMvvmToolkit.NotificationEventArgs <Exception> >(adminVM_TestConnectionCompletedEvent);
                adminVM.TestConnectionCompletedEvent += new EventHandler <SimpleMvvmToolkit.NotificationEventArgs <Exception> >(adminVM_TestConnectionCompletedEvent);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Edits the selected user.
        /// </summary>
        /// <param name="userDto">The user dto.</param>
        private void EditDatasource(DatasourceDto dsdto)
        {
            addEdit = new AddEditDataSources();

            if (applicationViewModel.DemoMode)
            {
                dsdto.Connection.ServerName = "<server name withheld> ";
            }


            //addEdit.UserMode = ClientCommon.UserOperationModeEnum.Edit;
            addEdit.Title = "Edit Data Source";
            addEdit.SelectedDatasourceDto = dsdto;
            addEdit.OrganizationId        = ((OrganizationDto)cmbOrgName.SelectedItem).Id;
            //addEdit.UserDto = dsdto;
            //addEdit.CurrentUserActionEnum = Organization.UserActionEnum.EditExistOrg | Organization.UserActionEnum.EditUserOfExistOrg;
            addEdit.Mode = ModeEnum.Edit;
            addEdit.CUDDatasourceCompletedEvent += new Client.Application.CUDDatasourceCompletedEventHandler(addEdit_CUDDatasourceCompletedEvent);
            //addEdit.Mode = AddEditUsers.ModeType.Edit;
            addEdit.Closed += new EventHandler(addEdit_Closed);
            addEdit.Show();
        }
Exemplo n.º 4
0
 /// <summary>
 /// Updates the datasource.
 /// </summary>
 /// <param name="dto">The dto.</param>
 /// <returns></returns>
 public bool UpdateDatasource(DatasourceDto dto)
 {
     return(em.UpdateDatasource(dto));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Adds the datasource.
 /// </summary>
 /// <param name="ds">The ds.</param>
 /// <returns></returns>
 public bool AddDatasource(DatasourceDto ds)
 {
     return(em.AddDatasouce(ds));
 }
Exemplo n.º 6
0
 public void Add(DatasourceDto dsDto)
 {
     serviceAgent.Add(dsDto, AddCompleted);
 }
Exemplo n.º 7
0
 public void Update(DatasourceDto dsDto)
 {
     serviceAgent.Update(dsDto, UpdateCompleted);
 }