Пример #1
0
        private void frmWaterSys_Load(object sender, System.EventArgs e)
        {
            try
            {
                string strSql=string.Format("select softName,userName,version,image from tbAdInfo where userid='{0}'",BengZhan.CDBConnection.m_strUserID);
                DataTable dtAdInfo=new DataTable();

                BengZhan.CDBConnection.getDataTable(ref dtAdInfo,strSql,"dt");

                XmlDocument xDocInfo=new XmlDocument();
                xDocInfo.Load(@"ini/sysIni.xml");

                xDocInfo.DocumentElement.SelectSingleNode("./abort/softName").Attributes.GetNamedItem("val").Value=dtAdInfo.Rows[0]["softName"].ToString().Trim();
                xDocInfo.DocumentElement.SelectSingleNode("./abort/version").Attributes.GetNamedItem("val").Value=dtAdInfo.Rows[0]["version"].ToString().Trim();
                xDocInfo.DocumentElement.SelectSingleNode("./abort/user").Attributes.GetNamedItem("val").Value=dtAdInfo.Rows[0]["userName"].ToString().Trim();

                xDocInfo.Save(@"ini/sysIni.xml");

                System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmWaterSys));

            //				if(dtAdInfo.Rows[0]["image"].ToString().Trim()=="frm1")
            //				{
            //
            //					BengZhan.frm1 frm=new frm1();
            //					System.Drawing.Image im=frm.BackgroundImage;
            //					this.BackgroundImage=im;
            //
            //				}
            //
            //				if(dtAdInfo.Rows[0]["image"].ToString().Trim()=="frmWaterSys1")
            //				{
            //					BengZhan.frm2 frm=new frm2();
            //					System.Drawing.Image im=frm.BackgroundImage;
            //					this.BackgroundImage=im;
            //				}
            //
            //				if(dtAdInfo.Rows[0]["image"].ToString().Trim()=="th")
            //				{
            //					this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
            //				}

                //System.Drawing.Image im=frm.BackgroundImage;

                //	string strSql=string.Format("delete from tbcmd insert into tbCmd values('start')");
                //	BengZhan.CDBConnection.ExecuteSql(strSql);
                //				this.pictureBox1.Location=new Point((this.toolBar1.Location.Y+this.toolBar1.Height),this.toolBar1.Location.X);
                //				this.pictureBox1.Height=this.Height-this.pictureBox1.Location.Y;
                //				this.pictureBox1.Width=this.Width;
                //this.pictureBox1.Image=((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));

                //this.errorProvider2.SetError(this.toolBar1.b,"warn");

                //��ʼһ����ͼ
                iniWellAmount();

                CInsertMenu cInsertM=new CInsertMenu();
                cInsertM.EnableMenu(this.mainMenu1);
                cInsertM.enableToolbar(this.toolBar1,this.mainMenu1);
                //this.enableToolBar();
                this.iniFrm();

                //*******************************ϵͳ��ʼ��**********************************************
                //New.laidianDisplay.GDBConnection GDBC=new New.laidianDisplay.GDBConnection();
                //GDBC.initialCDB();

                BengZhan.CDBConnection cdb=new CDBConnection();
                cdb.initialCon();
                //��ʼ��remotingϵͳ��
                GprsSoft.serverMonitor.CServer csObj=new GprsSoft.serverMonitor.CServer();
                csObj.InitialCServer();
                CDBConnection.refreshHis();
                //***************************************************************************************

                if(BengZhan.CDBConnection.m_bClient==true)
                {
                    this.Text=this.Text+"[�ͻ���]";
                }
                if(BengZhan.CDBConnection.m_bServer==true)
                {
                    this.Text=this.Text+"[������]";
                }

                if(m_softName!=null)
                {
                    if(m_softName.Trim()!="")
                    {

                        this.Text=m_softName;
                        //this.Text=m_softName+string.Format("    [��ǰ�û���{0}]",CDBConnection.m_strUserName);
                    }
                }

                //this.BackgroundImage=null;
                //�Զ��������ݿ�

                //this.startFrm();

                autoBackup();

                this.startTimer();

                this.regCom();

                this.disToolBar();

                this.BackColor=Color.White;
                this.Text=this.Text+"[�°�]";

                this.Text="��������ϵͳ";

                XmlDocument xDoc=new XmlDocument();

                xDoc.Load("Server.xml");

                string strTitle=xDoc.DocumentElement.SelectSingleNode("./abort/softName").Attributes.GetNamedItem("val").Value.Trim();

                this.Text=strTitle;

            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Пример #2
