コード例 #1
0
 private void ShowForm()
 {
     if (txtboxlogin.Text == "WantedAdminUser")
     {
         using (AdminForm form2 = new AdminForm())
            form2.ShowDialog();
         Show(); 
     }
     else
     {
         using (user userform = new user())
             userform.ShowDialog();
         Show();
     }
 }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            String username = this.textBox1.Text;
            String password = this.textBox2.Text;

            Console.WriteLine(username);
            Console.WriteLine(password);
            User_service userservice = new User_service();
            User         user        = userservice.getUserByName(username);

            Console.WriteLine(user.Username);
            Console.WriteLine(user.Password);
            Console.WriteLine(user.Limit);
            if (username.Equals(user.Username) && password.Equals(user.Password))
            {
                // String username_search = ;
                //  Console.WriteLine(password);
                if (user.Limit == 1)
                {
                    Form mainform = new manage();
                    this.Visible = false;
                    mainform.Show();
                }
                else
                {
                    Form adminform = new AdminForm();
                    this.Visible = false;
                    adminform.Show();
                }
            }

            else if (username.Equals(user.Username) && !password.Equals(user.Password))
            {
                MessageBox.Show("密码错误请重新输入");
            }

            else
            {
                if (username.Length == 0)
                {
                    MessageBox.Show("请填写用户名");
                }
                else
                {
                    MessageBox.Show("系统找不到该用户");
                }
            }
        }
コード例 #3
0
        private void deanAdminMode()
        {
            //avoid_deleting
            int fac_id, d_id;

            if (!deanLogin(out fac_id, out d_id))
            {
                return;
            }
            AdminForm adminForm = new AdminForm(fac_id, false, d_id);

            adminForm.FacultyID = fac_id;
            adminForm.adminHash = sha1(textBox2.Text);
            adminForm.Show();
            Hide();
        }
コード例 #4
0
        public static void Login(UserLevel level, int userId)
        {
            switch (level)
            {
            case UserLevel.Normal:
                RegularUserForm reg = new RegularUserForm(userId);
                reg.ShowDialog();
                break;

            case UserLevel.Administrator:
                AdminForm adm = new AdminForm();
                adm.ShowDialog();
                break;
            }

            Environment.Exit(0);
        }
コード例 #5
0
        //Login BUTTON
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //Search person in Table personal,If exist in BD return true and the next search rol
            bool result = control.comprobarPersonal(txtDni.Text, txtMail.Text);

            if (result == true)
            {
                //if exist in Table person,search in table Adminstrador,if exit return 1 if not search
                //in table monitor
                string rolAdmin = control.getRolAdministrador(txtDni.Text);

                if (rolAdmin == "super")
                {
                    SuperAdmin miForm = new SuperAdmin();
                    miForm.Show();
                    this.Hide();
                }
                else if (rolAdmin == "administrador")
                {
                    AdminForm adminform = new AdminForm();
                    adminform.Show();
                    this.Hide();
                }
                else
                {
                    int rolMonitor = control.getRolMonitor(txtDni.Text);

                    if (rolMonitor == 1)
                    {
                        MonitorMantenimiento miForm = new MonitorMantenimiento();
                        miForm.Show();
                        this.Hide();
                        MessageBox.Show("Eres Monitor");
                    }
                    else
                    {
                        MessageBox.Show("No tiene asignado un rol");
                    }
                }
            }
            else
            {
                MessageBox.Show("NIf o Mail incorrectos");
            }
        }
コード例 #6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(GlobalExceptionHandler);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ThreadExceptionHandler);

            var useSslVar = ConfigurationManager.AppSettings["useSsl"];

            UseSsl      = Convert.ToBoolean(useSslVar);
            DefaultIP   = ConfigurationManager.AppSettings["defaultIP"];
            DefaultPort = Convert.ToInt32(ConfigurationManager.AppSettings["defaultPort"]);

            LoginForm     = new LoginForm();
            AppForm       = new AdminForm();
            AlreadyClosed = false;
            Application.Run(LoginForm);
        }
