Ejemplo n.º 1
0
        private void bt_pwdOK_Click(object sender, EventArgs e)
        {
            MdPubFunc funcs = new MdPubFunc();
            string    pass  = funcs.EnCrypt(tb_pwdOld.Text);
            string    query = "select * from sUser where sUserCode = '" + tb_pwdId.Text + "' and sUserPass = '******'";

            if (funcs.ExcScalar(query, MdDefine.strcon) == null)
            {
                lbl_mess.Text = "Mật khẩu không đúng !!!";
            }
            else
            {
                if (tb_pwdNew.Text != tb_pwdNewR.Text)
                {
                    lbl_mess.Text = "Mật khẩu mới ko giống nhau !!!";
                }
                else
                {
                    pass  = funcs.EnCrypt(tb_pwdNew.Text.ToString());
                    query = "Update sUser Set sUserPass= '******' Where sUserCode='" + tb_pwdId.Text + "'";

                    if (funcs.ExecuteQuery(query, MdDefine.strcon) > 0)
                    {
                        MessageBox.Show("Bạn đã thay đổi thành công !!!");
                    }
                    else
                    {
                        MessageBox.Show("Có lỗi trong quá trình thay đổi!!!");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void bt_inq_Click(object sender, EventArgs e)
        {
            //string query = "select * from sUser";
            string    query = "exec USP_GetAllUser";
            MdPubFunc funcs = new MdPubFunc();
            DataSet   ds    = new DataSet();

            ds = funcs.getDataSet(query, MdDefine.strcon);
            gridview_user.DataSource = ds.Tables[0];
        }
Ejemplo n.º 3
0
        public MainSys(string name) : this()
        {
            this.name = name;
            string    qry   = "select * from susermod where usercode ='" + this.name + "'";
            MdPubFunc funcs = new MdPubFunc();
            DataSet   ds    = new DataSet();

            ds = funcs.getDataSet(qry, MdDefine.strcon);
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                ToolStripMenuItem AmenuItem = new ToolStripMenuItem();
                AmenuItem.Name = ds.Tables[0].Rows[i][1].ToString();
                AmenuItem.Text = ds.Tables[0].Rows[i][1].ToString();
                MenuStrip.Items.Add(AmenuItem);
                addSubMenu(ds.Tables[0].Rows[i][1].ToString(), AmenuItem);
            }

            // Language Menu
            ToolStripMenuItem LangpmenuItem = new ToolStripMenuItem();

            LangpmenuItem.Name = "Language";
            LangpmenuItem.Text = "Language";
            MenuStrip.Items.Add(LangpmenuItem);

            string qry1 = "select sLangName from sLang";

            ds = funcs.getDataSet(qry1, MdDefine.strcon);
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                ToolStripMenuItem AmenuItem = new ToolStripMenuItem();
                AmenuItem.Name   = ds.Tables[0].Rows[i][0].ToString();
                AmenuItem.Text   = ds.Tables[0].Rows[i][0].ToString();
                AmenuItem.Click += ShowSubForm;
                LangpmenuItem.DropDownItems.Add(AmenuItem);
            }


            // Help Menu
            ToolStripMenuItem HelpmenuItem = new ToolStripMenuItem();

            HelpmenuItem.Name = "Help";
            HelpmenuItem.Text = "Help";
            MenuStrip.Items.Add(HelpmenuItem);

            ToolStripMenuItem childpmenuItem = new ToolStripMenuItem();

            // string FilePath =  @"Images\infor.bmp";
            childpmenuItem.Name         = "About";
            childpmenuItem.Text         = "About";
            childpmenuItem.ShortcutKeys = Keys.Control | Keys.I;
            // childpmenuItem.Image = Image.FromFile(FilePath);
            childpmenuItem.Click += ShowSubForm;
            HelpmenuItem.DropDownItems.Add(childpmenuItem);
        }
Ejemplo n.º 4
0
        private void bt_register_Click(object sender, EventArgs e)
        {
            // string name =  tb_NameRe.Text.ToString();
            string    hasPass = "";
            int       status  = ckb_status.Checked ? 1 : 0;
            MdPubFunc funcs   = new MdPubFunc();

            hasPass = funcs.EnCrypt(tb_PassRe.Text.ToString());
            string qry = "Insert into suser(susercode,suserpass,suserfullname,susercom_code,suserrole_code,suserdept_code,suserposi_code,suseremail,suserphone_extend,suserstatus) Values( '" + tb_id.Text + "','" + hasPass + "','" + tb_NameRe.Text + "','" + tb_company.Text + "','" + tb_role.Text + "','" + tb_dept.Text + "','" + tb_posi.Text + "','" + tb_email.Text + "','" + tb_phone.Text + "','" + status + "')";

            if (funcs.ExecuteQuery(qry, MdDefine.strcon) > 0)
            {
                MessageBox.Show("Bạn đã đăng kí thành công !!!");
            }
            else
            {
                MessageBox.Show("Có lỗi trong quá trình đăng kí !!!");
            }
        }
Ejemplo n.º 5
0
        private void addSubMenu(string modname, ToolStripMenuItem PMenu)
        {
            string qry = "select CONCAT_WS (' ',sFormId ,sFormName) as info from sForm where sFormsModuleId = '" + modname + "'";
            //string qry = "select * from sform where moduleid = '" + modname + "'";
            MdPubFunc funcs = new MdPubFunc();
            //MySqlDataReader reader;
            DataSet ds = new DataSet();

            ds = funcs.getDataSet(qry, MdDefine.strcon);
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                ToolStripMenuItem AmenuItem = new ToolStripMenuItem();
                AmenuItem.Name   = ds.Tables[0].Rows[i][0].ToString();
                AmenuItem.Text   = ds.Tables[0].Rows[i][0].ToString();
                AmenuItem.Click += ShowSubForm;
                PMenu.DropDownItems.Add(AmenuItem);
            }
            //if (reader.HasRows)
            //{
            //    try
            //    {
            //        while (reader.Read())
            //        {
            //            ToolStripMenuItem AmenuItem = new ToolStripMenuItem();
            //            AmenuItem.Name = reader["formid"].ToString();
            //            AmenuItem.Text = reader["formid"].ToString();
            //            AmenuItem.Click += ShowSubForm;
            //            PMenu.DropDownItems.Add(AmenuItem);
            //        }
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show(ex.ToString());
            //        Close();
            //    }
            //    finally
            //    {
            //        reader.Close();

            //    }
            //}
        }
Ejemplo n.º 6
0
        private void bt_login_Click(object sender, EventArgs e)
        {
            string    name    = txtb_name.Text.ToString();
            string    hasPass = "";
            MdPubFunc funcs   = new MdPubFunc();

            hasPass = funcs.EnCrypt(txtb_pass.Text.ToString());
            string qry    = "select * from sUser where susercode='" + name + "' and suserpass='******'";
            object result = funcs.ExcScalar(qry, MdDefine.strcon);

            if (result != null)
            {
                MainSys main = new MainSys(txtb_name.Text);
                main.ShowDialog();
                this.Close();
            }
            else
            {
                lbl_message.Text = "Username or Password incorrect";
                txtb_name.Text   = "";
                txtb_pass.Text   = "";
                txtb_name.Focus();
            }
        }
Ejemplo n.º 7
0
        public void ShowSubForm(object sender, EventArgs e)
        {
            string    AFormName = Microsoft.VisualBasic.Strings.Left(sender.ToString(), 5).Trim();
            MdPubFunc funcs     = new MdPubFunc();

            System.Reflection.Assembly tempAssembly = System.Reflection.Assembly.GetExecutingAssembly();
            string str = tempAssembly.GetName().Name + "." + AFormName;

            Form frm;

            try
            {
                frm = (Form)tempAssembly.CreateInstance(str);
            }
            catch (Exception)
            {
                throw;
            }


            switch (AFormName)
            {
            case "DCM01":
                if (funcs.CheckAuth(AFormName, name) != null)
                {
                    FoodOrder_Frm DCM01_form = new FoodOrder_Frm();
                    DCM01_form.MdiParent   = this;
                    DCM01_form.WindowState = FormWindowState.Maximized;
                    DCM01_form.Show();


                    //            obVal = FindObject(frm, "Panelsys")
                    //If Not obVal Is Nothing Then
                    //    obVal.Parent = SysPage.SelectedTab  '本程序顯示在主窗体的mainpage中 2008-10-01 (Panelsys是在最上面Fill)hyt
                    //    iCurIndex = SysPage.SelectedIndex
                    //    LangDeal(AFormName, SysPage.TabPages.Item(iCurIndex))
                    //End If
                }
                else
                {
                    MessageBox.Show("Bạn không có quyền đề vào chương trình !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                break;

            case "USR01":
                if (funcs.CheckAuth(AFormName, name) != null)
                {
                    QuanliUser ql_form = new QuanliUser(name);
                    ql_form.MdiParent   = this;
                    ql_form.WindowState = FormWindowState.Maximized;
                    ql_form.Show();
                }
                else
                {
                    MessageBox.Show("Bạn không có quyền đề vào chương trình !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                break;

            case "USR03":
                if (funcs.CheckAuth(AFormName, name) != null)
                {
                    RegisterFrm re = new RegisterFrm();
                    // re.MdiParent = this;
                    // re.WindowState = FormWindowState.Maximized;
                    re.Show();
                }
                else
                {
                    MessageBox.Show("Bạn không có quyền đề vào chương trình !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                break;

            case "FGP01":
                if (funcs.CheckAuth(AFormName, name) != null)
                {
                    FingerPrint.FingerPrint fg = new FingerPrint.FingerPrint();
                    fg.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Bạn không có quyền đề vào chương trình !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                break;

            case "About":
                About about = new About();
                about.Show();
                break;

            default:
                MessageBox.Show("Chưa định nghĩa chương trình !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                break;
            }
        }