Esempio n. 1
0
 private void dgvData_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
     {
         if (dgvData.Columns[e.ColumnIndex].Name == "Col_ViewPic")
         {
             DataRow row       = (DataRow)dgvData.Rows[e.RowIndex].Tag;
             bool    hascamera = row["HAS_CAMERA"] == null ? false : true;
             if (!hascamera)
             {
                 return;
             }
             CtrlWaiting waiting = new CtrlWaiting(() =>
             {
                 try
                 {
                     string sn           = Convert.ToString(row["CTRLR_SN"]);
                     decimal recordIndex = (decimal)row["RECORD_INDEX"];
                     DateTime recordDate = (DateTime)row["RECORD_DATE"];
                     Maticsoft.BLL.SMT_RECORDCAP_IMAGE capBll = new Maticsoft.BLL.SMT_RECORDCAP_IMAGE();
                     var capImages = capBll.GetModelList("CTRL_SN='" + sn + "' and RECORD_INDEX=" + recordIndex + " and RECORD_TIME='" + recordDate.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'");
                     if (capImages.Count == 0)
                     {
                         WinInfoHelper.ShowInfoWindow(this, "未查询到照片!");
                         return;
                     }
                     Maticsoft.BLL.SMT_DATADICTIONARY_INFO dicBll = new Maticsoft.BLL.SMT_DATADICTIONARY_INFO();
                     string url   = "";
                     var dicModel = dicBll.GetModel("CAMERA_INFO", "IMAGE_SERVER");
                     if (dicModel != null)
                     {
                         url = dicModel.DATA_VALUE;
                     }
                     List <string> strs = new List <string>();
                     foreach (var item in capImages)
                     {
                         string str = Path.Combine(url, item.CAP_RELATIVE_URL);
                         strs.Add(str);
                     }
                     this.Invoke(new Action(() =>
                     {
                         picView.SetImages(strs.ToArray());
                         picView.Visible = true;
                     }));
                 }
                 catch (System.Exception ex)
                 {
                     WinInfoHelper.ShowInfoWindow(this, "查看失败:" + ex.Message);
                     log.Error("查看照片异常:", ex);
                 }
             });
             waiting.Show(this);
         }
     }
 }
Esempio n. 2
0
 private void FrmMain_Load(object sender, EventArgs e)
 {
     /*CtrlWaiting waiting = new CtrlWaiting("权限加载中...",() =>
      * {
      *  try
      *  {
      *      PrivateMgr.LoadPrivates();
      *  }
      *  catch (Exception ex)
      *  {
      *      WinInfoHelper.ShowInfoWindow(this, "权限加载异常:"+ex.Message);
      *  }
      *
      * });
      * waiting.ShowDialog(this);*/
     try
     {
         tsslStateUser.Text = UserInfoHelper.UserInfo.USER_NAME;
         DatabaseConfigClass config = SysConfig.GetSqlServerServerConfig();
         if (config != null)
         {
             tsmiServerIp.Text = config.serverName;
         }
     }
     catch (Exception ex)
     {
         log.Error("读取配置异常:", ex);
     }
     smtNavigate.Main = this;
     try
     {
         if (PrivateMgr.FUN_POINTS.Contains(SYS_FUN_POINT.REAL_ALARM_DETECT))
         {
             Maticsoft.BLL.SMT_DATADICTIONARY_INFO dicBll = new Maticsoft.BLL.SMT_DATADICTIONARY_INFO();
             var configs = dicBll.GetModelList("DATA_TYPE='ALARM_INFO' and DATA_KEY='ALARM_SERVER'");
             if (configs.Count > 0)
             {
                 log.Info("报警服务器地址为:" + configs[0].DATA_VALUE);
                 consumerClient = new ConsumerClient(configs[0].DATA_VALUE);
                 consumerClient.MessageRecieved += consumerClient_MessageRecieved;
                 consumerClient.Start();
             }
             else
             {
                 log.Error("没有报警服务器地址,请在数据库中配置报警服务地址!其中 DATA_TYPE='ALARM_INFO' and DATA_KEY='ALARM_SERVER' DATA_VALUE为配置值,如:192.168.1.1:56010");
             }
         }
     }
     catch (Exception ex)
     {
         log.Error("报警接收初始化异常:", ex);
     }
 }
Esempio n. 3
0
        private void DoorCameraSetting_Load(object sender, EventArgs e)
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_CAMERA_INFO cameraBll = new Maticsoft.BLL.SMT_CAMERA_INFO();
                    var cameras = cameraBll.GetModelList("");
                    this.Invoke(new Action(() =>
                    {
                        foreach (var item in cameras)
                        {
                            AddToGridCamera(item);
                        }
                    }));

                    var ds = Maticsoft.DBUtility.DbHelperSQL.Query("SELECT T.*,SCI.CAMERA_NAME,SCI.CAMERA_IP FROM (select SDC.*,SDI.DOOR_NAME from SMT_DOOR_CAMERA SDC INNER JOIN SMT_DOOR_INFO SDI ON SDC.DOOR_ID=SDI.ID) T INNER JOIN SMT_CAMERA_INFO SCI ON T.CAMERA_ID=SCI.ID");
                    var dt = ds.Tables[0];
                    this.Invoke(new Action(() =>
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            AddToGridDoorCamera(dr);
                        }
                    }));

                    Maticsoft.BLL.SMT_DATADICTIONARY_INFO diBll = new Maticsoft.BLL.SMT_DATADICTIONARY_INFO();
                    var imageServer = diBll.GetModel("CAMERA_INFO", "IMAGE_SERVER");
                    if (imageServer != null)
                    {
                        this.Invoke(new Action(() =>
                        {
                            tbPicUrl.Text = imageServer.DATA_VALUE;
                        }));
                    }
                }
                catch (Exception ex)
                {
                    log.Error("加载数据异常:", ex);
                    WinInfoHelper.ShowInfoWindow(this, "加载数据异常:" + ex.Message);
                }
            });

            waiting.Show(this, 100);
        }
Esempio n. 4
0
        private void biSave_Click(object sender, EventArgs e)
        {
            string str = tbPicUrl.Text.Trim();

            if (str == "")
            {
                WinInfoHelper.ShowInfoWindow(this, "图片服务地址不能为空!");
                return;
            }
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_DATADICTIONARY_INFO diBll = new Maticsoft.BLL.SMT_DATADICTIONARY_INFO();
                    var imageServer = diBll.GetModel("CAMERA_INFO", "IMAGE_SERVER");
                    if (imageServer == null)
                    {
                        imageServer              = new Maticsoft.Model.SMT_DATADICTIONARY_INFO();
                        imageServer.DATA_TYPE    = "CAMERA_INFO";
                        imageServer.DATA_KEY     = "IMAGE_SERVER";
                        imageServer.DATA_VALUE   = str;
                        imageServer.DATA_NAME    = "抓图访问服务地址";
                        imageServer.DATA_CONTENT = "摄像头抓图时服务访问的地址";
                        diBll.Add(imageServer);
                    }
                    else
                    {
                        imageServer.DATA_VALUE = str;
                        diBll.Update(imageServer);
                    }
                    WinInfoHelper.ShowInfoWindow(this, "保存成功!");
                }
                catch (Exception ex)
                {
                    log.Error("保存抓图访问服务地址异常:", ex);
                    WinInfoHelper.ShowInfoWindow(this, "保存抓图访问服务地址异常:" + ex.Message);
                }
            });

            waiting.Show(this);
        }