Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //判断权限
            if (!CheckGrant(global::Common.Enum.TravelPermission.短信中心_短信中心_栏目))
            {
                Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.短信中心_短信中心_栏目, true);
                return;
            }
            //当前操作
            string method = Utils.GetFormValue("method");

            //验证或发送
            if (method == "valid" || method == "send")
            {
                #region 发送短信

                #region 获取发送手机号并验证
                List <EyouSoft.Model.SMSStructure.AcceptMobileInfo> moibleList = new List <EyouSoft.Model.SMSStructure.AcceptMobileInfo>();
                string[]      moibleArr  = Utils.InputText(Utils.GetFormValue("txtMobiles")).Split(',', ',');
                StringBuilder errBuilder = new StringBuilder();
                string        resultMess = string.Empty;
                bool          result     = false;
                foreach (string mobile in moibleArr)
                {
                    if (!Utils.IsMobile(mobile))//验证手机格式如果不正确则输出错误手机号
                    {
                        errBuilder.AppendFormat("{0},", mobile);
                    }
                    else
                    {
                        EyouSoft.Model.SMSStructure.AcceptMobileInfo mobileInfo = new EyouSoft.Model.SMSStructure.AcceptMobileInfo();
                        mobileInfo.IsEncrypt = false;
                        mobileInfo.Mobile    = mobile;
                        moibleList.Add(mobileInfo);
                    }
                }
                resultMess = errBuilder.ToString();
                EyouSoft.BLL.SMSStructure.SendMessage sendBll = new EyouSoft.BLL.SMSStructure.SendMessage();
                string smsContent  = Utils.InputText(Utils.GetFormValue("textContent"));
                string forbidWords = sendBll.IsIncludeKeyWord(smsContent);//获取禁止发送的词
                if (!String.IsNullOrEmpty(forbidWords))
                {
                    resultMess += "短信包含禁止发送的关键词:" + forbidWords;
                }
                #endregion

                //如果验证手机格式都通过则发送
                if (resultMess == "")
                {
                    #region 构造短息信息实体
                    //发送实体
                    EyouSoft.Model.SMSStructure.SendMessageInfo sendMessageInfo = new EyouSoft.Model.SMSStructure.SendMessageInfo();
                    //发信人公司ID
                    sendMessageInfo.CompanyId = CurrentUserCompanyID;
                    //发信人公司名
                    sendMessageInfo.CompanyName = SiteUserInfo.CompanyName;
                    //发送通道
                    sendMessageInfo.SendChannel = new EyouSoft.Model.SMSStructure.SMSChannelList()[Utils.GetInt(Utils.GetFormValue(this.selChannel.UniqueID))];
                    //发送类型
                    sendMessageInfo.SendType = (EyouSoft.Model.SMSStructure.SendType)Utils.GetInt(Utils.GetFormValue("selSendType"));
                    //发送时间
                    sendMessageInfo.SendTime = DateTime.Now;
                    if (sendMessageInfo.SendType == EyouSoft.Model.SMSStructure.SendType.定时发送)
                    {
                        sendMessageInfo.SendTime = Utils.GetDateTime(Utils.GetFormValue("txtSendTime"));
                    }
                    //短信内容
                    sendMessageInfo.SMSContent = smsContent;
                    //号码集合
                    sendMessageInfo.Mobiles = moibleList;
                    //发送ID
                    sendMessageInfo.UserId = SiteUserInfo.ID;
                    //发信人姓名(如果勾选了发信人)
                    if (Utils.GetFormValue("chkSender") == "hasSender")
                    {
                        sendMessageInfo.UserFullName = Utils.GetFormValue("txtSender");
                    }
                    #endregion
                    //初始化发送bll

                    if (method == "valid")
                    {
                        #region 发送短信之前验证
                        //发送短信之前验证,返回验证结果实体
                        EyouSoft.Model.SMSStructure.SendResultInfo resultInfoBefore = sendBll.ValidateSend(sendMessageInfo);
                        if (resultInfoBefore != null)
                        {
                            result = resultInfoBefore.IsSucceed;
                            if (resultInfoBefore.IsSucceed == true)
                            {
                                //验证成功返回帐户余额以及此次所要发送的短信条数
                                resultMess = string.Format("1@您的账户当前余额为:{0},此次消费金额为:{1},将共发送短信{2}条!是否确定发送短信?"
                                                           , resultInfoBefore.AccountMoney.ToString("C2")
                                                           , resultInfoBefore.CountFee.ToString("C2")
                                                           , (resultInfoBefore.WaitSendMobileCount + resultInfoBefore.WaitSendPHSCount).ToString());
                            }
                            else if (resultInfoBefore.ErrorMessage.IndexOf("余额不足") > -1)
                            {
                                //余额不足
                                resultMess = "@0" + resultInfoBefore.ErrorMessage;
                            }
                            else
                            {  //其他错误
                                resultMess = "@2" + resultInfoBefore.ErrorMessage;
                            }
                        }
                        #endregion
                    }
                    else
                    {
                        #region 执行发送
                        //执行发送,返回发送结果实体
                        EyouSoft.Model.SMSStructure.SendResultInfo resultInfo = sendBll.Send(sendMessageInfo);
                        if (resultInfo != null)
                        {
                            result = resultInfo.IsSucceed;
                            if (resultInfo.IsSucceed == true)
                            {
                                //发送成功
                                decimal costFee = sendMessageInfo.SendType == EyouSoft.Model.SMSStructure.SendType.直接发送 ? resultInfo.SendFee : resultInfo.CountFee;
                                resultMess = "ok@您本次共发送短信" + sendMessageInfo.SMSContentSendComplete.Length + "个字" + (!string.IsNullOrEmpty(sendMessageInfo.UserFullName) ? "(包含发信人)" : "") + "!发送移动、联通共" + resultInfo.MobileSendNumberCount + "个号码、发送小灵通共" + resultInfo.PHSSendNumberCount + "个号码、实际共消费金额为:" + costFee.ToString("C2") + "、实际发送短信" + (resultInfo.MobileSendCount + resultInfo.PHSSendCount) + "条";
                            }
                            else if (resultInfo.ErrorMessage.IndexOf("余额不足") > -1)
                            {   //余额不足
                                resultMess = "0@" + resultInfo.ErrorMessage;
                            }
                            else
                            {   //其他错误
                                resultMess = "2@" + resultInfo.ErrorMessage;
                            }
                        }
                        #endregion
                    }
                }
                else
                {
                    //手机格式未通过输出消息
                    resultMess = "0@" + resultMess;
                    result     = false;
                }
                Utils.ResponseMeg(result, resultMess);
                #endregion
            }
            else
            {
                #region 初次加载
                //获取账户余额,如果少于等于0则显示充值按钮和短信提示信息
                //用户账户Bll
                EyouSoft.BLL.SMSStructure.Account accountBll = new EyouSoft.BLL.SMSStructure.Account();
                decimal accountMoney = accountBll.GetAccountMoney(CurrentUserCompanyID);
                if (accountMoney <= 0)
                {
                    showPay           = "style='display:none'";
                    remainNum.Text    = "你的短信剩余条数为0!";
                    remainNum.Visible = true;
                    showPay           = "style='display:none'";
                }
                InitSendChannel();
                #endregion
            }
        }
