Example #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);
         }
     }
 }
Example #2
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);
        }
Example #3
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);
        }