Exemple #1
0
        /// <summary>
        /// 提交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            string login_host = Dns.GetHostName();

            if (true)
            //if (b == "2016-20161129XI" || b == "YL-01010101")
            //String keyword02 = Interaction.InputBox("输入密码", "权限检查", "", -1, -1);
            {
                #region 保存权限02
                string inipath = @"\\YL_SERVER\Youli_Server\工程问题资料汇总\data\Problems.ini";
                string text2   = textBox2.Text.Replace("\r\n", " ");
                string text3   = textBox3.Text.Replace("\r\n", " ");
                string text4   = textBox4.Text.Replace("\r\n", " ");
                INIHelper.Write(this.textBox1.Text, "1", text2 + " " + "[用户:" + login_host + "][" + DateTime.Now.ToString("yyyy/MM/dd-hh:mm") + "]", inipath);
                INIHelper.Write(this.textBox1.Text, "2", text3 + " " + "[用户:" + login_host + "][" + DateTime.Now.ToString("yyyy/MM/dd-hh:mm") + "]", inipath);
                INIHelper.Write(this.textBox1.Text, "3", text4 + " " + "[用户:" + login_host + "][" + DateTime.Now.ToString("yyyy/MM/dd-hh:mm") + "]", inipath);
                #endregion
                MessageBox.Show("提交提示:" + "用户" + login_host + "\r\n您的修改已提交成功");
            }
            else
            {
                // MessageBox.Show("当前用户无权限 请与工程部沟通!");
            }
            //#region 图片修改保存
            //try
            //{
            //    #region pic1
            //    //逻辑描述:1当窗体图片有、文件夹有图片时 (为原图片时报错)
            //    if (pictureBox1.Image != null)
            //    {
            //        pictureBox1.Dispose();
            //        if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "01" + ".bmp"))
            //        {
            //           // File.Delete(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "01" + ".bmp");
            //            pictureBox1.Image.Save(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "01" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic1", @"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "01" + ".bmp", inipath);
            //        }
            //        else
            //        {
            //            pictureBox1.Image.Save(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "01" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic1", @"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "01" + ".bmp", inipath);
            //        }

            //    }
            //    else
            //    {
            //        if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "01" + ".bmp"))
            //        {
            //            File.Delete(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "01" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic1", "null", inipath);
            //        }
            //        INIHelper.Write(this.textBox1.Text, "pic1", "null", inipath);
            //    }
            //    #endregion
            //    #region pic2
            //    if (pictureBox2.Image != null)
            //    {
            //        pictureBox2.Dispose();
            //        if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "02" + ".bmp"))
            //        {
            //            //pictureBox2.Dispose();
            //            File.Delete(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "02" + ".bmp");
            //            pictureBox2.Image.Save(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "02" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic2", @"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "02" + ".bmp", inipath);
            //            //pictureBox2.Dispose();
            //        }
            //        else
            //        {
            //            //pictureBox2.Dispose();
            //            pictureBox2.Image.Save(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "02" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic2", @"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "02" + ".bmp", inipath);
            //            //pictureBox2.Dispose();
            //        }

            //    }
            //    else
            //    {
            //        if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "02" + ".bmp"))
            //        {
            //            File.Delete(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "02" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic2", "null", inipath);
            //        }
            //        //pictureBox2.Dispose();
            //        INIHelper.Write(this.textBox1.Text, "pic2", "null", inipath);
            //    }
            //    #endregion
            //    #region pic3
            //    if (pictureBox3.Image != null)
            //    {
            //        pictureBox3.Dispose();
            //        if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "03" + ".bmp"))
            //        {

            //            File.Delete(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "03" + ".bmp");
            //            pictureBox3.Image.Save(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "03" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic3", @"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "03" + ".bmp", inipath);

            //        }
            //        else
            //        {

            //            pictureBox3.Image.Save(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "03" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic3", @"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "03" + ".bmp", inipath);

            //        }

            //    }
            //    else
            //    {
            //        if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "03" + ".bmp"))
            //        {
            //            File.Delete(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "03" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic3", "null", inipath);
            //        }
            //        INIHelper.Write(this.textBox1.Text, "pic3", "null", inipath);
            //    }
            //    #endregion
            //    #region pic4
            //    if (pictureBox4.Image != null)
            //    {
            //        pictureBox4.Dispose();
            //        if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "04" + ".bmp"))
            //        {
            //            File.Delete(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "04" + ".bmp");
            //            pictureBox4.Image.Save(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "04" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic4", @"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "04" + ".bmp", inipath);
            //        }
            //        else
            //        {
            //            pictureBox4.Image.Save(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "04" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic4", @"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "04" + ".bmp", inipath);

            //        }

            //    }
            //    else
            //    {
            //        if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "04" + ".bmp"))
            //        {
            //            File.Delete(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "04" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic4", "null", inipath);
            //        }
            //        INIHelper.Write(this.textBox1.Text, "pic4", "null", inipath);
            //    }
            //    #endregion
            //    #region pic5
            //    if (pictureBox5.Image != null)
            //    {
            //        pictureBox5.Dispose();
            //        if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "05" + ".bmp"))
            //        {
            //            File.Delete(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "05" + ".bmp");
            //            pictureBox5.Image.Save(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "05" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic5", @"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "05" + ".bmp", inipath);
            //        }
            //        else
            //        {
            //            pictureBox5.Image.Save(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "05" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic5", @"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "05" + ".bmp", inipath);
            //        }

            //    }
            //    else
            //    {
            //        if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "05" + ".bmp"))
            //        {
            //            File.Delete(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "05" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic5", "null", inipath);
            //        }
            //        INIHelper.Write(this.textBox1.Text, "pic5", "null", inipath);
            //    }
            //    #endregion
            //    #region pic6
            //    if (pictureBox6.Image != null)
            //    {
            //        pictureBox6.Dispose();
            //        if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "06" + ".bmp"))
            //        {
            //            File.Delete(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "06" + ".bmp");
            //            pictureBox6.Image.Save(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "06" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic6", @"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "06" + ".bmp", inipath);
            //        }
            //        else
            //        {
            //            pictureBox6.Image.Save(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "06" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic6", @"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "06" + ".bmp", inipath);
            //        }

            //    }
            //    else
            //    {
            //        if (File.Exists(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "06" + ".bmp"))
            //        {
            //            File.Delete(@"\\YL_SERVER\Youli_Server\工程问题资料汇总\Picture\" + textBox1.Text + "06" + ".bmp");
            //            INIHelper.Write(this.textBox1.Text, "pic6", "null", inipath);
            //        }
            //        INIHelper.Write(this.textBox1.Text, "pic6", "null", inipath);
            //    }
            //    #endregion

            //}
            //catch (Exception)
            //{
            //    MessageBox.Show("error");
            //}
            //#endregion
        }