Пример #2
0
        private string FormSave()
        {
            //声明操作BLL
            EyouSoft.IBLL.NewTourStructure.IPowderList tourBll = EyouSoft.BLL.NewTourStructure.BPowderList.CreateInstance();
            //创建新的订单
            EyouSoft.Model.NewTourStructure.MTourOrder orderModel = new EyouSoft.Model.NewTourStructure.MTourOrder();

            string tourID = Utils.GetQueryStringValue("tourID");
            //成人数
            int adultCount = Utils.GetInt(Utils.GetFormValue(this.txtAdultCount.UniqueID));

            if (adultCount == 0)
            {
                return("请输入成人数!");
            }
            //儿童数
            int childCount = Utils.GetInt(Utils.GetFormValue(this.txtChildCount.UniqueID));
            //单房差
            int otherCount = Utils.GetInt(Utils.GetFormValue(this.txtOtherCount.UniqueID));
            //游客联系人
            string contact = Utils.GetFormValue(this.txtContact.UniqueID);
            //游客联系电话
            string conTactTel = Utils.GetFormValue(this.txtConTactTel.UniqueID);
            //负责人
            string fzr = Utils.GetFormValue(this.txtFzr.UniqueID);

            if (fzr == "")
            {
                fzr = SiteUserInfo.ContactInfo.ContactName;
            }
            //负责人电话
            string fzrTel = Utils.GetFormValue(this.txtFzrTel.UniqueID);

            if (fzrTel == "")
            {
                fzrTel = SiteUserInfo.ContactInfo.Tel;
            }
            //增减价格
            decimal addPrice = 0;

            decimal.TryParse(Utils.GetFormValue(this.txtAddPrice.UniqueID), out addPrice);
            //增减结算价
            decimal reductPrice = 0;

            decimal.TryParse(Utils.GetFormValue(this.txtReductPrice.UniqueID), out reductPrice);
            //游客备注
            string cusRemark = Utils.GetFormValue(this.txtCusRemark.UniqueID);
            //组团备注
            string remark = Utils.GetFormValue(this.txtRemark.UniqueID);

            #region 处理旅客
            string[] txtName    = Utils.GetFormValues("txtName");
            string[] txtTel     = Utils.GetFormValues("txtTel");
            string[] txtCard    = Utils.GetFormValues("txtCard");
            string[] txtCardS   = Utils.GetFormValues("txtCardS");
            string[] txtCardT   = Utils.GetFormValues("txtCardT");
            string[] sltSex     = Utils.GetFormValues("sltSex");
            string[] sltChild   = Utils.GetFormValues("sltChild");
            string[] txtNumber  = Utils.GetFormValues("txtNumber");
            string[] txtRemarks = Utils.GetFormValues("txtRemarks");
            string[] cbxVisitor = Utils.GetFormValues("cbxVisitor");


            IList <EyouSoft.Model.NewTourStructure.MTourOrderCustomer> customerList = new List <EyouSoft.Model.NewTourStructure.MTourOrderCustomer>();

            if (txtName.Length > 0)
            {
                for (int i = 0; i < txtName.Length; i++)
                {
                    EyouSoft.Model.NewTourStructure.MTourOrderCustomer model = new EyouSoft.Model.NewTourStructure.MTourOrderCustomer();
                    model.CertificatesType = EyouSoft.Model.TicketStructure.TicketCardType.身份证;
                    model.CompanyId        = SiteUserInfo.CompanyID;
                    if (cbxVisitor.Contains((i + 1).ToString()))
                    {
                        model.IsSaveToTicketVistorInfo = true;
                    }
                    model.Mobile       = txtTel[i];
                    model.CradType     = sltChild[i] == "0" ? EyouSoft.Model.TicketStructure.TicketVistorType.成人 : EyouSoft.Model.TicketStructure.TicketVistorType.儿童;
                    model.IdentityCard = txtCard[i];
                    model.IssueTime    = DateTime.Now;
                    model.Notes        = txtRemarks[i];
                    model.OtherCard    = txtCardT[i];
                    model.Passport     = txtCardS[i];
                    model.Sex          = sltSex[i] == "0" ? EyouSoft.Model.CompanyStructure.Sex.男 : EyouSoft.Model.CompanyStructure.Sex.女;
                    model.SiteNo       = txtNumber[i];
                    model.VisitorName  = txtName[i];
                    customerList.Add(model);
                }
            }
            #endregion

            #region 订单实体赋值
            orderModel.Add       = addPrice;
            orderModel.AdultNum  = adultCount;
            orderModel.Reduction = reductPrice;
            #region 获得计划中价格信息
            decimal reAdultPrice = 0;
            decimal reChilePrice = 0;
            decimal reOtherPrice = 0;
            decimal seAdultPrice = 0;
            decimal seChildPrice = 0;

            EyouSoft.Model.NewTourStructure.MPowderList tourModel = tourBll.GetModel(tourID);
            if (tourModel != null)
            {
                reAdultPrice = tourModel.RetailAdultPrice;
                reChilePrice = tourModel.RetailChildrenPrice;
                reOtherPrice = tourModel.MarketPrice;
                seAdultPrice = tourModel.SettlementAudltPrice;
                seChildPrice = tourModel.SettlementChildrenPrice;

                //订单实体赋值
                orderModel.BusinessNotes = "";
                orderModel.DayNum        = tourModel.Day;
                orderModel.LateNum       = tourModel.Late;
                orderModel.LeaveDate     = tourModel.LeaveDate;
                orderModel.RouteId       = tourModel.RouteId;
                orderModel.RouteName     = tourModel.RouteName;
                orderModel.ScheduleNum   = tourModel.OrderPeopleNum;
                orderModel.TourId        = tourModel.TourId;
                orderModel.TourNo        = tourModel.TourNo;
            }
            else
            {
                Response.Clear();
                Response.Write("error");
                Response.End();
            }
            #endregion
            orderModel.ChildPrice              = reChilePrice;
            orderModel.ChildrenNum             = childCount;
            orderModel.Customers               = customerList;
            orderModel.IssueTime               = DateTime.Now;
            orderModel.MarketPrice             = reOtherPrice;
            orderModel.OperationMsg            = "";
            orderModel.OperatorId              = SiteUserInfo.ID;
            orderModel.OperatorName            = SiteUserInfo.ContactInfo.ContactName;
            orderModel.OrderStatus             = EyouSoft.Model.NewTourStructure.PowderOrderStatus.组团社待处理;
            orderModel.PaymentStatus           = EyouSoft.Model.NewTourStructure.PaymentStatus.游客未支付;
            orderModel.PersonalPrice           = reAdultPrice;
            orderModel.SaveDate                = null;
            orderModel.SettlementAudltPrice    = seAdultPrice;
            orderModel.SettlementChildrenPrice = seChildPrice;
            orderModel.SingleRoomNum           = otherCount;
            orderModel.VisitorNotes            = cusRemark;
            orderModel.Travel         = SiteUserInfo.CompanyID;
            orderModel.TravelContact  = fzr;
            orderModel.TravelName     = SiteUserInfo.CompanyName;
            orderModel.TravelNotes    = remark;
            orderModel.TravelTel      = fzrTel;
            orderModel.VisitorContact = contact;
            orderModel.VisitorNotes   = cusRemark;
            orderModel.VisitorTel     = conTactTel;
            //计划销售总价
            orderModel.TotalSalePrice = adultCount * reAdultPrice + childCount * reChilePrice + otherCount * reOtherPrice + addPrice;
            //计算结算总价
            orderModel.TotalSettlementPrice = adultCount * seAdultPrice + childCount * seChildPrice + reductPrice;

            if (EyouSoft.BLL.NewTourStructure.BTourOrder.CreateInstance().AddOrUpdTourOrder(orderModel))
            {
                #region 发送短信模块
                EyouSoft.Model.SystemStructure.MSysSettingInfo SettingInfoModel = EyouSoft.BLL.SystemStructure.SystemInfo.CreateInstance().GetSysSetting();
                //获得组团公司实体
                EyouSoft.Model.CompanyStructure.CompanyDetailInfo travelComModel = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetModel(SiteUserInfo.CompanyID);
                ////获得专线或地接公司实体
                EyouSoft.Model.CompanyStructure.CompanyDetailInfo tourComModel = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetModel(tourModel.Publishers);
                if (SettingInfoModel != null && travelComModel != null && tourComModel != null)
                {
                    if (SettingInfoModel.OrderSmsCompanyTypes.Contains(travelComModel.CompanyLev))
                    {
                        string sendMsg = SettingInfoModel.OrderSmsTemplate;
                        sendMsg = sendMsg.Replace("[预订公司]", SiteUserInfo.CompanyName);
                        sendMsg = sendMsg.Replace("[预订联系电话]", SiteUserInfo.ContactInfo.Mobile);
                        sendMsg = sendMsg.Replace("[预订出发时间]", tourModel.LeaveDate.ToString("yyyy-MM-dd"));
                        sendMsg = sendMsg.Replace("[预订产品]", tourModel.RouteName);
                        sendMsg = sendMsg.Replace("[预订数量]", orderModel.AdultNum.ToString() + "成," + orderModel.ChildrenNum.ToString() + "儿");

                        #region 发送操作
                        EyouSoft.Model.SMSStructure.SendMessageInfo sendMessageInfo = new EyouSoft.Model.SMSStructure.SendMessageInfo();
                        sendMessageInfo.CompanyId    = orderModel.Travel;
                        sendMessageInfo.CompanyName  = orderModel.TravelName;
                        sendMessageInfo.UserId       = this.SiteUserInfo.ID;
                        sendMessageInfo.UserFullName = SiteUserInfo.ContactInfo.ContactName;
                        sendMessageInfo.SMSContent   = sendMsg;
                        sendMessageInfo.SendTime     = DateTime.Now;
                        //添加要发送的手机号码
                        List <EyouSoft.Model.SMSStructure.AcceptMobileInfo> moblieList  = new List <EyouSoft.Model.SMSStructure.AcceptMobileInfo>();
                        EyouSoft.Model.SMSStructure.AcceptMobileInfo        mobileModel = new EyouSoft.Model.SMSStructure.AcceptMobileInfo();
                        mobileModel.IsEncrypt = false;
                        if (tourComModel.ContactInfo != null)
                        {
                            mobileModel.Mobile = tourComModel.ContactInfo.Mobile;
                        }
                        moblieList.Add(mobileModel);
                        sendMessageInfo.Mobiles = moblieList;

                        //发送通道
                        EyouSoft.Model.SMSStructure.SMSChannel sendChannel = new EyouSoft.Model.SMSStructure.SMSChannelList()[Convert.ToInt32(SettingInfoModel.OrderSmsChannelIndex)];
                        sendMessageInfo.SendChannel = sendChannel;
                        sendMessageInfo.SendType    = EyouSoft.Model.SMSStructure.SendType.直接发送;
                        EyouSoft.IBLL.SMSStructure.ISendMessage    sBll            = EyouSoft.BLL.SMSStructure.SendMessage.CreateInstance();
                        EyouSoft.Model.SMSStructure.SendResultInfo SendResultModel = sBll.Send(sendMessageInfo);
                        SendResultModel = null;
                        sendMessageInfo = null;

                        #endregion
                    }
                }
                #endregion
                return("ok");
            }
            else
            {
                return("服务器忙,请稍后再试!");
            }
            #endregion
        }