コード例 #7
0
 private void saveall()
 {
     if (depNameBox.Text == "")
     {
         MessageBox.Show("Назва не може бути пустою!");
     }
     else
     {
         string query = "INSERT INTO departments(id_facutlies, name) VALUES(" + fac_id.ToString()
                        + ", \"" + AdminForm.MySQLEscape(depNameBox.Text) + "\")";
         MySqlConnection connection = new MySqlConnection(Properties.Settings.Default.MainConnectionString);
         connection.Open();
         MySqlCommand sqlCom = new MySqlCommand(query, connection);
         sqlCom.ExecuteNonQuery();
         connection.Close();
         MessageBox.Show("Успiшно додано!");
         Close();
     }
 }
コード例 #8
0
 private void saveall()
 {
     if (newCourseNameBox.Text == "")
     {
         MessageBox.Show("Невiрна назва курсу!");
     }
     else
     {
         string          correctName = AdminForm.MySQLEscape(newCourseNameBox.Text);
         string          query       = "INSERT INTO courses(name, id_tutors) VALUES(\"" + correctName + "\", " + tut_id.ToString() + ")";
         MySqlConnection connection  = new MySqlConnection(Properties.Settings.Default.MainConnectionString);
         connection.Open();
         MySqlCommand sqlCom = new MySqlCommand(query, connection);
         sqlCom.ExecuteNonQuery();
         connection.Close();
         MessageBox.Show("Курс додано!");
         Close();
     }
 }
コード例 #9
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            using (SQLiteConnection connection = new SQLiteConnection(@"Data Source=users.db"))
            {
                connection.Open();
                string        role     = "";
                string        login    = name.Text;
                string        password = this.password.Text;
                SQLiteCommand command  = connection.CreateCommand();
                command.Connection  = connection;
                command.CommandText =
                    "Select role from users where login = '******' AND password = '******'";
                using (SQLiteDataReader reader = command.ExecuteReader())
                {
                    if (reader.HasRows) // если есть данные
                    {
                        while (reader.Read())
                        {
                            var dbRole = reader.GetValue(0);
                            role = dbRole.ToString();
                            break;
                        }
                    }
                }

                connection.Close();
                if (role == "admin")
                {
                    AdminForm formAdmin = new AdminForm();
                    formAdmin.Show();
                }
                else if (role == "research")
                {
                    ResearcherForm formResearcher = new ResearcherForm();
                    formResearcher.Show();
                }
                else
                {
                    MessageBox.Show("Ошибка! Логин или пароль введен неверно!", "Ошибка", MessageBoxButtons.OK);
                }
            }
        }
コード例 #10
0
        private void saveall()
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("Некоректне iм\'я!");
            }
            else
            {
                string query = "INSERT INTO tutors(id_departments, name) VALUES(" + dep_id.ToString()
                               + ", \"" + AdminForm.MySQLEscape(textBox1.Text) + "\")";

                MySqlConnection connection = new MySqlConnection(Properties.Settings.Default.MainConnectionString);
                MySqlCommand    command    = new MySqlCommand(query, connection);
                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
                MessageBox.Show("Успiшно додано!");
                Close();
            }
        }
コード例 #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            string      user  = textBox1.Text.ToUpper();
            TaiKhoanDTO tkDTO = tkBUS.Laytk(user, textBox2.Text);

            if (tkDTO.manv != null)
            {
                if (tkDTO.Type == "quanly")
                {
                    this.Hide();
                    var form2 = new AdminForm(tkDTO);
                    form2.Closed += (s, args) => this.Close();
                    form2.Show();
                }
                else if (tkDTO.Type == "thungan")
                {
                    this.Hide();
                    var form2 = new ThuNganForm(tkDTO);
                    form2.Closed += (s, args) => this.Close();
                    form2.Show();
                }
                else if (tkDTO.Type == "phucvu")
                {
                    this.Hide();
                    var form2 = new PhucVuvVeSinh(tkDTO);
                    form2.Closed += (s, args) => this.Close();
                    form2.Show();
                }
                else if (tkDTO.Type == "vesinh")
                {
                    this.Hide();
                    var form2 = new PhucVuvVeSinh(tkDTO);
                    form2.Closed += (s, args) => this.Close();
                    form2.Show();
                }
            }
            else
            {
                label3.Text = "Đăng nhập sai!";
            }
        }
