예제 #1
0
        public MainMenu()
        {
            InitializeComponent();
            hideSubMenu();
            valiballecommon valiballecommon = valiballecommon.GetStorage();

            permissionlevel = valiballecommon.Permission;
            disableButton();
        }
예제 #2
0
        public void Insert(string task)
        {
            valiballecommon valiballecommon = valiballecommon.GetStorage();

            sqlQuery = "insert into Log (username, thoigian, task) values ('" +
                       valiballecommon.UserName + "',N'" + DateTime.Now + "', N'" + task + "')";
            conString.ConString constring = new conString.ConString();
            try
            {
                using (var con = new SqlConnection(constring.initString()))
                {
                    using (var cmd = new SqlCommand(sqlQuery, con))
                    {
                        con.Open();
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }
            }
            catch (SqlException ex)
            {
            }
        }
예제 #3
0
        private void BW_DoWork(object sender, DoWorkEventArgs e)
        {
            //Check the database connection
            valiballecommon valiballecommon = valiballecommon.GetStorage();

            Properties.Settings setting = Properties.Settings.Default;
            string concheck             = "Data Source = " + valiballecommon.DatabaseName + "; Initial Catalog= GymManagement;  Integrated Security=True";

            SqlConnection con = new SqlConnection(concheck);

            try
            {
                con.Open();
                con.Close();
            }catch (Exception ex)
            {
                throw ex;
            }
            //Delete old member
            BackgroundProcess backgroundProcess = new BackgroundProcess();

            backgroundProcess.MakememberInactive();
            backgroundProcess.Deleteinactive();
        }
예제 #4
0
        private void tryLogin()
        {
            Properties.Settings setting         = Properties.Settings.Default;
            valiballecommon     valiballecommon = valiballecommon.GetStorage();

            valiballecommon.DatabaseName = txt_DB.Text;

            LogIn login = new LogIn();

            if (!login.getRefication(txt_userName.Text.Trim().ToLower(), txt_pass.Text.Trim()))
            {
                MessageBox.Show("Tên đắng nhập hoặc mật khẩu sai!", "Error!");
            }
            else
            {
                valiballecommon.UserName     = txt_userName.Text;
                valiballecommon.Permission   = login.getPermission(txt_userName.Text.Trim().ToLower());
                valiballecommon.UserCode     = login.getID(txt_userName.Text.Trim().ToLower());
                valiballecommon.DatabaseName = txt_DB.Text;
                setting.DatabaseName         = valiballecommon.DatabaseName;
                if (chB_saveUser.Checked == true)
                {
                    setting.UserName = txt_userName.Text;
                }
                else
                {
                    setting.UserName = "";
                }
                setting.Save();
                Log.Insert("Login");
                this.Hide();
                var form2 = new MainMenu();
                form2.Closed += (s, args) => this.Close();
                form2.Show();
            }
        }