Exemple #1
0
 //根据设备ip地址返回该设备所在的大门号拍摄方向
 public record getDeviceInfo(string sIP)
 {
     record recordModel = new record();
     recordModel.Gate = inifile.IniReadValue("Ip_Device",sIP).Substring(0, 2);
     recordModel.Direction = inifile.IniReadValue("Ip_Device", sIP).Substring(2);
     return recordModel;
 }
        private void save_button_Click(object sender, EventArgs e)
        {
            paleInfoModel.Community = coum_textBox.Text.Trim();
            paleInfoModel.Building = buld_textBox.Text.Trim();
            paleInfoModel.Unit = unit_textBox.Text.Trim();
            paleInfoModel.Room = room_textBox.Text.Trim();
            paleInfoModel.Name = name_textBox.Text.Trim();
            paleInfoModel.Pale = sur_comboBox.Text + pale_textbox.Text;
            paleInfoModel.regtime = DateTime.Now;
            paleInfoModel.statue = "已预约";
            string sql = "INSERT INTO car_pale (pale,regtime,name,community,building,unit,room,statue) VALUES ('" + paleInfoModel.Pale + "','" + paleInfoModel.regtime.ToString() + "','" + paleInfoModel.Name + "','" + paleInfoModel.Community + "','" + paleInfoModel.Building + "','" + paleInfoModel.Unit + "','" + paleInfoModel.Room + "','" + paleInfoModel.statue + "')";
            string sql2 = "SELECT * FROM car_pale WHERE pale='" + paleInfoModel.Pale + "'  AND   statue='已预约'";
            string sql3 = "INSERT INTO car_pale (pale,regtime,name,community,building,unit,room,statue) VALUES ('" + paleInfoModel.Pale + "','" + paleInfoModel.regtime.ToString() + "','" + paleInfoModel.Name + "','" + paleInfoModel.Community + "','" + paleInfoModel.Building + "','" + paleInfoModel.Unit + "','" + paleInfoModel.Room + "','已入库')";
            if (paleInfoModel.Name != "" && pale_textbox.Text != "")
            {
                try
                {
                    conn.Open();
                    MySqlCommand cmd = new MySqlCommand(sql2, conn);
                    MySqlDataReader rdr = cmd.ExecuteReader();

                    if (rdr.Read())
                    {
                        MessageBox.Show("您填写的车牌已经预约", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        conn.Close();
                    }
                    else
                    {
                        rdr.Close();
                        conn.Close();

                        try
                        {
                            conn.Open();
                            record r = new record();
                            if (r.gettmppale().Length == 1)
                            {
                                MySqlCommand cmd2 = new MySqlCommand(sql, conn);
                                if (cmd2.ExecuteNonQuery() > 0)
                                {
                                    log.WriteLog("操作员:" + new login().getuser() + "预约了车辆 " + paleInfoModel.Pale);
                                    MessageBox.Show("车牌增加成功!");
                                    this.car_paleTableAdapter1.Fill(this.paleDataSet3.car_pale);
                                }
                            }
                            else
                            {
                                MySqlCommand cmd2 = new MySqlCommand(sql3, conn);
                                if (cmd2.ExecuteNonQuery() > 0)
                                {
                                    conn.Close();
                                    string direction = r.gettmpdirection();
                                    string gate = r.gettmppgate();
                                    string Endirection = direction.Substring(0, 1) == "入" ? "in" : "out";
                                    DateTime dt = DateTime.Now;
                                    string path = DateTime.Today.ToString("yyyy") + DateTime.Today.ToString("MM") + DateTime.Today.ToString("dd") +
                                            "_" + dt.Hour.ToString().PadLeft(2, '0') + "-" + dt.Minute.ToString().PadLeft(2, '0') + "-" + dt.Second.ToString().PadLeft(2, '0') +
                                            "_" + gate.Substring(0, 1) + "gate" + "_" + Endirection + direction.Substring(2, 1) + ".jpg";
                                    string SQL1 = "INSERT INTO record (pale,regtime,gate,direction,time,pic) VALUES ('" + paleInfoModel.Pale + "','" + paleInfoModel.regtime.ToString() + "','" + gate + "','" + direction + "','" + paleInfoModel.regtime.ToString() + "','" + path + "')";
                                    conn.Open();
                                    MySqlCommand cmd1 = new MySqlCommand(SQL1, conn);
                                    cmd1.ExecuteNonQuery();
                                    log.WriteLog("操作员:" + new login().getuser() + "预约了车辆 " + paleInfoModel.Pale);
                                    if (direction == "入口1号车道")
                                    {
                                        ThreadPAC(0);     //DO 0栏杆打开
                                    }
                                    else if (direction == "入口2号车道")
                                    {
                                        ThreadPAC(1);     //DO 1栏杆打开
                                    }
                                    else if (direction == "出口1号车道")
                                    {
                                        ThreadPAC(2);     //DO 2栏杆打开
                                    }
                                    else if (direction == "出口2号车道")
                                    {
                                        ThreadPAC(3);     //DO 3栏杆打开
                                    }
                                    else { }

                                    r.settmpdirection(string.Empty);
                                    r.settmpgate(string.Empty);
                                    r.settmppale("n");

                                    mi.listView2.FindItemWithText(paleInfoModel.Pale).ForeColor = Color.Blue;
                                    mi.listView2.FindItemWithText(paleInfoModel.Pale).SubItems[1].Text = paleInfoModel.Pale;
                                    mi.listView2.FindItemWithText(paleInfoModel.Pale).SubItems[5].Text = name_textBox.Text;
                                    mi.listView2.FindItemWithText(paleInfoModel.Pale).SubItems[6].Text = coum_textBox.Text + buld_textBox.Text + unit_textBox.Text + room_textBox.Text;
                                    mi.listView2.FindItemWithText(paleInfoModel.Pale).SubItems[7].Text = "已入库";
                                    mi.listView2.FindItemWithText(paleInfoModel.Pale).SubItems[8].Text = "岗亭预约";
                                    File.Copy(mi.picpath, System.Environment.CurrentDirectory + "/../../../Resources/palepic/"+path, true);
                                    this.car_paleTableAdapter1.Fill(this.paleDataSet3.car_pale);

                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("该车牌数据库中已存在或输入数据有误,请检查!", "错误");
                        }
                        conn.Close();
                    }

                }
                catch { }
            }
            else
            {
                MessageBox.Show("姓名和车牌不能为空!");
            }
        }
Exemple #3
0
        private void listView2_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListViewHitTestInfo info = listView2.HitTest(e.X, e.Y);
            var item = info.Item as ListViewItem;
            string statu = item.SubItems[8].Text;  //识别状态

            if (statu == "手动放行")
            {
                record tmpr = new record();
                tmpr.settmppale(item.SubItems[2].Text);
                tmpr.settmpgate(item.SubItems[3].Text);
                tmpr.settmpdirection(item.SubItems[4].Text);

                Point orPoit = MousePosition;
                Point p1 = (this.Parent.Parent as Form).Location;
                p1.Offset(200, 60);
                float dx = (float)p1.X / SW;
                float dy = (float)p1.Y / SH;
                mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE | MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, Convert.ToInt32(dx * Int16_Max), Convert.ToInt32(dy * Int16_Max), 0, 0);

                double ox = (double)(orPoit.X + 1) / SW;
                double oy = (double)(orPoit.Y + 1) / SH;
                mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, Convert.ToInt32(ox * Int16_Max), Convert.ToInt32(oy * Int16_Max), 0, 0);

            }
            listview_Color();
        }
Exemple #4
0
 private void myOpaqueLayer5_Click(object sender, EventArgs e)
 {
     if (!panel3.Controls.ContainsKey("paleSubscribe"))
     {
         record r = new record();
         panel3.Controls.Clear();
         ps.FormBorderStyle = FormBorderStyle.None; // 无边框
         ps.TopLevel = false; // 不是最顶层窗体
         if (r.gettmppale().Length > 1)
         {
             ps.sur_comboBox.Text = r.gettmppale().Substring(0, 1);
             ps.pale_textbox.Text = r.gettmppale().Substring(1, 6);
         }
         else
         {
             setPSclear();
         }
         ps.name_textBox.Text = "";
         panel3.Controls.Add(ps);  // 添加到 Panel中
         ps.Show();     // 显示
         ps.car_paleTableAdapter1.Fill(ps.paleDataSet3.car_pale);  //刷新数据
         label8.Text = "车牌预约";
         rc.Hide();
     }
 }