Пример #1
0
        /// <summary>
        /// 返回所有消息实体
        /// </summary>
        /// <returns></returns>
        private static List<DB_Talk.Model.SMSConfig> GetSMSEntry()
        {
            List<DB_Talk.Model.SMSConfig> lst = new List<DB_Talk.Model.SMSConfig>();

            byte[] bytearray = new byte[1024];
            uint len =(uint) bytearray.Length;
            int tt = 0;
            bool b = MBoxSDK.ConfigSDK.MBOX_GetShortMessageEntity(Global.Params.BoxHandle, bytearray, len, ref tt);
            string strIP = System.Text.Encoding.Default.GetString(bytearray).Replace("\0", "");

            string[] ss = strIP.Split(';');
            foreach (string item in ss)
            {
                string[] pp = item.Split(',');
                if (pp.Length==4)
                {
                    DB_Talk.Model.SMSConfig model = new DB_Talk.Model.SMSConfig();
                    model.SystemID =int.Parse(pp[0]);
                    model.Password = pp[1];
                    model.EmseID =int.Parse( pp[2]);
                    model.RouteID =int.Parse( pp[3]);
                    lst.Add(model);
                }
            }
            return lst;
        }
Пример #2
0
        /// <summary>得到短信配置信息</summary>
        /// <returns></returns>
        public static DB_Talk.Model.SMSConfig GetSMSConfig()
        {
            DB_Talk.Model.SMSConfig model = new DB_Talk.Model.SMSConfig();
            List<string> lstS = new List<string>();
            lstS = GetSMSIP();
            if (lstS.Count>0)
            {
                model.IP = lstS[0];    
            }
            
            List<DB_Talk.Model.SMSConfig> lst = GetSMSEntry();
            if (lst.Count > 0)
            {
                model.SystemID = lst[0].SystemID;
                model.Password = lst[0].Password;
            }

            return model;
        }