コード例 #12
0
 private void picIcon_Click(object sender, EventArgs e)
 {
     if (m_System == null) //系统管理
     {
         if (m_frmAdmin == null || m_frmAdmin.IsDisposed)
         {
             m_frmAdmin = new AdminForm();
         }
         m_frmAdmin.Show();
     }
     else
     {
         CWindow window = (CWindow)Program.Ctx.WindowMgr.Find(m_System.StartWindow);
         if (window != null)
         {
             LayoutWindow frm = new LayoutWindow();
             frm.Window = window;
             frm.Show();
         }
     }
 }
コード例 #13
0
        public AdminHall(AdminForm f1, IHallService hallService, ValidationField valid)
        {
            _valid       = valid;
            _hallService = hallService;

            _f1 = f1;

            _f1.Load += Form1_Load;

            _dataGridHall            = _f1.DataGridhall;
            _dataGridHall.CellClick += dataGridHall_CellClick;

            _addHall        = _f1.addHall;
            _addHall.Click += AddHall_Click;


            _deleteHall        = _f1.deleteHall;
            _deleteHall.Click += DeleteHall_Click;

            _updateHall        = _f1.updateHall;
            _updateHall.Click += UpdateHall_Click;
        }
コード例 #14
0
ファイル: Form1.cs プロジェクト: mrhappy9/WareHouse
 private void gobutton_Click(object sender, EventArgs e)
 {
     workserver.createConnection();
     if (PassswordWithLogin(logintext.Text, passwordtext.Text) &&
         workserver.logIn(logintext.Text, passwordtext.Text))
     {
         managerOfUsers = new ManageUsers(logintext.Text, passwordtext.Text,
                                          workserver.getEmailForManageUser(logintext.Text, passwordtext.Text));
         mainInterface = new MainInterface(logintext.Text, this);
         workserver.loseConnection();
         cleanTextBoxes();
         this.Hide();
         mainInterface.Show();
     }
     else if (PassswordWithLogin(logintext.Text, passwordtext.Text) &&
              /*logintext.Text == admin && passwordtext.Text == adminPassword*/
              workserver.adminIn(logintext.Text, passwordtext.Text))
     {
         workserver.loseConnection();
         cleanTextBoxes();
         this.Hide();
         adminForm = new AdminForm(this);
         adminForm.Show();
     }
     else if (PassswordWithLogin(passwordtext.Text, logintext.Text) && /*logintext.Text == storekeeper && passwordtext.Text == storekeeperPassword*/
              workserver.storeKeeperIn(logintext.Text, passwordtext.Text))
     {
         workserver.loseConnection();
         cleanTextBoxes();
         this.Hide();
         storekeeperForm = new Storekeeper(this);
         storekeeperForm.Show();
     }
     else
     {
         setWarningLabel(true); passwordReset();
     }
     workserver.loseConnection();
 }
コード例 #15
0
        public AdminTickets(AdminForm f1, ITicketsService ticketsService, ValidationField valid)
        {
            _valid = valid;

            _ticketsService = ticketsService;

            _f1 = f1;

            _f1.Load += Form1_Load;

            _dataGridTickets            = _f1.DataGridtickets;
            _dataGridTickets.CellClick += DataGridtickets_CellClick;

            _addTickets        = _f1.addTicket;
            _addTickets.Click += AddTickets_Click;

            _deleteTickets        = _f1.deleteTicket;
            _deleteTickets.Click += DeleteTickets_Click;

            _updateTickets        = _f1.updateTicket;
            _updateTickets.Click += UpdateTickets_Click;
        }
