public int[] GetChannels(SmsEnterpriseCfgInfo cfg) { if (cfg == null) return new int[0]; if (string.IsNullOrEmpty(cfg.CfgValue)) return new int[0]; string[] array = cfg.CfgValue.Split(','); int[] iArray = new int[array.Length]; for (int a = 0; a < array.Length; a++) { try { iArray[a] = int.Parse(array[a]); } catch (Exception) { } } return iArray; }
public HandlerResponse EnterpriseCfg() { List<SmsEnterpriseCfgInfo> infos = new List<SmsEnterpriseCfgInfo>(); SmsEnterpriseCfgInfo cfgInfo = new SmsEnterpriseCfgInfo(); cfgInfo.CfgKey = "smsprice"; cfgInfo.CfgValue = Request.Params["smsprice"]; cfgInfo.CreateTime = DateTime.Now; cfgInfo.EnterpriseID = int.Parse(Request.Params["enterpriseid"]); infos.Add(cfgInfo); cfgInfo = new SmsEnterpriseCfgInfo(); cfgInfo.CfgKey = "chinamobile"; cfgInfo.CfgValue = Request.Params["chinamobile"]; cfgInfo.CreateTime = DateTime.Now; cfgInfo.EnterpriseID = int.Parse(Request.Params["enterpriseid"]); infos.Add(cfgInfo); cfgInfo = new SmsEnterpriseCfgInfo(); cfgInfo.CfgKey = "union"; cfgInfo.CfgValue = Request.Params["union"]; cfgInfo.CreateTime = DateTime.Now; cfgInfo.EnterpriseID = int.Parse(Request.Params["enterpriseid"]); infos.Add(cfgInfo); cfgInfo = new SmsEnterpriseCfgInfo(); cfgInfo.CfgKey = "cdma"; cfgInfo.CfgValue = Request.Params["cdma"]; cfgInfo.CreateTime = DateTime.Now; cfgInfo.EnterpriseID = int.Parse(Request.Params["enterpriseid"]); infos.Add(cfgInfo); cfgInfo = new SmsEnterpriseCfgInfo(); cfgInfo.CfgKey = "smslength"; cfgInfo.CfgValue = Request.Params["smslength"]; cfgInfo.CreateTime = DateTime.Now; cfgInfo.EnterpriseID = int.Parse(Request.Params["enterpriseid"]); infos.Add(cfgInfo); SmsEnterpriseCfgManage.Instance.AddList(infos); return CreateHandler(1, "修改成功"); }