Пример #3
0
        /// <summary>
        /// 保存
        /// </summary>
        private void Save()
        {
            routeId = Utils.GetQueryStringValue("routeId");
            tourId  = Utils.GetQueryStringValue("tourId");
            if (tourId.Length <= 0 && routeId.Length > 0)
            {
                #region 组团社-单团预定
                MTourList model   = new MTourList();
                MRoute    brModel = BRoute.CreateInstance().GetModel(routeId);
                //线路Id
                model.RouteId = routeId;
                //线路名称
                model.RouteName = brModel.RouteName;
                //下单人编号
                model.OperatorId = SiteUserInfo.ID;
                //下单人名称
                model.OperatorName = SiteUserInfo.UserName;
                //下单时间
                model.IssueTime = DateTime.Now;
                //预定人数
                model.ScheduleNum = Utils.GetInt(Utils.GetFormValue(txt_adultPrice.UniqueID));
                //组团社备注
                model.TravelNotes = Utils.GetFormValue(txt_travelNotes.UniqueID);
                //组团社联系人
                model.TravelContact = Utils.GetFormValue(txt_travelContact.UniqueID);
                //组团社联系人电话
                model.TravelTel = Utils.GetFormValue(txt_travelTel.UniqueID);
                //游客联系人
                model.VisitorContact = Utils.GetFormValue(txt_visitorContact.UniqueID);
                //游客联系人电话
                model.VisitorTel = Utils.GetFormValue(txt_visitorTel.UniqueID);
                //出发日期
                model.StartDate = Utils.GetDateTime(Utils.GetFormValue(txt_leaveDate.UniqueID));
                //预订公司编号
                model.Travel = SiteUserInfo.CompanyID;
                //发布线路专线商或地接社公司编号
                model.Business = Utils.GetQueryStringValue("companyID");
                bool isSave = BTourList.CreateInstance().AddTourList(model);

                #region 发送短信模块
                if (isSave)
                {
                    EyouSoft.Model.SystemStructure.MSysSettingInfo SettingInfoModel = EyouSoft.BLL.SystemStructure.SystemInfo.CreateInstance().GetSysSetting();
                    //获得组团公司实体
                    EyouSoft.Model.CompanyStructure.CompanyDetailInfo travelComModel = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetModel(SiteUserInfo.CompanyID);
                    ////获得专线或地接公司实体
                    EyouSoft.Model.CompanyStructure.CompanyDetailInfo tourComModel = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetModel(brModel.Publishers);
                    if (SettingInfoModel != null && travelComModel != null)
                    {
                        if (SettingInfoModel.OrderSmsCompanyTypes.Contains(travelComModel.CompanyLev))
                        {
                            string sendMsg = SettingInfoModel.OrderSmsTemplate;
                            sendMsg = sendMsg.Replace("[预订公司]", SiteUserInfo.CompanyName);
                            sendMsg = sendMsg.Replace("[预订联系电话]", SiteUserInfo.ContactInfo.Mobile);
                            sendMsg = sendMsg.Replace("[预订出发时间]", model.StartDate.ToString("yyyy-MM-dd"));
                            sendMsg = sendMsg.Replace("[预订产品]", model.RouteName);
                            sendMsg = sendMsg.Replace("[预订数量]", model.ScheduleNum.ToString() + "人");

                            #region 发送操作
                            EyouSoft.Model.SMSStructure.SendMessageInfo sendMessageInfo = new EyouSoft.Model.SMSStructure.SendMessageInfo();
                            sendMessageInfo.CompanyId    = SiteUserInfo.CompanyID;
                            sendMessageInfo.CompanyName  = SiteUserInfo.CompanyName;
                            sendMessageInfo.UserId       = this.SiteUserInfo.ID;
                            sendMessageInfo.UserFullName = SiteUserInfo.ContactInfo.ContactName;
                            sendMessageInfo.SMSContent   = sendMsg;
                            sendMessageInfo.SendTime     = DateTime.Now;
                            //添加要发送的手机号码
                            List <EyouSoft.Model.SMSStructure.AcceptMobileInfo> moblieList  = new List <EyouSoft.Model.SMSStructure.AcceptMobileInfo>();
                            EyouSoft.Model.SMSStructure.AcceptMobileInfo        mobileModel = new EyouSoft.Model.SMSStructure.AcceptMobileInfo();
                            mobileModel.IsEncrypt = false;
                            if (tourComModel.ContactInfo != null)
                            {
                                mobileModel.Mobile = tourComModel.ContactInfo.Mobile;
                            }
                            moblieList.Add(mobileModel);
                            sendMessageInfo.Mobiles = moblieList;

                            //发送通道
                            EyouSoft.Model.SMSStructure.SMSChannel sendChannel = new EyouSoft.Model.SMSStructure.SMSChannelList()[Convert.ToInt32(SettingInfoModel.OrderSmsChannelIndex)];
                            sendMessageInfo.SendChannel = sendChannel;
                            sendMessageInfo.SendType    = EyouSoft.Model.SMSStructure.SendType.直接发送;
                            EyouSoft.IBLL.SMSStructure.ISendMessage    sBll            = EyouSoft.BLL.SMSStructure.SendMessage.CreateInstance();
                            EyouSoft.Model.SMSStructure.SendResultInfo SendResultModel = sBll.Send(sendMessageInfo);
                            SendResultModel = null;
                            sendMessageInfo = null;

                            #endregion
                        }
                    }
                }
                #endregion

                Response.Clear();
                Response.Write(isSave.ToString().ToLower());
                Response.End();
                #endregion
            }
            else if (tourId.Length > 0)
            {
                #region 组团-地接-专线修改
                MTourList model = BTourList.CreateInstance().GetModel(tourId);
                model.ScheduleNum = Utils.GetInt(Utils.GetFormValue(txt_adultPrice.UniqueID));
                if (Utils.GetQueryStringValue("isZT").Length > 0)
                {
                    //组团修改
                    model.TravelNotes = Utils.GetFormValue(txt_travelNotes.UniqueID);
                    //组团社联系人
                    model.TravelContact = Utils.GetFormValue(txt_travelContact.UniqueID);
                    //组团社联系人电话
                    model.TravelTel = Utils.GetFormValue(txt_travelTel.UniqueID);
                    //游客联系人
                    model.VisitorContact = Utils.GetFormValue(txt_visitorContact.UniqueID);
                    //游客联系人电话
                    model.VisitorTel = Utils.GetFormValue(txt_visitorTel.UniqueID);
                    Response.Clear();
                    Response.Write(BTourList.CreateInstance().OrderModifyZT(model));
                    Response.End();
                }
                else
                {
                    //专线,地接修改
                    model.BusinessNotes = Utils.GetFormValue(txt_businessNotes.UniqueID);
                    Response.Clear();
                    Response.Write(BTourList.CreateInstance().OrderModifyZXDJ(model));
                    Response.End();
                }
                #endregion
            }
        }
