Пример #1
0
        private void butok_Click(object sender, EventArgs e)
        {
            if (cmbpyck.SelectedValue == null)
            {
                return;
            }
            DataTable tb  = MZPY.Get_pyck("", cmbpyck.SelectedValue.ToString(), InstanceForm.BDatabase);
            string    add = TrasenClasses.GeneralClasses.PubStaticFun.GetMacAddress().Trim();

            if (tb.Rows.Count == 0)
            {
                return;
            }
            if (tb.Rows[0]["BZYBZ"].ToString() == "1")
            {
                if (add != tb.Rows[0]["wkdz"].ToString().Trim() && tb.Rows[0]["wkdz"].ToString().Trim() != "")
                {
                    MessageBox.Show("这个窗口正在使用,您不能选择它");
                    return;
                }
            }

            MZPY.Update_pyck(add, cmbpyck.SelectedValue.ToString(), 1, InstanceForm.BDatabase);

            Frmmzpy f = new Frmmzpy(_menuTag, _chineseName, _mdiParent);

            f._Pyckh = cmbpyck.SelectedValue.ToString().Trim();
            this.Close();
            if (_mdiParent != null)
            {
                f.MdiParent = _mdiParent;
            }

            f.Show();
        }
Пример #2
0
        /// <summary>
        /// 根据函数名称实例化窗体
        /// </summary>
        public void InstanceWorkForm()
        {
            if (_functionName == "")
            {
                throw new Exception("引出函数名不能为空!");
            }
            switch (_functionName)
            {
            case "Fun_ts_yf_mzpy":
                string    add = TrasenClasses.GeneralClasses.PubStaticFun.GetMacAddress();
                DataTable tb  = MZPY.Get_pyck(add, "", InstanceForm.BDatabase);
                if (tb.Rows.Count == 0)
                {
                    Frmpyck f = new Frmpyck(_menuTag, _chineseName, _mdiParent);
                    f.ShowDialog();
                }
                else
                {
                    Frmmzpy Frmmzpy = null;
                    Frmmzpy        = new Frmmzpy(_menuTag, _chineseName, _mdiParent);
                    Frmmzpy._Pyckh = tb.Rows[0]["CODE"].ToString().Trim();
                    MZPY.Update_pyck(add, Frmmzpy._Pyckh, 1, InstanceForm.BDatabase);
                    if (_mdiParent != null)
                    {
                        Frmmzpy.MdiParent = _mdiParent;
                    }
                    Frmmzpy.Show();
                }
                break;

            case "Fun_ts_yf_cfdy":
                Frmcfdy fm = new Frmcfdy();

                fm.MdiParent   = _mdiParent;
                fm.WindowState = FormWindowState.Maximized;
                //fm.Dock = DockStyle.Fill;
                fm.Show();
                break;
            }
        }