0
        private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            try
            {
                if(e.Button.Text.Trim()=="�˹�¼��")
                {
                    this.miniFrms();
                    if(this.showFrm("�˹�¼��"))
                    {
                        return;
                    }
                    bengzhans.frmDatasEdit frmedit=new BengZhan.bengzhans.frmDatasEdit();
                    frmedit.Text="�˹�¼��";
                    frmedit.MdiParent=this;
                    frmedit.WindowState=System.Windows.Forms.FormWindowState.Maximized;
                    frmedit.Show();

                    m_arrFrms.Add(frmedit);

                }
                if(e.Button.Text.Trim()=="��������")
                {
                    New.cReport.frmParamSet frmPS=new New.cReport.frmParamSet();
                    frmPS.ShowDialog();
                    return ;
                }
                if(e.Button.Text.Trim()=="��վ��Ϣ")
                {
                    bengzhans.frmBengZhans frmBengZhanObj=new BengZhan.bengzhans.frmBengZhans();
                    frmBengZhanObj.ShowDialog();
                    return;
                }
                if(e.Button.Text.Trim()=="�˳�ϵͳ")
                {
                    this.Close();
                    return;
                }
                if(e.Button.Text.Trim()=="��ˮ�鿴")
                {

                    this.showICSal();
                }

                CInsertMenu cInsertM=new CInsertMenu();

                if(!cInsertM.enableToolbar(e.Button.Text.Trim(),this.mainMenu1))
                {
                    MessageBox.Show("Ȩ�޲��㣡");
                    return;
                }

                if(e.Button.Text.Trim()=="���վ")
                {
                    this.mnuWell_Click(null,null);
                }
                if(e.Button.Text.Trim()=="��λ��Ϣ")
                {
                    this.mnuDep_Click(null,null);
                }
                if(e.Button.Text.Trim()=="�˳�ϵͳ")
                {
                    this.Close();
                }
                if(e.Button.Text.Trim()=="�û�����")
                {
                    Users.frmUsers frmUsersObj=new BengZhan.Users.frmUsers();
                    frmUsersObj.ShowDialog();
                }
                if(e.Button.Text.Trim()=="�û���Ȩ")
                {
                    Users.FrmMenuMana frmMeMaObj=new BengZhan.Users.FrmMenuMana();
                    frmMeMaObj.ShowDialog();
                }
                if(e.Button.Text.Trim()=="ʵʱ���")
                {
                    this.miniFrms();
                    this.showMonitor();
                }
                if(e.Button.Text.Trim()=="��ˮͳ��")
                {
                    try
                    {
                        New.cReport.frmSalRep frmSalR=new New.cReport.frmSalRep();
                        frmSalR.ShowDialog();
                    }
                    catch(Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
                if(e.Button.Text.Trim()=="��ʷ����")
                {
                    this.miniFrms();
                    if(this.showFrm("����ͼ��"))
                    {
                        return;
                    }
                    CReportDll.comReport.newRep.frmChart frmC=new CReportDll.comReport.newRep.frmChart();
                    frmC.MdiParent=this;
                    frmC.WindowState=System.Windows.Forms.FormWindowState.Maximized;
                    frmC.Show();
                    m_arrFrms.Add(frmC);
                }
                if(e.Button.Text.Trim()=="ϵͳ����")
                {
                    Help.ShowHelp(this,"help.chm");
                }
                if(e.Button.Text.Trim()=="��������")
                {
                        BengZhan.warn.frmWarnLevel  frmSWL=new BengZhan.warn.frmWarnLevel();
                        frmSWL.ShowDialog();
                }
                if(e.Button.Text.Trim()=="������ϸ")
                {

                    frmWarn.Form1 frmWarnO=new frmWarn.Form1();
                    frmWarnO.m_strFormType="";
                    frmWarnO.ShowDialog();
                }
                if(e.Button.Text=="ʵʱ�鿴")
                {

                }
                if(e.Button.Text=="���㶨ʱ")
                {
                    if(this.ActiveMdiChild!=null)
                    {
                        MessageBox.Show("���ȹر��Ѵ򿪴���!");
                        return;
                        this.ActiveMdiChild.Close();
                    }
                    BengZhan.warn.onTimeSet.frmOnTimeSet   frmT=new BengZhan.warn.onTimeSet.frmOnTimeSet();
                    frmT.ShowDialog();
                }
                if(e.Button.Text.Trim()=="IC����ˮ")
                {
                    showICSale();
                }
                if(e.Button.Text.Trim()=="IC������")
                {
                    showICMana();
                }
                if(e.Button.Text.Trim()=="����ͳ��")
                {
                    this.miniFrms();
                    if(this.showFrm("���վ����ͳ��"))
                    {
                        return;
                    }
                    CReportDll.comReport.newRep.frmReport frmRepO=new CReportDll.comReport.newRep.frmReport();
                    frmRepO.MdiParent=this;
                    frmRepO.WindowState=System.Windows.Forms.FormWindowState.Maximized;
                    frmRepO.Show();
                    m_arrFrms.Add(frmRepO);

                }
                if(e.Button.Text.Trim()=="Ƿ������")
                {
                    CWarnDll.frmWarn.Form2 frmWarnTb=new CWarnDll.frmWarn.Form2();
                    frmWarnTb.ShowDialog();
                }
                if(e.Button.Text.Trim()=="������Ϣ")
                {
                    this.showGis();
                }
                if(e.Button.Text.Trim()=="����ͳ��")
                {
                    showSalSta();
                }
                if(e.Button.Text.Trim()=="�½�ͳ��")
                {
                    this.showYearStac();
                }
                if(e.Button.Text.Trim()=="���ͳ��")
                {

                }
                if(e.Button.Text.Trim()=="TM����ˮ")
                {
                    string strFileName=string.Format(@"test/test.exe",BengZhan.CDBConnection.m_strUserID);
                    System.Diagnostics.Process proc = new System.Diagnostics.Process();
                    proc.EnableRaisingEvents=false;

                    proc.StartInfo.FileName=strFileName;
                    proc.StartInfo.Arguments=BengZhan.CDBConnection.m_strUserID;
                //	proc.StartInfo.WindowStyle=ProcessWindowStyle.Minimized;
                    proc.Start();
                    System.IO.Directory.SetCurrentDirectory(Application.StartupPath);
                }
                if(e.Button.Text.Trim()=="���ͳ��")
                {
                    this.showYearStac1();
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }