Esempio n. 1
0
 public EditBus(MongoTools database, string collectionName, ObjectId id)
 {
     this.database       = database;
     this.collectionName = collectionName;
     this.id             = id;
     InitializeComponent();
 }
Esempio n. 2
0
        static public MongoTools Login(string login, string pwd)
        {
            var          connectionString = $"mongodb://{login}:{pwd}@94.230.138.242:49563/?authSource=bus_depot";
            const string databaseName     = "bus_depot";
            MongoTools   database         = new MongoTools(connectionString, databaseName);

            return(database);
        }
Esempio n. 3
0
        public MainForm(MongoTools database)
        {
            this.database = database;

            InitializeComponent();

            if (!MongoTools.isAdmin)
            {
                AddNewElementBtn.Visible  = false;
                deleteSelectedBtn.Visible = false;
                editSelectBtn.Visible     = false;
            }

            // Some style
            this.Table.RowsDefaultCellStyle.BackColor            = Color.Gainsboro;
            this.Table.AlternatingRowsDefaultCellStyle.BackColor = Color.Snow;
            this.Table.ColumnHeadersDefaultCellStyle.BackColor   = Color.White;
            this.Table.EnableHeadersVisualStyles = false;
        }
Esempio n. 4
0
        private void loginBtn_Click(object sender, EventArgs e) {
            string login = loginInput.Text;
            string pwd = pwdInput.Text;

            MongoTools database = Program.Login(login, pwd);

            if (MongoTools.isConnect) {

                if (login == "admin") {
                    MongoTools.isAdmin = true;
                }

                MainForm mainForm = new MainForm(database);
                mainForm.Show();
                this.Hide();
            } else {
                
                loginBtn.ForeColor = Color.FromName("red");
                loginBtn.Text = "Неверный логин или пароль. Попробуйте снова!";
            }
        }
Esempio n. 5
0
 public AddRoute(MongoTools database)
 {
     this.database = database;
     InitializeComponent();
 }