/// <summary>
 /// 添加连接信息
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void ButDevAdd_Click(object sender, DirectEventArgs e)
 {
     try
     {
         HidSaveFlag.Value         = "1";
         Button5.Hidden            = false;
         Window4.Title             = GetLangStr("CCTVStationManager48", "添加连接设备");
         CmbDevice.AllowBlank      = false;
         CmbStationType.AllowBlank = false;
         CmbStationType.Reset();
         TxtQStationName.Reset();
         CmbDevice.Reset();
         CmbStation.Reset();
         MNumChannel.Reset();
         RNumChannel.Reset();
         CmbDirection.Reset();
         CmbDeviceRecord.Reset();
         TxtMasterId.Reset();
         CmbIsuse.Reset();
         ButQuery.Hidden        = false;
         CmbDeviceRecord.Hidden = false;
         CmbStationType.Hidden  = false;
         TxtQStationName.Hidden = false;
         CmbDevice.Hidden       = false;
         CmbStation.Hidden      = false;
         CompositeField1.Hidden = false;
         Window4.Show();
     }
     catch (Exception ex)
     {
         ILog.WriteErrorLog(ex);
         logManager.InsertLogError("CCTVStationManager.aspx-ButDevAdd_Click", ex.Message + ";" + ex.StackTrace, "ButDevAdd_Click has an exception");
     }
 }
        public void Modify()
        {
            try
            {
                RowSelectionModel sm = this.GridDeviceManager.SelectionModel.Primary as RowSelectionModel;
                if (sm.SelectedRow != null)
                {
                    string id = sm.SelectedRow.RecordID;
                    HidSaveFlag.Value         = "2";
                    Window4.Title             = GetLangStr("CCTVStationManager73", "修改连接设备信息");
                    CmbDevice.AllowBlank      = true;
                    CmbStationType.AllowBlank = true;
                    HiddenId.Value            = id;
                    CmbStationType.Reset();
                    TxtQStationName.Reset();
                    CmbDevice.Reset();
                    CmbDeviceRecord.Reset();
                    TxtMasterId.Reset();
                    CmbDirection.Reset();
                    CmbStation.Reset();
                    MNumChannel.Reset();
                    RNumChannel.Reset();;
                    CmbIsuse.Reset();
                    TxtMasterId.Reset();
                    ButQuery.Hidden        = true;
                    CmbStationType.Hidden  = true;
                    TxtQStationName.Hidden = true;
                    CmbDevice.Hidden       = true;
                    CmbDeviceRecord.Hidden = true;
                    CmbStation.Hidden      = true;
                    CompositeField1.Hidden = true;

                    //StringBuilder mySqlBuild = new StringBuilder("STATION_ID,MCHANNELID,RCHANNELID,MASTERID,ISUSE,DIRECTION_ID");
                    //string mySql = mySqlBuild.ToString();

                    DataTable dt2 = deviceManager.GetCctvSetting("*", " id = '" + id + "'");

                    if (dt2 != null)
                    {
                        if (dt2.Rows.Count > 0)
                        {
                            this.StoreDirection.DataSource = tgsPproperty.GetDirectionInfoByStation(dt2.Rows[0]["col1"].ToString());
                            this.StoreDirection.DataBind();
                            MNumChannel.Text = dt2.Rows[0]["col5"].ToString();
                            RNumChannel.Text = dt2.Rows[0]["col18"].ToString();
                            TxtMasterId.Text = dt2.Rows[0]["col31"].ToString();

                            CmbIsuse.Value     = dt2.Rows[0]["col32"].ToString();
                            CmbDirection.Value = dt2.Rows[0]["col3"].ToString();
                        }
                    }
                    Button5.Hidden = false;
                    DataRow[] dr = dt2.Select("col0='" + id + "'");
                    jktdh = dr[0]["col5"].ToString();
                    hftdh = dr[0]["col18"].ToString();
                    ssfx  = dr[0]["col4"].ToString();
                    jzbh  = dr[0]["col31"].ToString();
                    DataRow[] dr1 = dtsfsy.Select("col0='" + dt2.Rows[0]["col32"].ToString() + "'");
                    sgqy = dr1[0]["col1"].ToString();
                    Window4.Show();
                }
            }
            catch (Exception ex)
            {
                ILog.WriteErrorLog(ex);
                logManager.InsertLogError("CCTVStationManager.aspx-Modify", ex.Message + ";" + ex.StackTrace, "Modify has an exception");
            }
        }
        public void Modify()
        {
            try
            {
                Ext.Net.SelectedListItem ss;
                RowSelectionModel        sm = this.GridDeviceManager.SelectionModel.Primary as RowSelectionModel;
                if (sm.SelectedRow != null)
                {
                    string id = sm.SelectedRow.RecordID;
                    HidSaveFlag.Value         = "2";
                    Window4.Title             = GetLangStr("TGSStationManager64", "修改连接设备信息");
                    CmbDevice.AllowBlank      = true;
                    CmbStationType.AllowBlank = true;
                    HiddenId.Value            = id;
                    CmbStationType.Reset();
                    MulCmbAppFlag.Reset();
                    TxtQStationName.Reset();
                    CmbDevice.Reset();
                    CmbDirection.Reset();
                    CmbStation.Reset();
                    NumChannel.Reset();
                    CmbIsSacn.Reset();
                    TxtImagePath.Reset();
                    TxtIpaddress.Reset();
                    NumPort.Reset();
                    CmbIsuse.Reset();
                    ButQuery.Hidden        = true;
                    CmbStationType.Hidden  = true;
                    TxtQStationName.Hidden = true;
                    CmbDevice.Hidden       = true;
                    CmbStation.Hidden      = true;
                    CompositeField1.Hidden = true;
                    DataTable dt2 = deviceManager.GetTGSSetting("*", " id = '" + id + "'");
                    MulCmbAppFlag.SelectedItems.Clear();
                    if (dt2 != null)
                    {
                        if (dt2.Rows.Count > 0)
                        {
                            this.StoreDirection.DataSource = tgsPproperty.GetDirectionInfoByStation(dt2.Rows[0]["col2"].ToString());
                            this.StoreDirection.DataBind();
                            NumChannel.Text   = dt2.Rows[0]["col8"].ToString();
                            CmbIsSacn.Value   = dt2.Rows[0]["col10"].ToString();
                            TxtImagePath.Text = dt2.Rows[0]["col9"].ToString();
                            TxtIpaddress.Text = dt2.Rows[0]["col14"].ToString();
                            string port = dt2.Rows[0]["col13"].ToString();
                            if (!string.IsNullOrEmpty(port))
                            {
                                NumPort.Text = dt2.Rows[0]["col13"].ToString();
                            }
                            CmbIsuse.Value     = dt2.Rows[0]["col15"].ToString();
                            CmbDirection.Value = dt2.Rows[0]["col16"].ToString();
                            string   appflag  = dt2.Rows[0]["col20"].ToString();
                            string[] appflags = appflag.Split(',');
                            for (int i = 0; i < appflags.Length; i++)
                            {
                                Ext.Net.SelectedListItem si = new SelectedListItem(appflags[i]);
                                ss = si;
                                MulCmbAppFlag.SelectedItems.Add(si);
                            }
                            MulCmbAppFlag.Render();
                        }
                    }
                    DataRow[] dr = dtsbmc.Select("col0='" + id + "'");
                    sbtd = NumChannel.Text;

                    DataRow[] drs = dtsfqy.Select("col0='" + dt2.Rows[0]["col10"].ToString() + "'");
                    //CmbIsSacn.SelectedItem.Text;
                    sfwjsm = drs[0]["col1"].ToString();
                    DataRow[] dr2 = dttype.Select("col0='" + dt2.Rows[0]["col15"].ToString() + "'");
                    sfsy   = dr2[0]["col1"].ToString();
                    tpbclj = TxtImagePath.Text;
                    bdljip = TxtIpaddress.Text;
                    bdljdk = NumPort.Text;
                    ssfx   = dt2.Rows[0]["col17"].ToString();
                    string sygzs = GetMultiCombo(MulCmbAppFlag.SelectedItems);
                    if (sygzs.Contains(","))
                    {
                        string[] sygz = sygzs.Split(',');
                        for (int i = 0; i < sygz.Length; i++)
                        {
                            DataRow[] dt3 = dtsygz.Select("col0='" + sygz[i] + "'");
                            sytrgz = sytrgz + "[" + dt3[0]["col1"].ToString() + "]";
                        }
                    }
                    else
                    {
                        DataRow[] dt3 = dtsygz.Select("col0='" + sygzs + "'");
                        sytrgz = sytrgz + "[" + dt3[0]["col1"].ToString() + "]";
                    }

                    //sytrgz = MulCmbAppFlag.Value.ToString();
                    Button5.Hidden = false;
                    Window4.Show();
                }
            }
            catch (Exception ex)
            {
                ILog.WriteErrorLog(ex);
                logManager.InsertLogError("TGSStationManager.aspx-Modify", ex.Message + ";" + ex.StackTrace, "Modify  has an exception");
            }
        }