Пример #1
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);
        }
Пример #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];
        }
Пример #3
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();

            //    }
            //}
        }