Exemple #1
0
        private void btn_Apply_Click(object sender, EventArgs e)
        {   //应用更改
            string        strSql = "UPDATE Preferences SET P_Value = '" + txt_Opacity.Text + "' WHERE P_Key = 'form_opacity' AND P_Username = '******'";
            DataConnector data   = new DataConnector();
            DataSet       ds;

            data.dataCon();
            ds = data.getDataset(strSql);

            if (chk_statusBar.Checked)
            {
                strSql = "UPDATE Preferences SET P_Value = 'show' WHERE P_Key = 'form_statusbar' AND P_Username = '******'";
            }
            else
            {
                strSql = "UPDATE Preferences SET P_Value = 'hide' WHERE P_Key = 'form_statusbar' AND P_Username = '******'";
            }
            ds = data.getDataset(strSql);

            switch (qa_state)   //处理此处的变量
            {
            case 1:
                strSql = "UPDATE Preferences SET P_Value = 'include' WHERE P_KEY= 'btn_QuickAdd' AND P_Username = '******'";
                break;

            case 2:
                strSql = "UPDATE Preferences SET P_Value = 'float' WHERE P_KEY= 'btn_QuickAdd' AND P_Username = '******'";
                break;

            case 3:
                strSql = "UPDATE Preferences SET P_Value = 'hide' WHERE P_KEY= 'btn_QuickAdd' AND P_Username = '******'";
                break;
            }
            ds = data.getDataset(strSql);
            frm_Main.ActiveForm.Refresh();

            switch (wstate)
            {
            case 1:
                strSql = "UPDATE Preferences SET P_Value = 'normal' WHERE P_KEY='form_state' AND P_Username = '******'";
                break;

            case 2:
                strSql = "UPDATE Preferences SET P_Value = 'maximized' WHERE P_KEY='form_state' AND P_Username = '******'";
                break;

            case 3:
                strSql = "UPDATE Preferences SET P_Value = 'minimized' WHERE P_KEY='form_state' AND P_Username = '******'";
                break;
            }
            ds = data.getDataset(strSql);

            btn_Apply.Enabled = false;
            frm_Main.frm_M.form_Refresh();
            //调用方法调整按钮状态
        }
Exemple #2
0
        private void btn_Login_Click(object sender, EventArgs e)
        {       //登录按钮事件
            string  strSql = "";
            DataSet ds;

            if (txt_Username.Text.Trim() != "" && txt_Password.Text.Trim() != "")
            {
                username = txt_Username.Text.Trim(); password = txt_Password.Text.Trim();
                strSql   = "select * from LoginUsers where username = '******' and password='******'";
                if (txt_Password.Text.Equals(""))
                {
                    strSql = "select * from LoginUsers where username = '******'";
                }
                DataConnector data = new DataConnector();
                data.dataCon();
                ds = data.getDataset(strSql);

                if (ds.Tables[0].Rows.Count == 1)                    //判断是否查询到一个用户.
                {
                    permission = ds.Tables[0].Rows[0][2].ToString(); //获取用户权限等级
                    frm_Main fMain = new frm_Main();
                    fMain.Show();                                    //显示主窗体.
                    this.Hide();                                     //隐藏登录窗体.
                }
                else
                {
                    MessageBox.Show("用户名或密码错误!\r\n请重新输入.", "登录失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txt_Password.Text = "";
                }
            }
            else
            {
                MessageBox.Show("用户名或密码为空,请输入完整的登录凭据.", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #3
0
        private DataSet doSQL(string strSql)
        {
            DataConnector data = new DataConnector();
            DataSet       ds;

            data.dataCon();
            return(ds = data.getDataset(strSql));
        }
Exemple #4
0
        private void QuickAdd_FormClosed(object sender, FormClosedEventArgs e)
        {   //浮动工具窗口关闭后,修改数据库中的按钮状态属性.
            DataConnector data = new DataConnector();
            DataSet       ds;

            data.dataCon();
            string strSql = "UPDATE Preferences SET P_Value = 'hide' WHERE P_KEY='btn_QuickAdd' AND P_Username = '******'";

            ds = data.getDataset(strSql);
        }
Exemple #5
0
        public void check_state()
        {
            DataConnector data = new DataConnector();
            DataSet       ds;

            data.dataCon();
            string strSql = "SELECT P_Value FROM(SELECT P_Key , P_Value , P_Username FROM Preferences WHERE(P_Username = '******')) WHERE(P_Key='btn_QuickAdd')";

            ds = data.getDataset(strSql);
            if (ds.Tables[0].Rows[0][0].ToString().Equals("hide") || ds.Tables[0].Rows[0][0].ToString().Equals("include"))
            {
                this.Close();
            }
        }