Пример #4
0
        /// <summary>
        /// 发送短信
        /// </summary>
        /// <param name="sendMessageInfo">发送短信提交的业务实体</param>
        /// <returns></returns>
        public EyouSoft.Model.SMSStructure.SendResultInfo Send(EyouSoft.Model.SMSStructure.SendMessageInfo sendMessageInfo)
        {
            #region 发送短信验证
            //发送短信验证
            EyouSoft.Model.SMSStructure.SendResultInfo validateResultInfo = this.ValidateSend(sendMessageInfo);

            if (!validateResultInfo.IsSucceed)
            {
                return(validateResultInfo);
            }
            #endregion

            #region 定时发送任务处理
            //定时发送任务处理
            if (sendMessageInfo.SendType == EyouSoft.Model.SMSStructure.SendType.定时发送)
            {
                EyouSoft.Model.SMSStructure.SendPlanInfo plan = new EyouSoft.Model.SMSStructure.SendPlanInfo();

                plan.CompanyId   = sendMessageInfo.CompanyId;
                plan.CompanyName = sendMessageInfo.CompanyName;
                plan.ContactName = sendMessageInfo.UserFullName;
                plan.IssueTime   = DateTime.Now;
                plan.Mobiles     = sendMessageInfo.Mobiles;
                plan.PlanId      = Guid.NewGuid().ToString();
                plan.SendChannel = sendMessageInfo.SendChannel;
                plan.SendTime    = sendMessageInfo.SendTime;
                plan.SMSContent  = sendMessageInfo.SMSContent;
                plan.SMSType     = sendMessageInfo.SMSType;
                plan.UserId      = sendMessageInfo.UserId;

                if (Dal.InsertSendPlan(plan))
                {
                    validateResultInfo.IsSucceed = true;
                }
                else
                {
                    validateResultInfo.IsSucceed    = false;
                    validateResultInfo.ErrorMessage = "写入定时发送计划任务时发生了错误。";
                }

                return(validateResultInfo);
            }
            #endregion

            #region 发送短信处理
            validateResultInfo.TempFeeTakeId = Guid.NewGuid().ToString();
            validateResultInfo.SendTotalId   = Guid.NewGuid().ToString();
            validateResultInfo.SuccessCount
                    = validateResultInfo.ErrorCount
                    = validateResultInfo.TimeoutCount
                    = 0;

            #region 扣除账户金额
            //扣除账户金额
            bool deductAccountMoneyResult = DalAccount.DeductAccountMoney(sendMessageInfo.CompanyId, sendMessageInfo.UserId.ToString(), validateResultInfo.CountFee, 0, validateResultInfo.TempFeeTakeId, validateResultInfo.SendTotalId);

            if (!deductAccountMoneyResult)
            {
                validateResultInfo.IsSucceed    = false;
                validateResultInfo.ErrorMessage = "扣除账户金额时产生了错误,请重试";

                return(validateResultInfo);
            }
            #endregion

            IList <EyouSoft.Model.SMSStructure.SendDetail> sendDetails = new List <EyouSoft.Model.SMSStructure.SendDetail>();

            //发送[移动、联通]内容实际计算费用短信条数
            int mobielFactCount = this.GetSmsTotalCount(sendMessageInfo.SMSContentSendComplete, EyouSoft.Model.SMSStructure.SMSNoType.Mobiel, sendMessageInfo.SendChannel);
            //发送[小灵通]内容实际计算费用短信条数
            int phsFactCount = this.GetSmsTotalCount(sendMessageInfo.SMSContentSendComplete, EyouSoft.Model.SMSStructure.SMSNoType.PHS, sendMessageInfo.SendChannel);

            #region 调用发送短信接口
            //每次调用发送接口时待发送的手机号码
            StringBuilder waitMobiles = new StringBuilder();
            //每次调用发送接口时的最大发送号码个数
            int waitCanMobilesMax = 100;
            //总的要发送的手机号码个数
            int waitMobileLength = sendMessageInfo.Mobiles.Count;
            int indexStart       = 0;
            for (int indexC = 0; indexC < waitMobileLength; indexC++)
            {
                EyouSoft.Model.SMSStructure.SendDetail       sendDetailInfo = new EyouSoft.Model.SMSStructure.SendDetail();
                EyouSoft.Model.SMSStructure.AcceptMobileInfo mobile         = sendMessageInfo.Mobiles[indexC];

                sendDetailInfo.ID           = Guid.NewGuid().ToString();
                sendDetailInfo.MobileNumber = mobile.Mobile;
                sendDetailInfo.IsPHS        = this.IsPHS(mobile.Mobile);
                sendDetailInfo.IsEncrypt    = mobile.IsEncrypt;

                if (!sendDetailInfo.IsPHS)
                {
                    sendDetailInfo.FactCount = mobielFactCount;
                }
                else
                {
                    sendDetailInfo.FactCount = phsFactCount;
                }

                //添加到集合中
                sendDetails.Add(sendDetailInfo);

                waitMobiles.AppendFormat("{0},", mobile.Mobile);

                #region 判断是否开始发送短信
                if ((indexC + 1) % waitCanMobilesMax == 0 || (indexC + 1) == waitMobileLength)
                {
                    int    sendResult = 0;
                    string sendMsg    = "";

                    try
                    {
                        string sendMessageContent = sendMessageInfo.SMSContentSendComplete;

                        sms.Timeout = 1000;
                        //发送结果返回值 返回int类型的0时成功 返回对应的负数时失败
                        sendResult = sms.SendSms(this.EnterpriseId, waitMobiles.ToString().TrimEnd(",".ToCharArray()), sendMessageInfo.SMSContentSendComplete, sendMessageInfo.SendChannel.UserName, sendMessageInfo.SendChannel.Pw);
                        sendMsg    = this.GetServicesState(sendResult);
                    }
                    catch
                    {
                        sendMsg    = "超时";
                        sendResult = this.SendTimeOutEventCode;
                    }

                    //要发送的号码清空
                    waitMobiles.Remove(0, waitMobiles.Length);

                    #region 处理发送后的结果(处理当次在批量发送内的所有号码)
                    for (int j = indexStart; j <= indexC; j++)
                    {
                        sendDetails[j].ReturnMsg    = sendMsg;
                        sendDetails[j].ReturnResult = sendResult;

                        if (!sendDetails[j].IsPHS)
                        {
                            if (sendResult == this.SendTimeOutEventCode)
                            {
                                validateResultInfo.TimeoutCount = validateResultInfo.TimeoutCount + 1;
                            }
                            else if (sendResult == 0)
                            {
                                validateResultInfo.SuccessCount = validateResultInfo.SuccessCount + 1;
                            }
                            else
                            {
                                validateResultInfo.ErrorCount = validateResultInfo.ErrorCount + 1;
                            }
                        }
                        else
                        {
                            if (sendResult == this.SendTimeOutEventCode)
                            {
                                validateResultInfo.PHSTimeoutCount = validateResultInfo.PHSTimeoutCount + 1;
                            }
                            else if (sendResult == 0)
                            {
                                validateResultInfo.PHSSuccessCount = validateResultInfo.PHSSuccessCount + 1;
                            }
                            else
                            {
                                validateResultInfo.PHSErrorCount = validateResultInfo.PHSErrorCount + 1;
                            }
                        }
                    }
                    #endregion 处理发送后的结果

                    //记录下一批的开始索引号
                    indexStart = indexC + 1;
                }
                #endregion 判断是否开始发送短信
            }
            #endregion

            //写入短信发送明细及统计信息,同时更新账户余额
            Dal.InsertSendInfo(sendMessageInfo, sendDetails, validateResultInfo);

            //计算发送短信后实际扣除的消费金额(预扣除金额-发送超时的手机或者小灵通短信条数*1个短信的实际条数*单价)
            validateResultInfo.SendFee = validateResultInfo.CountFee - 0.01M * validateResultInfo.TimeoutCount * validateResultInfo.FactCount * sendMessageInfo.SendChannel.PriceOne - 0.01M * validateResultInfo.PHSTimeoutCount * validateResultInfo.PHSFactCount * sendMessageInfo.SendChannel.PriceOne;
            #endregion

            return(validateResultInfo);
        }
