Пример #1
0
        /// <summary>
        /// 用检测线新建检测线
        /// </summary>
        /// <param name="jcx">jcxxxb Model</param>
        /// <returns>bool</returns>
        public bool Save_jcx(JCXXXB jcx)
        {
            string sql = "insert into jcxxxb values(@gyjsjip,@jcxmc,@jcfflx,@dpcgjbh,@fqfxybh,@btgydjbh,@wyzsbbh,@qtllfxybh,@LEDDPBH)";

            SqlParameter[] spr =
            {
                new SqlParameter("@gyjsjip",   jcx.GYJSJIP),
                new SqlParameter("@jcxmc",     jcx.JCXMC),
                new SqlParameter("@jcfflx",    jcx.JCFFLX),
                new SqlParameter("@dpcgjbh",   jcx.DPCGJBH),
                new SqlParameter("@fqfxybh",   jcx.FQFXYBH),
                new SqlParameter("@btgydjbh",  jcx.BTGYDJBH),
                new SqlParameter("@wyzsbbh",   jcx.WYZSBBH),
                new SqlParameter("@qtllfxybh", jcx.QTLLFXYBH),
                new SqlParameter("@LEDDPBH",   jcx.LEDDPBH)
            };
            try
            {
                if (DBHelperSQL.Execute(sql, spr) > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #2
0
        /// <summary>
        /// 用检测线更新检测线
        /// </summary>
        /// <param name="jcx">jcxxxb Model</param>
        /// <returns>bool</returns>
        public bool Update_jcx(JCXXXB jcx)
        {
            string sql = "update jcxxxb set gyjsjip=@gyjsjip,jcxmc=@jcxmc,jcfflx=@jcfflx,dpcgjbh=@dpcgjbh,fqfxybh=@fqfxybh,btgydjbh=@btgydjbh,wyzsbbh=@wyzsbbh,qtllfxybh=@qtllfxybh,LEDDPBH=@LEDDPBH where jcxbh=@jcxbh";

            SqlParameter[] spr = { new SqlParameter("@jcxbh",     jcx.JCXBH),
                                   new SqlParameter("@gyjsjip",   jcx.GYJSJIP),
                                   new SqlParameter("@jcxmc",     jcx.JCXMC),
                                   new SqlParameter("@jcfflx",    jcx.JCFFLX),
                                   new SqlParameter("@dpcgjbh",   jcx.DPCGJBH),
                                   new SqlParameter("@fqfxybh",   jcx.FQFXYBH),
                                   new SqlParameter("@btgydjbh",  jcx.BTGYDJBH),
                                   new SqlParameter("@wyzsbbh",   jcx.WYZSBBH),
                                   new SqlParameter("@qtllfxybh", jcx.QTLLFXYBH),
                                   new SqlParameter("@LEDDPBH",   jcx.LEDDPBH) };
            try
            {
                if (DBHelperSQL.Execute(sql, spr) > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #3
0
        /// <summary>
        /// 用本机IP获取本检测线信息
        /// </summary>
        /// <param name="IP">本机IP</param>
        /// <returns>JCXXXB Model</returns>
        public JCXXXB GetModel(string IP)
        {
            JCXXXB model = new JCXXXB();
            string sql   = "select * from JCXXXB where GYJSJIP=@ip";

            SqlParameter[] spr =
            {
                new SqlParameter("@ip", IP)
            };
            try
            {
                DataTable dt = DBHelperSQL.GetDataTable(sql, CommandType.Text, spr);
                if (dt.Rows.Count > 0)
                {
                    model.JCXBH   = dt.Rows[0]["JCXBH"].ToString();
                    model.GYJSJIP = dt.Rows[0]["GYJSJIP"].ToString();
                    model.JCXMC   = dt.Rows[0]["JCXMC"].ToString();
                    model.JCFFLX  = int.Parse(dt.Rows[0]["JCFFLX"].ToString());
                    model.DPCGJBH = int.Parse(dt.Rows[0]["DPCGJBH"].ToString());
                    int a;
                    int.TryParse(dt.Rows[0]["FQFXYBH"].ToString(), out a);
                    model.FQFXYBH = a;
                    int b;
                    int.TryParse(dt.Rows[0]["BTGYDJBH"].ToString(), out b);
                    model.BTGYDJBH = b;
                    int c;
                    int.TryParse(dt.Rows[0]["LLJBH"].ToString(), out c);
                    model.LLJBH = c;
                    int d;
                    int.TryParse(dt.Rows[0]["HJZBH"].ToString(), out d);
                    model.HJZBH = d;
                    int e;
                    int.TryParse(dt.Rows[0]["PCBH"].ToString(), out e);
                    model.PCBH      = e;
                    model.WYZSBBH   = int.Parse(dt.Rows[0]["WYZSBBH"].ToString());
                    model.QTLLFXYBH = int.Parse(dt.Rows[0]["QTLLFXYBH"].ToString());
                    model.LEDDPBH   = int.Parse(dt.Rows[0]["LEDDPBH"].ToString());
                    model.LJSYS     = int.Parse(dt.Rows[0]["LJSYS"].ToString());
                    model.DPCGJPZ   = dt.Rows[0]["DPCGJPZ"].ToString();
                    model.FQFXYPZ   = dt.Rows[0]["FQFXYPZ"].ToString();
                    model.BTGYDJPZ  = dt.Rows[0]["BTGYDJPZ"].ToString();
                    model.LLJPZ     = dt.Rows[0]["LLJPZ"].ToString();
                    model.LEDPZ     = dt.Rows[0]["LEDPZ"].ToString();
                    model.RZBH      = dt.Rows[0]["RZBH"].ToString();
                    model.XH        = dt.Rows[0]["XH"].ToString();
                    model.ZZCS      = dt.Rows[0]["ZZCS"].ToString();
                }
                else
                {
                    model.JCXBH = "-2";       //当服务器上没有找到本线时,本线编号置为-2,以免为0
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(model);
        }
Пример #4
0
 private void deleteSelectedCars(object sender, EventArgs e)
 {
     if (dataGrid_waitcar.SelectedRows.Count > 0)
     {
         for (int i = 0; i < dataGrid_waitcar.SelectedRows.Count; i++)
         {
             jcxxxb = jcxxx.GetModelbyJcxbh(dataGrid_waitcar.SelectedRows[i].Cells["检测线编号"].Value.ToString());
             jcxxx.deleteThisLine(jcxxxb.JCXBH);
         }
         ref_WaitCar();
     }
 }
Пример #5
0
 private void init_sql()
 {
     try
     {
         toolStripLabelSql.Text = "正在初始化数据库...";
         ip     = tool.getIp();                      //获取本机ip
         jcxxxb = jcxxx.GetModel(ip);                //初始化检测线
         Login newlogin = new Login();
         newlogin.ShowDialog();
         if (loginSuccess)
         {
             enable_panel();
             labelUserName.Text = loginYg.User_Name;
         }
         else
         {
             disabled_panel();
             labelUserName.Text = "未登录";
         }
         if (jcxxxb.JCXBH != "-2")                     //在服务器找到了本机IP配置的检测线
         {
             jczxxb           = jczxx.Get_jczxx();
             label_jcxbh.Text = jczxxb.JCZBH;
             label_jczmc.Text = jczxxb.JCZMC;
             this.Text        = "沈阳大路机动车检测站:" + jcxxxb.JCXMC;
         }
         else
         {
             disabled_panel();                           //禁止相应操作
             MessageBox.Show("本机" + ip + "在配置之前,无法作为检测线使用。", "系统提示");
         }
         toolStripLabelSql.Text = "数据库连接正常";
     }
     catch
     {
         toolStripLabelSql.Text = "数据库连接异常";
         disabled_panel();
         MessageBox.Show("数据库未连接成功,请检查配置文件是否正确", "系统提示");
     }
 }
Пример #6
0
 public void init_jcxInfor(string newjcxbh)
 {
     if (jcxxx.Have_ThisLine(newjcxbh, "", ""))
     {
         try
         {
             JCXXXB newjcx = jcxxx.GetModelbyJcxbh(newjcxbh);
             textBoxJcxIP.Text = newjcx.GYJSJIP;
             textBoxJcxmc.Text = newjcx.JCXMC;
             if (newjcx.DPCGJBH != 0)
             {
                 int             cgjbh = newjcx.DPCGJBH;
                 SYS.Model.SBXXB cgjsb = null;
                 cgjsb            = sbxx.Get_sb_by_bh(cgjbh);
                 comboBoxCgj.Text = cgjsb.SBMC;
             }
             else
             {
                 comboBoxCgj.Text = "无";
             }
             if (newjcx.FQFXYBH != 0)
             {
                 int             cgjbh = newjcx.FQFXYBH;
                 SYS.Model.SBXXB cgjsb = null;
                 cgjsb = sbxx.Get_sb_by_bh(cgjbh);
                 comboBoxFqfxy.Text = cgjsb.SBMC;
             }
             else
             {
                 comboBoxFqfxy.Text = "无";
             }
             if (newjcx.BTGYDJBH != 0)
             {
                 int             cgjbh = newjcx.BTGYDJBH;
                 SYS.Model.SBXXB cgjsb = null;
                 cgjsb            = sbxx.Get_sb_by_bh(cgjbh);
                 comboBoxYdj.Text = cgjsb.SBMC;
             }
             else
             {
                 comboBoxYdj.Text = "无";
             }
             if (newjcx.LLJBH != 0)
             {
                 int             cgjbh = newjcx.LLJBH;
                 SYS.Model.SBXXB cgjsb = null;
                 cgjsb            = sbxx.Get_sb_by_bh(cgjbh);
                 comboBoxLlj.Text = cgjsb.SBMC;
             }
             else
             {
                 comboBoxLlj.Text = "无";
             }
             if (newjcx.PCBH != 0)
             {
                 int             cgjbh = newjcx.PCBH;
                 SYS.Model.SBXXB cgjsb = null;
                 cgjsb           = sbxx.Get_sb_by_bh(cgjbh);
                 comboBoxPC.Text = cgjsb.SBMC;
             }
             else
             {
                 comboBoxPC.Text = "无";
             }
             if (newjcx.HJZBH != 0)
             {
                 int             cgjbh = newjcx.HJZBH;
                 SYS.Model.SBXXB cgjsb = null;
                 cgjsb            = sbxx.Get_sb_by_bh(cgjbh);
                 comboBoxHjz.Text = cgjsb.SBMC;
             }
             else
             {
                 comboBoxHjz.Text = "无";
             }
             if (newjcx.WYZSBBH != 0)
             {
                 int             cgjbh = newjcx.WYZSBBH;
                 SYS.Model.SBXXB cgjsb = null;
                 cgjsb            = sbxx.Get_sb_by_bh(cgjbh);
                 comboBoxZsj.Text = cgjsb.SBMC;
             }
             else
             {
                 comboBoxZsj.Text = "无";
             }
             textBoxRzbh.Text = newjcx.RZBH;
             textBoxZzcs.Text = newjcx.ZZCS;
             textBoxXh.Text   = newjcx.XH;
             string cgjCK = newjcx.DPCGJPZ.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries)[0];
             string fqyCK = newjcx.FQFXYPZ.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries)[0];
             string ydjCK = newjcx.BTGYDJPZ.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries)[0];
             string lljCK = newjcx.LLJPZ.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries)[0];
             comboBoxCgjCk.Text = cgjCK;
             comboBoxFqyCk.Text = fqyCK;
             comboBoxYdjCk.Text = ydjCK;
             comboBoxLljCk.Text = lljCK;
             MessageBox.Show("查询成功!", "系统提示");
         }
         catch
         {
             MessageBox.Show("检测线读取出错", "系统提示");
         }
     }
     else
     {
         MessageBox.Show("不存在该检测线", "系统提示");
     }
 }