Exemple #2
0
        /// <summary>
        /// 查会计 内部检查情况
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button4_Click(object sender, EventArgs e)//窗口5:内部检查
        {
            try
            {
                string filePath1 = @"\\YL_SERVER\Youli_Server\Youli_date_bin\sys.ini";
                string win1      = INIHelper.Read("window", "1", "0", filePath1); //严经理窗口
                string win2      = INIHelper.Read("window", "2", "0", filePath1); //王庆青窗口
                string win3      = INIHelper.Read("window", "3", "0", filePath1); //叶磊窗口
                string win4      = INIHelper.Read("window", "4", "0", filePath1); //QC窗口
                string win5      = INIHelper.Read("window", "5", "0", filePath1); //查会计窗口
                notifyIcon1.ShowBalloonTip(1000, "提示", "正在Link...", ToolTipIcon.Info);
                #region 测试ping
                int    index = win5.IndexOf("\\", 3);
                string ipStr = win5.Substring(2, index - 2);
                //string ipStr = "LENOVO-PC";
                Ping   pingSender = new Ping();
                string data       = "ping test data";
                byte[] buf        = Encoding.ASCII.GetBytes(data);
                int    timeout    = 1000;

                try
                {
                    PingReply reply = pingSender.Send(ipStr, timeout, buf);
                    if (reply.Status == IPStatus.Success)
                    {
                    }
                }
                catch
                {
                    MessageBox.Show("别拿鼠标戳我了,对方关机或者断网了");
                    return;
                }
                #endregion

                var fileContent = string.Empty;
                var filePath    = string.Empty;
                var filename    = string.Empty;
                try
                {
                    System.Diagnostics.Process.Start(win5);
                }
                catch
                {
                    MessageBox.Show("路径错误");
                }
            }
            catch
            {
                MessageBox.Show("未读到路径信息!");
                return;
            }

            //using (OpenFileDialog openFileDialog = new OpenFileDialog())
            //{


            //    openFileDialog.InitialDirectory = @win5;
            //    openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            //    openFileDialog.FilterIndex = 2;
            //    openFileDialog.RestoreDirectory = true;
            //    if (openFileDialog.ShowDialog() == DialogResult.OK)
            //    {
            //        //Get the path of specified file
            //        filePath = openFileDialog.FileName;
            //        // MessageBox.Show(filePath, filename);
            //        Process m_Process = null;
            //        m_Process = new Process();
            //        m_Process.StartInfo.FileName = @filePath;
            //        m_Process.Start();
            //    }
            //}
        }