Ejemplo n.º 1
0
        private bool Authenticate()
        {
            using (InputDialog dx = new InputDialog("Enter Password",
                                                    new List <Input>()
            {
                new Input()
                {
                    Name = "pwd", Index = 0, Hint = "Password", Type = InputType.Password
                }
            }, this))
            {
                if (dx.ShowIt() == ResultType.OK)
                {
                    if (dx.Output[0].Value.Equals("n1developer"))
                    {
                        dx.Dispose();
                        return(true);
                    }
                    else
                    {
                        MessageBox.Show("Enter Correct Password", "Error", MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        private string ShowUpdateInfoBox(string status)
        {
            var inputDialog = new InputDialog(status);
            var update      = string.Empty;

            if (inputDialog.ShowDialog() == DialogResult.OK)
            {
                update = inputDialog.txtInfo.Text;
            }
            inputDialog.Dispose();
            return(update);
        }
Ejemplo n.º 3
0
        private async void Create_Click(object sender, EventArgs e)
        {
            InputDialog <string> dialog = new InputDialog <string>();
            DialogResult         result = dialog.Show(this,
                                                      "Input project namespace and name", string.Empty);

            if (result == DialogResult.Cancel)
            {
                return;
            }
            CreateClient();
            string path;
            Group  group = null;
            int    index = dialog.Value.LastIndexOf("/");

            if (index == -1)
            {
                path = dialog.Value;
            }
            else
            {
                path = dialog.Value.Substring(index + 1);
                string groupPathWithNamespace = dialog.Value.Substring(0, index);
                group = await GetOrCreateGroup(groupPathWithNamespace)
                        .ConfigureAwait(true);

                if (group == null)
                {
                    MessageBox.Show(this, $"Could not create group {groupPathWithNamespace}");
                    return;
                }
            }
            CreateProjectRequest request = CreateProjectRequest.FromPath(path);

            request.NamespaceId = group.Id;
            try
            {
                await client.Projects.CreateAsync(request).ConfigureAwait(true);
            }
            catch (GitLabException ex)
            {
                MessageBox.Show(this, ex.Message);
            }
            dialog.Dispose();
        }
Ejemplo n.º 4
0
        void CmdConvertClick(object sender, EventArgs e)
        {
            txtLog.Text = String.Format("Start Time: {0}", DateTime.Now.ToLongTimeString());
            OdbcDba   JetDb    = new OdbcDba();
            SQLiteDba SQLiteDb = new SQLiteDba();

            try {
                File.Delete(this.SQLiteFile);
            } catch (IOException) {
                string Msg = String.Format("Cannot delete the existing SQLite file {0}", SQLiteFile);
                MessageBox.Show(Msg);
                return;
            }
            try {
                JetDb.ConnectMDB(this.JetSqlFile);
            } catch (OdbcException ex) {
                //TODO: this is the error code for incorrect access password. Make this a constant.
                if (ex.ErrorCode == -2147217843 || ex.ErrorCode == -2146232009)
                {
                    DialogResult Result;
                    InputDialog  GetPassword = new InputDialog();
                    Result = GetPassword.ShowDialog("Enter the password for the database");
                    if (Result == DialogResult.OK)
                    {
                        try {
                            ((OdbcDba)JetDb).ConnectMDB(JetSqlFile, GetPassword.Input);
                        } catch (OdbcException exSecond) {
                            if (ex.ErrorCode == -2147217843 || ex.ErrorCode == -2146232009)
                            {
                                MessageBox.Show("Incorrect Password");
                            }
                            else
                            {
                                throw exSecond;
                            }
                            return;
                        } finally { GetPassword.Dispose(); }
                    }
                }
                else if (ex.ErrorCode == -2147467259)
                {
                    Text = "PlaneDisaster.NET";
                    string Msg = String.Format("File [{0}] not found.", JetSqlFile);
                    MessageBox.Show(Msg, "Error Opening File");
                    return;
                }
                else
                {
                    throw ex;
                }
            }

            SQLiteDb.Connect(this.SQLiteFile);

            string [] Tables = JetDb.GetTables();

            foreach (string Table in Tables)
            {
                try {
                    SQLiteDb.DataTable2SQLiteTable(JetDb.GetTableAsDataTable(Table));
                } catch (OdbcException ex) {
                    string Message = String.Format("{0}: {1}\n", Table, ex.Message);
                    File.AppendAllText(String.Concat(SQLiteFile, ".log"), Message);
                }
            }
            JetDb.Disconnect();
            SQLiteDb.Disconnect();
            MessageBox.Show("Database Successfully converted.");
            txtLog.Text += String.Format(" End Time: {0}", DateTime.Now.ToLongTimeString());
        }
Ejemplo n.º 5
0
        internal void OpenMDB(string FileName)
        {
            DialogResult Result;

            this._dbcon = new OleDba();

            try {
                ((OleDba) _dbcon).ConnectMDB(FileName);
            } catch (OleDbException ex) {
                //TODO: this is the error code for incorrect access password. Make this a constant.
                if (ex.ErrorCode == -2147217843) {
                    InputDialog GetPassword = new InputDialog();
                    Result = GetPassword.ShowDialog("Enter the password for the database");
                    if (Result == DialogResult.OK) {
                        try {
                            ((OleDba) _dbcon).ConnectMDB(FileName, GetPassword.Input);
                        } catch (OleDbException exSecond) {
                            if (exSecond.ErrorCode == -2147217843) {
                                MessageBox.Show("Incorrect Password");
                            } else {
                                throw exSecond;
                            }
                            return;
                        } finally { GetPassword.Dispose(); }
                    }
                } else if (ex.ErrorCode == -2147467259) {
                    Text = "PlaneDisaster.NET";
                    //TODO: Apparently this error code is also returned if you try to open an .accdb with the Jet 4.0 driver
                    string Msg = String.Format("File [{0}] not found.", FileName);
                    MessageBox.Show(Msg, "Error Opening File");
                    return;
                } else {
                    throw ex;
                }
            }
            catch (InvalidOperationException ex)
            {
                MessageBox.Show(ex.Message, "Error Opening database");
                return;
            }
            Text = string.Format("{0} - ({1}) - PlaneDisaster.NET", Path.GetFileName(FileName), FileName);
             		    CurrentFile = FileName;
            this.DisplayDataSource();
        }