Пример #5
0
        /// <summary>
        /// 根据指定条件获取接收短信号码
        /// </summary>
        /// <param name="companyId">公司编号</param>
        /// <param name="customerCompanyName">客户公司名称 为空时不做为查询条件</param>
        /// <param name="customerUserFullName">客户联系人姓名 为空时不做为查询条件</param>
        /// <param name="mobile">手机号码 为空时不做为查询条件</param>
        /// <param name="categoryId">客户类型编号 -1时不做为查询条件</param>
        /// <param name="source">客户来源</param>
        /// <param name="provinceId">省份ID</param>
        /// <param name="cityId">城市ID</param>
        /// <returns></returns>
        public virtual IList <EyouSoft.Model.SMSStructure.AcceptMobileInfo> GetMobiles(string companyId, string mobile, int categoryId, EyouSoft.Model.SMSStructure.CustomerInfo.CustomerSource source, int provinceId, int cityId)
        {
            IList <EyouSoft.Model.SMSStructure.AcceptMobileInfo> AcceptMobiles = new List <EyouSoft.Model.SMSStructure.AcceptMobileInfo>();

            StringBuilder cmdQuery      = new StringBuilder();
            string        tableName     = "view_SMS_Customers";
            string        primaryKey    = "Id";
            string        orderByString = "IssueTime DESC";
            string        fields        = " ID,ClassID,MobileNumber ";

            cmdQuery.AppendFormat(" select {0} from {1} where", fields, tableName);
            cmdQuery.Append(" 1=1 ");

            switch (source)
            {
            case EyouSoft.Model.SMSStructure.CustomerInfo.CustomerSource.所有客户:      //注意TongYCompanyId<>companyId是用来排除自己的
                cmdQuery.AppendFormat(" AND (CompanyID='{0}' OR CompanyID='0') AND TongYCompanyId <> '{0}' ", companyId);
                break;

            case EyouSoft.Model.SMSStructure.CustomerInfo.CustomerSource.我的客户:
                cmdQuery.AppendFormat(" AND CompanyID='{0}' ", companyId);
                break;

            case EyouSoft.Model.SMSStructure.CustomerInfo.CustomerSource.平台组团社客户:    //注意TongYCompanyId<>companyId是用来排除自己的
                cmdQuery.AppendFormat(" AND CompanyID='0' AND TongYCompanyId <> '{0}' ", companyId);
                break;
            }

            if (provinceId > 0)
            {
                cmdQuery.AppendFormat(" AND ProvinceId={0}", provinceId);
            }

            if (cityId > 0)
            {
                cmdQuery.AppendFormat(" AND CityId={0}", cityId);
            }

            if (!string.IsNullOrEmpty(mobile))
            {
                cmdQuery.AppendFormat(" AND (MobileNumber LIKE '%{0}%')", mobile);
            }

            if (categoryId != -1 && categoryId != 0)
            {
                cmdQuery.AppendFormat(" AND ClassID={0}", categoryId.ToString());
            }

            DbCommand cmd = base.SMSStore.GetSqlStringCommand(cmdQuery.ToString());

            cmd.CommandType = CommandType.Text;

            using (IDataReader rdr = DbHelper.ExecuteReader(cmd, base.SMSStore))
            {
                EyouSoft.Model.SMSStructure.AcceptMobileInfo model = null;

                while (rdr.Read())
                {
                    model        = new EyouSoft.Model.SMSStructure.AcceptMobileInfo();
                    model.Mobile = rdr.IsDBNull(rdr.GetOrdinal("MobileNumber")) ? "" : rdr.GetString(rdr.GetOrdinal("MobileNumber"));
                    if (rdr.GetString(rdr.GetOrdinal("id")) == "0")
                    {
                        model.IsEncrypt = true;
                    }
                    AcceptMobiles.Add(model);
                }
            }

            return(AcceptMobiles);
        }