예제 #1
0
        /// <summary>
        /// 获取
        /// </summary>
        /// <returns></returns>
        public static VideoLinkageModel GetVideoLinkageModel(int did, int pnum)
        {
            VideoLinkageModel model = null;

            if (did > 0 && pnum >= 0)//一代设备的面板号有0的
            {
                string           sql = "SELECT * FROM ipvt_videolinkagetable WHERE DeviceId=?did AND PanelNumber=?pnum;";
                MySqlParameter[] ps  = new MySqlParameter[2];
                ps[0] = new MySqlParameter("?did", did);
                ps[1] = new MySqlParameter("?pnum", pnum);

                MySqlDataReader reader = null;
                try
                {
                    reader = CustomMySqlHelper.ExecuteDataReader(sql, ps);
                    while (reader.Read())
                    {
                        model                   = new VideoLinkageModel();
                        model.Id                = EvaluationHelper.ObjectToInt(reader["ID"]);
                        model.DeviceId          = EvaluationHelper.ObjectToInt(reader["DeviceId"]);
                        model.PanelNumber       = EvaluationHelper.ObjectToInt(reader["PanelNumber"]);
                        model.ChannelNumber     = EvaluationHelper.ObjectToByte(reader["ChannelNumber"]);
                        model.NetConnectMethods = EvaluationHelper.ObjectToByte(reader["NetConnectMethods"]);
                        model.ImgFormat         = EvaluationHelper.ObjectToByte(reader["ImgFormat"]);
                        model.TransmitJur       = EvaluationHelper.ObjectToByte(reader["TransmitJur"]);
                        model.ReceivePort       = EvaluationHelper.ObjectToUshort(reader["ReceivePort"]);
                        model.ForwardingPort    = EvaluationHelper.ObjectToUshort(reader["ForwardingPort"]);
                        model.ServerUserId      = EvaluationHelper.ObjectToString(reader["ServerUserId"]);
                        model.ServerIp          = EvaluationHelper.ObjectToString(reader["ServerIp"]);
                        model.TranServerIp      = EvaluationHelper.ObjectToString(reader["TranServerIp"]);
                        model.UserName          = EvaluationHelper.ObjectToString(reader["UserName"]);
                        model.UserPwd           = EvaluationHelper.ObjectToString(reader["UserPwd"]);
                        model.DeviceType        = EvaluationHelper.ObjectToByte(reader["DeviceType"]);
                        model.UserVerify        = EvaluationHelper.ObjectToString(reader["UserVerify"]);

                        break;
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.MainLog("error in GetVideoLinkageModel!" + ex.Message);
                }
                finally
                {
                    if (reader != null)
                    {
                        reader.Close();                 //读取完关闭reader对象
                    }
                }
            }

            return(model);
        }