コード例 #16
0
ファイル: AdminFilms.cs プロジェクト: solazy01/DB-Coursework
        public AdminFilms(AdminForm f1, IFilmsService filmsService, ValidationField valid)
        {
            _valid = valid;

            _filmsService = filmsService;

            _f1 = f1;

            _f1.Load += Form1_Load;

            _dataGridFilms            = _f1.DataGridfilms;
            _dataGridFilms.CellClick += dataGridFilms_CellClick;

            _addFilms        = _f1.addFilm;
            _addFilms.Click += AddFilm_Click;

            _deleteFilms        = _f1.deleteFilm;
            _deleteFilms.Click += DeleteFilm_Click;

            _updateFilms        = _f1.updateFilm;
            _updateFilms.Click += UpdateFilm_Click;
        }
コード例 #17
0
        private void sendResults()
        {
            string insertAnswersString = @"INSERT INTO `answers` 
(`id_students`, `id_courses`, `a1`, `a2`, `a3`, `a4`, `a5`, `a6`, `a7`,
`a8`, `a9`, `a10`, `a11`, `a12`, `a13`, `a14`, `a15`, `a16`, `a17`, `a18`, `a19`,
`a20`, `a21`, `a22`, `a23`, `a24`, `a25`, `a26`, `a27`, `a28`, `a29`, `a30`, `a31`, `a32`, `a33`,
`a34`, `a35`, `a36`, `a37`, `a38`, `a39`)
VALUES(" + studId + ", " + CourseId;

            foreach (int i in answers)
            {
                insertAnswersString += ", " + i;
            }
            insertAnswersString += ");\n";
            string insertCommentsString = @"INSERT INTO `comments`
(`id_students`,`id_courses`, `c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`)
VALUES(" + studId + ", " + CourseId;

            foreach (string s in comments)
            {
                if (s.Length > 0)
                {
                    insertCommentsString += ", \"" + AdminForm.MySQLEscape(s) + "\"";
                }
                else
                {
                    insertCommentsString += ", NULL";
                }
            }
            insertCommentsString += ");";
            string resultingQuery = insertAnswersString + insertCommentsString;
            //MessageBox.Show(resultingQuery);

            MySqlConnection connection = new MySqlConnection(Properties.Settings.Default.MainConnectionString);
            MySqlCommand    sqlCom     = new MySqlCommand(resultingQuery, connection);

            connection.Open();
            sqlCom.ExecuteNonQuery();
        }
コード例 #18
0
        public bool writeCard(int comPort, string sID1)
        {
            string sType = "";
            string sID2  = "";
            string sName = CitacKartica.NAME_FIELD;

            AdminForm af          = Form1.Instance.AdminForm;
            bool      measureTime = af != null;

            Stopwatch watch = null;

            if (measureTime)
            {
                watch = Stopwatch.StartNew();
            }

            ulong retval;

            if (Options.Instance.JedinstvenProgram)
            {
                lock (readAndWriteLock)
                {
                    retval = WriteDataCard(comPort, sType, sID1, sID2, sName) & 0xFFFFFFFF;
                }
            }
            else
            {
                retval = WriteDataCard(comPort, sType, sID1, sID2, sName) & 0xFFFFFFFF;
            }

            if (measureTime)
            {
                watch.Stop();
                af.newPisanjeKartice(retval, watch.ElapsedMilliseconds);
            }

            return(retval == 1);
        }
コード例 #19
0
ファイル: LoginForm.cs プロジェクト: KelwinTan/Live-Wealthy
 private void loginBtn_Click(object sender, EventArgs e)
 {
     if (emailTxt.Text.Equals("*****@*****.**") && passTxt.Text.Equals("admin"))
     {
         MessageBox.Show("Welcome Admin!");
         AdminForm af = new AdminForm();
         af.Show();
         this.Hide();
         resetValues();
     }
     else
     {
         try
         {
             DB = Db4oFactory.OpenFile("User Database.yap");
             List <User> userList = (from x in DB.Query <User>()
                                     where x.Email.Equals(emailTxt.Text) && x.Password.Equals(passTxt.Text)
                                     select x).ToList();
             if (userList.Count == 0)
             {
                 MessageBox.Show("Invalid Username/Password");
             }
             else
             {
                 //gets current user and redirect currUser to shop form
                 MessageBox.Show("Welcome, " + userList.ElementAt(0).Email);
                 ShopForm sf = new ShopForm(userList.ElementAt(0));
                 sf.Show();
                 this.Hide();
                 resetValues();
             }
         }
         finally
         {
             DB.Close();
         }
     }
 }
コード例 #20
0
        public bool TryReadDolazakNaTrening(int comPort, bool obrisiPrePrikazivanja)
        {
            AdminForm af          = Form1.Instance.AdminForm;
            bool      measureTime = af != null;

            Stopwatch watch = null;

            if (measureTime)
            {
                watch = Stopwatch.StartNew();
            }

            int  broj;
            bool result = tryReadCard(comPort, out broj);

            if (measureTime)
            {
                watch.Stop();
                af.newOcitavanje(watch.ElapsedMilliseconds);
            }

            return(result && handleOcitavanjeKarticeTrening(broj, DateTime.Now, obrisiPrePrikazivanja));
        }
コード例 #21
0
ファイル: Authorization.cs プロジェクト: funkylen/HomeLibrary
        public void SignIn()
        {
            if (User == -1)
            {
                MessageBox.Show("Неверный логин или пароль");
            }

            if (User == 0)
            {
                Az.Hide();
                Form AdminForm = new AdminForm();
                AdminForm.ShowDialog();
                Az.Close();
            }

            if (User == 1)
            {
                Az.Hide();
                Form UserForm = new UserForm();
                UserForm.ShowDialog();
                Az.Close();
            }
        }
コード例 #22
0
        private void ButtonInit_Click(object sender, RoutedEventArgs e)
        {
            String pseudoPassword = txtPass.Password;


            if (pseudoPassword.Equals(acces.DeserializePass()))
            {
                AdminForm admin = new AdminForm();

                MessageBox.Show("Contrase;a correcta", "Buena dog");

                //obtiene la ventana principal, para asi cerrarla
                MainWindow log = (ATM.MainWindow)Application.Current.MainWindow;

                log.Close();

                admin.ShowDialog();
            }
            else
            {
                ValidateLabel.Text = "Contraseña incorrecta, por favor intente de nuevo";
            }
        }
コード例 #23
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text == "" || textBox2.Text == "")
                {
                    MessageBox.Show("Введите все данные");
                    return;
                }

                var user = db.SystemUsers.FirstOrDefault(x => x.Login == textBox1.Text && x.Password == textBox2.Text);

                if (user == null)
                {
                    MessageBox.Show("Неверный логин/пароль");
                    return;
                }
                else
                {
                    if (user.Role == "Admin")
                    {
                        AdminForm F = new AdminForm();
                        F.Show();
                    }
                    else
                    {
                        SellerForm F = new SellerForm();
                        UserData.prodavets = db.Prodavets.FirstOrDefault(x => x.idprodavets == user.IdProdavets);
                        F.Show();
                    }
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
コード例 #24
0
ファイル: EntryForm.cs プロジェクト: blackmatch/training
 /// <summary>
 /// 管理员登录
 /// </summary>
 private void adminLogin()
 {
     // 判断用户名和密码是否有输入
     if (adminUserNameTextBox.Text.Trim().Length > 0 && adminPwdTextBox.Text.Trim().Length > 0)
     {
         //获取输入的用户名和密码
         string username = adminUserNameTextBox.Text.Trim();
         string pwd      = Tool.getMd5Str(adminPwdTextBox.Text.Trim());
         //链接并打开数据库
         string        conStr = "server=localhost;database=training;integrated security=SSPI";
         SqlConnection con    = new SqlConnection(conStr);
         con.Open();
         //根据输入的用户名和密码来查询数据库中是否有相应的数据
         string         sql     = "select * from admins where userName='******' and pwd='" + pwd + "'";
         SqlDataAdapter adapter = new SqlDataAdapter(sql, con);
         DataSet        ds      = new DataSet();
         adapter.Fill(ds, "admins");
         //查看数据库中是否有匹配的数据
         int rows = ds.Tables["admins"].Rows.Count;
         //userNameTb.Text = ds.Tables["admins"].Rows[0]["userName"].ToString();
         if (rows > 0)
         {
             AdminForm adminFm = new AdminForm();
             adminFm.Show();
             this.Hide();
         }
         else
         {
             MessageBox.Show("用户名或密码错误");
         }
     }
     else
     {
         MessageBox.Show("请正确输入用户名和密码");
     }
 }
コード例 #25
0
ファイル: newFacForm.cs プロジェクト: artem2302/CourseQuality
 private void addFac()
 {
     if (facNameBoxC.Text == "")
     {
         MessageBox.Show("Назва не може бути пустою!");
     }
     else
     {
         string          query      = "INSERT INTO facutlies(name) VALUES(\"" + AdminForm.MySQLEscape(facNameBoxC.Text) + "\")";
         MySqlConnection connection = new MySqlConnection(Properties.Settings.Default.MainConnectionString);
         connection.Open();
         MySqlCommand sqlCom = new MySqlCommand(query, connection);
         sqlCom.ExecuteNonQuery();
         connection.Close();
         MessageBox.Show("Успiшно додано!");
         Close();
     }
 }
コード例 #26
0
        private void AdminSpecialistForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            AdminForm f = new AdminForm();

            f.Show();
        }
コード例 #27
0
        public override void showForm()
        {
            AdminForm form = new AdminForm();

            form.Show();
        }
コード例 #28
0
        private void button1_Click(object sender, EventArgs e)
        {
            var username = textBox1.Text;
            var password = textBox2.Text;

            var user = UserRepository.Login(username, password);

            if (user == null || user.UserId == Guid.Empty)
            {
                MessageBox.Show("Yanlış Bilgi", "Hata", MessageBoxButtons.OK);
            }
            else
            {
                var permissions = UserRepository.GetUserPages();

                if (permissions != null)
                {
                    var page = permissions.FirstOrDefault();

                    switch (page.Title.Trim())
                    {
                    case "Depo":
                        var depo = new Depo();
                        depo.Show();
                        break;

                    case "Dikimhane":
                        var dikimhane = new Dikimhane();
                        dikimhane.Show();
                        break;

                    case "Kesimhane":
                        var kesimhane = new Kesimhane();
                        kesimhane.Show();
                        break;

                    case "Baskı":
                        var baski = new Baski();
                        baski.Show();
                        break;

                    case "Boya":
                        var boya = new Boya();
                        boya.Show();
                        break;

                    case "Lojistik":
                        var lojistik = new Lojistik();
                        lojistik.Show();
                        break;

                    case "Admin":
                        var adminform = new AdminForm();
                        adminform.Show();
                        break;

                    case "Teknik Personel":
                        var technicForm = new TechnicForm();
                        technicForm.Show();
                        break;

                    case "Usta Başı":
                        var makine1 = new Makine1();
                        makine1.Show();
                        break;

                    default:
                        break;
                    }
                }

                if (permissions == null)
                {
                    MessageBox.Show("Hata Saptandı", "Hata", MessageBoxButtons.OK);
                }
                else
                {
                    UserRepository.GetUserPages();
                }
            }
        }
コード例 #29
0
        private void AdminListOfDetailWindow_FormClosed(object sender, FormClosedEventArgs e)
        {
            AdminForm f = new AdminForm();

            f.Show();
        }
コード例 #30
0
        private void ContractAdminWindow_FormClosed(object sender, FormClosedEventArgs e)
        {
            AdminForm f = new AdminForm();

            f.Show();
        }