Ejemplo n.º 1
0
        /// <summary>
        /// 获取对应课程SMS 接收人电话(分教练或学员)
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="personType"></param>
        /// <returns></returns>
        private static string GetTelNo(User current, CoachCourse obj, CoursePersonType personType)
        {
            string userid = "";
            string telno  = string.Empty;

            switch (personType)
            {
            case CoursePersonType.Student:
                if (string.IsNullOrEmpty(current.Id))
                {
                    userid = obj.CreatorId;
                }
                else
                {
                    userid = current.Id;
                }
                break;

            case CoursePersonType.Coacher:
                userid = obj.CoachId;
                break;
            }
            User user = UserHelper.GetUserById(userid);

            if (user != null)
            {
                telno = user.Mobile;
            }
            return(telno);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取约课人姓名
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="personType"></param>
        /// <returns></returns>
        private static string GetCourseOrderPerson(User current, CoachCourse obj, CoursePersonType personType)
        {
            string username = "******";

            if (personType == CoursePersonType.Coacher)
            {
                string userid = string.Empty;
                if (string.IsNullOrEmpty(current.Id))
                {
                    userid = obj.CreatorId;
                }
                else
                {
                    userid = current.Id;
                }
                User user = UserHelper.GetUserById(userid);
                if (user != null)
                {
                    username = user.PetName;
                }
            }
            return(username);
        }
Ejemplo n.º 3
0
        /*
         * private static string EnCode = "C50067";
         * private static string EnPass = "******";
         * private static string UrlFormat = "http://www3.mob800.com/interface/Send.aspx?enCode={0}&enPass={1}&userName=sys&mob={2}&msg={3}";
         * private static string Prefix = "【悦动力】";
         *
         * public static string SendSms(string mobiles, string msg)
         * {
         *  string strRet = null;
         *  try
         *  {
         *      string url = string.Format(UrlFormat, EnCode, EnPass, mobiles, HttpUtility.UrlEncode(Prefix + msg, Encoding.GetEncoding("gb2312")));
         *      if (url == null || url.Trim().ToString() == "")
         *      {
         *          return strRet;
         *      }
         *      string targeturl = url.Trim().ToString();
         *      HttpWebRequest hr = (HttpWebRequest)WebRequest.Create(targeturl);
         *      hr.UserAgent = "Mozilla/4.0  (compatible; MSIE 6.0; Windows NT 5.1)";
         *      hr.Method = "GET";
         *      hr.Timeout = 60 * 1000;
         *      hr.Headers.Add("content", "text/html; charset=gb2312");
         *      WebResponse hs = hr.GetResponse();
         *      Stream sr = hs.GetResponseStream();
         *      StreamReader ser = new StreamReader(sr, Encoding.Default);
         *      strRet = ser.ReadToEnd();
         *  }
         *  catch (Exception ex)
         *  {
         *      strRet = ex.Message;
         *  }
         *  return strRet;
         *
         * }
         * */
        /// <summary>
        /// 课程序预约、修改预约时间,取消预约 SMS短信发送
        /// </summary>
        /// <param name="obj">课程预约对象</param>
        /// <returns></returns>
        public static SmsSingleSenderResult SendCourseSms(User current, CoachCourse obj, CoursePersonType personType, CourseSmsType smsType)
        {
            string telNO  = GetTelNo(current, obj, personType);             //移动电话号码
            string param1 = GetCourseOrderPerson(current, obj, personType); //约课人
            string param2 = GetCourseSmsType(smsType);                      //约课动作  增加,修改,取消
            string param3 = GetCourseName(obj);                             //课程类型,大课名称或私教课(教练)
            string param4 = GetCourseSmsDate(obj);                          //上课时间 格式:yyyy年MM月dd日 周  HH:mm


            SmsSingleSenderResult result;

            string[] param = new string[] { param1, param2, param3, param4 };
            result = SingleSend(telNO, courseSmsTemplateId, param);

            return(result);
        }