Ejemplo n.º 1
0
        private void btnCatalog_Click(object sender, EventArgs e)
        {
            FormCatalog frc = new FormCatalog();

            frc.panelHeader.Hide();
            frc.idCur = idCur;

            OpenChildForm(frc, sender);
            panelDownSepar.Visible = panelFormManage.Visible = false;
        }
Ejemplo n.º 2
0
        private void mbtnLogin_Click(object sender, EventArgs e)
        {
            if (mtbxLogin.Text == "" || mtbxPass.Text == "")
            {
                return;
            }


            string txtfilter = String.Format("login = '******' and password = '******'",
                                             mtbxLogin.Text, mtbxPass.Text);

            bsUsers.Filter = txtfilter;

            if (bsUsers.Count == 0)
            {
                MaterialMessageBox.Show("Нет пользователя с указанным логином, и паролем!",
                                        "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (mcbxRemember.Checked)
            {
                RegistryKey currentUserKey = Registry.CurrentUser;
                RegistryKey key            = currentUserKey.CreateSubKey("GameSTARTER");
                key.SetValue("login", mtbxLogin.Text);
                key.SetValue("password", mtbxPass.Text);
                key.Close();
            }
            idUser = id_userLabel.Text;
            Hide();
            if (roleLabel1.Text == "0")
            {
                FormCatalog frmCat = new FormCatalog();
                frmCat.idCur = Convert.ToInt32(id_userLabel.Text);
                frmCat.ShowDialog();
            }
            else
            {
                FormDevBoard frmDev = new FormDevBoard();
                frmDev.idCur = Convert.ToInt32(id_userLabel.Text);
                frmDev.ShowDialog();
            }
            Initiate();
            try
            {
                Show();
            }
            catch { }

            mtbxLogin.Clear(); mtbxPass.Clear();

            mtbxLogin.Focus();
            bsUsers.Filter = null;
            this.usersTableAdapter.Fill(gameStartDBDataSet.Users);
        }
Ejemplo n.º 3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string login = "", password = ""; string id = "", role = "";

            try
            {
                RegistryKey currentUserKey = Registry.CurrentUser;
                RegistryKey key            = currentUserKey.OpenSubKey("GameSTARTER");
                login    = key.GetValue("login").ToString();
                password = key.GetValue("password").ToString();
                key.Close();
            }
            catch
            {
                Application.Run(new Form1());
            }

            if (login != "" & password != "")
            {
                SqlConnection con = new SqlConnection(Form1.txtcon);
                con.Open();
                SqlCommand query1 = new SqlCommand(
                    String.Format("select id_user, role from users where [login] = '{0}' and [password] = '{1}'", login, password), con);
                SqlDataReader read = query1.ExecuteReader();

                while (read.Read())
                {
                    id   = read["id_user"].ToString();
                    role = read["role"].ToString();
                }
                con.Close();
                if (id != "")
                {
                    if (role == "0")
                    {
                        FormCatalog frmCat = new FormCatalog();
                        frmCat.idCur = Convert.ToInt32(id);
                        Application.Run(frmCat);
                    }
                    else
                    {
                        FormDevBoard frmMain = new FormDevBoard();
                        frmMain.idCur = Convert.ToInt32(id);
                        Application.Run(frmMain);
                    }
                }
            }
        }