Exemplo n.º 1
0
        /// <summary>
        /// 写入短信发送明细及统计信息,并更新账户余额
        /// </summary>
        /// <param name="sendMessageInfo">发送短信提交的业务实体</param>
        /// <param name="sendDetailsInfo">短信发送明细</param>
        /// <param name="sendResultInfo">发送短信/验证发送结果业务实体</param>
        /// <returns></returns>
        public bool InsertSendInfo(EyouSoft.Model.SMSStructure.SendMessageInfo sendMessageInfo, IList <EyouSoft.Model.SMSStructure.SendDetail> sendDetailsInfo, EyouSoft.Model.SMSStructure.SendResultInfo sendResultInfo)
        {
            DbCommand cmd = this._db.GetStoredProcCommand("proc_SMS_InsertSendMessageInfo");

            this._db.AddInParameter(cmd, "SendTotalId", DbType.String, sendResultInfo.SendTotalId);
            this._db.AddInParameter(cmd, "CompanyId", DbType.String, sendMessageInfo.CompanyId);
            this._db.AddInParameter(cmd, "CompanyName", DbType.String, sendMessageInfo.CompanyName);
            this._db.AddInParameter(cmd, "UserId", DbType.String, sendMessageInfo.UserId);
            this._db.AddInParameter(cmd, "UserFullName", DbType.String, sendMessageInfo.UserFullName);
            this._db.AddInParameter(cmd, "SMSType", DbType.Int32, sendMessageInfo.SMSType);
            this._db.AddInParameter(cmd, "SMSContent", DbType.String, sendMessageInfo.SMSContent);
            this._db.AddInParameter(cmd, "UseMoeny", DbType.Decimal, 0.01M * sendMessageInfo.SendChannel.PriceOne);
            this._db.AddInParameter(cmd, "SuccessCount", DbType.Int32, sendResultInfo.SuccessCount);
            this._db.AddInParameter(cmd, "ErrorCount", DbType.Int32, sendResultInfo.ErrorCount);
            this._db.AddInParameter(cmd, "TimeoutCount", DbType.Int32, sendResultInfo.TimeoutCount);
            this._db.AddInParameter(cmd, "FactCount", DbType.Int32, sendResultInfo.FactCount);
            this._db.AddInParameter(cmd, "TempFeeTakeId", DbType.String, sendResultInfo.TempFeeTakeId);
            this._db.AddInParameter(cmd, "SendMessageTime", DbType.DateTime, sendMessageInfo.SendTime);
            this._db.AddInParameter(cmd, "Mobiles", DbType.String, this.CreateSendMessageMobilesXML(sendDetailsInfo));
            this._db.AddOutParameter(cmd, "Result", DbType.Int32, 4);
            this._db.AddInParameter(cmd, "PHSSuccessCount", DbType.Int32, sendResultInfo.PHSSuccessCount);
            this._db.AddInParameter(cmd, "PHSErrorCount", DbType.Int32, sendResultInfo.PHSErrorCount);
            this._db.AddInParameter(cmd, "PHSTimeoutCount", DbType.Int32, sendResultInfo.PHSTimeoutCount);
            this._db.AddInParameter(cmd, "PHSFactCount", DbType.Int32, sendResultInfo.PHSFactCount);
            this._db.AddInParameter(cmd, "SendChannel", DbType.Int32, sendMessageInfo.SendChannel.Index);

            EyouSoft.Toolkit.DAL.DbHelper.RunProcedure(cmd, this._db);

            return(Convert.ToInt32(this._db.GetParameterValue(cmd, "Result")) == 1 ? true : false);
        }
Exemplo n.º 2
0
        public EyouSoft.Model.SMSStructure.SendResultInfo Send(EyouSoft.Model.SMSStructure.SendMessageInfo sendMessageInfo)
        {
            if (!apisoapHeader.IsSafeCall)
            {
                throw new Exception("对不起,您没有权限调用此服务!");
            }

            return(new EyouSoft.BLL.SMSStructure.SendMessage().Send(sendMessageInfo));
        }
Exemplo n.º 3
0
        protected void SendSMSMethod(int typeID)
        {
            #region 获取表单数据
            //单条短信价格
            //SMSDecimal = EyouSoft.Common.ConfigModel.ConfigClass.GetConfigDecimal("SMS_COSTOFSINGLE");
            EyouSoft.IBLL.SMSStructure.ISendMessage sBll = EyouSoft.BLL.SMSStructure.SendMessage.CreateInstance();
            string returnVal = "";
            //bool flag = false;
            List <EyouSoft.Model.SMSStructure.AcceptMobileInfo> list = new List <EyouSoft.Model.SMSStructure.AcceptMobileInfo>();
            string  strErr       = "";
            decimal teleNum      = 0;//号码数量
            string  erroNumber   = "";
            string  sendCustomer = "";
            if (!string.IsNullOrEmpty(Utils.GetFormValue(this.txt_SendPeople.UniqueID).Trim()) && ShowSender.Checked)
            {
                sendCustomer = Utils.GetFormValue(this.txt_SendPeople.UniqueID).Trim();
            }
            string tmpPhoneNo  = Utils.GetFormValue(this.txt_TelePhoneGroup.UniqueID).Trim();
            string tmpSendInfo = "";
            if (!string.IsNullOrEmpty(Utils.GetFormValue(this.txt_SendContent.UniqueID).Trim()))
            {
                tmpSendInfo = Utils.GetFormValue(this.txt_SendContent.UniqueID).Trim();
            }
            DateTime sendTime = DateTime.Now;
            if (!string.IsNullOrEmpty(Utils.GetFormValue("txt_SendSMS_OrderTime")) && StringValidate.IsDateTime(Utils.GetFormValue("txt_SendSMS_OrderTime")))
            {
                sendTime = DateTime.Parse(Utils.GetFormValue("txt_SendSMS_OrderTime"));
            }

            //发送类型
            EyouSoft.Model.SMSStructure.SendType sendType = (EyouSoft.Model.SMSStructure.SendType)Utils.GetInt(Utils.GetFormValue(this.ddl_SendType.UniqueID));
            //发送通道
            EyouSoft.Model.SMSStructure.SMSChannel sendChannel = new EyouSoft.Model.SMSStructure.SMSChannelList()[Utils.GetInt(Utils.GetFormValue(this.ddlSendChannel.UniqueID))];

            //加密手机号码
            string strEncryMobile = Utils.GetFormValue("EncryMobile");
            //有关发送所有的数据
            //isSend: false, dataSource:2, companyName:"",customerType:0, provinceId:0, cityId:0
            bool sendAll_isSend = Convert.ToBoolean(Utils.GetFormValue("isSendAll"));
            EyouSoft.Model.SMSStructure.CustomerInfo.CustomerSource sendAll_dataSource = EyouSoft.Model.SMSStructure.CustomerInfo.CustomerSource.平台组团社客户;
            string sendAll_companyName  = "";
            int    sendAll_customerType = 0;
            int    sendAll_provinceId   = 0;
            int    sendAll_cityId       = 0;
            if (sendAll_isSend)
            {
                sendAll_dataSource   = (EyouSoft.Model.SMSStructure.CustomerInfo.CustomerSource)Convert.ToInt32(Utils.GetFormValue("sendAll.dataSource"));
                sendAll_customerType = Convert.ToInt32(Utils.GetFormValue("sendAll.customerType"));
                sendAll_companyName  = Utils.GetFormValue("sendAll.companyName");
                sendAll_provinceId   = Convert.ToInt32(Utils.GetFormValue("sendAll.provinceId"));
                sendAll_cityId       = Convert.ToInt32(Utils.GetFormValue("sendAll.cityId"));
            }

            #endregion

            #region 数据验证
            if (string.IsNullOrEmpty(tmpSendInfo))
            {
                strErr += "请输入或导入发送内容!" + "\n";
            }
            //验证手机号码
            if (!string.IsNullOrEmpty(tmpPhoneNo))
            {
                tmpPhoneNo = tmpPhoneNo.Replace(',', ',');
                if (tmpPhoneNo.EndsWith(","))
                {
                    tmpPhoneNo = tmpPhoneNo.Substring(0, tmpPhoneNo.Length - 1);
                }
                string[] numberGroup = tmpPhoneNo.Split(',');
                teleNum = numberGroup.Length;
                for (int i = 0; i < teleNum; i++)
                {
                    if (StringValidate.IsMobileOrPHS(numberGroup[i]) == false)
                    {
                        erroNumber += numberGroup[i] + "\n";
                    }
                    else
                    {
                        list.Add(new EyouSoft.Model.SMSStructure.AcceptMobileInfo()
                        {
                            Mobile = numberGroup[i], IsEncrypt = false
                        });
                    }
                }
            }
            //添加加密手机号码
            if (!string.IsNullOrEmpty(strEncryMobile))
            {
                string[] numberGroup = strEncryMobile.Split(',');
                teleNum = numberGroup.Length;
                for (int i = 0; i < teleNum; i++)
                {
                    if (StringValidate.IsMobileOrPHS(numberGroup[i]) == false)
                    {
                        erroNumber += numberGroup[i] + "\n";
                    }
                    else
                    {
                        list.Add(new EyouSoft.Model.SMSStructure.AcceptMobileInfo()
                        {
                            Mobile = numberGroup[i], IsEncrypt = true
                        });
                    }
                }
            }
            //添加发送所有的号码
            if (sendAll_isSend)
            {
                IList <EyouSoft.Model.SMSStructure.AcceptMobileInfo> sendAll_list = EyouSoft.BLL.SMSStructure.Customer.CreateInstance().GetMobiles(CompanyID, "", sendAll_customerType, sendAll_dataSource, sendAll_provinceId, sendAll_cityId);
                if (sendAll_list != null && sendAll_list.Count > 0)
                {
                    list.AddRange(sendAll_list);
                }
            }
            if (list == null || list.Count <= 0)
            {
                strErr += "请输入或导入手机号码!" + "\n";
            }
            if (erroNumber != "")
            {
                strErr += erroNumber + "以上号码格式不正确!" + "\n";
            }
            #endregion

            if (strErr != "")
            {
                returnVal = "0@" + strErr;
            }
            else
            {
                if (typeID == 0)
                {
                    #region 发送短信之前确认发送信息
                    EyouSoft.Model.SMSStructure.SendMessageInfo SMS_Model = new EyouSoft.Model.SMSStructure.SendMessageInfo();

                    SMS_Model.Mobiles      = list;
                    SMS_Model.CompanyId    = CompanyID;
                    SMS_Model.SMSContent   = tmpSendInfo;
                    SMS_Model.UserFullName = sendCustomer;
                    SMS_Model.SendChannel  = sendChannel;
                    SMS_Model.SendType     = sendType;
                    SMS_Model.SendTime     = sendTime;

                    EyouSoft.Model.SMSStructure.SendResultInfo sModel = sBll.ValidateSend(SMS_Model);
                    if (sModel != null)
                    {
                        if (sModel.IsSucceed == true)
                        {
                            //验证成功返回帐户余额以及此次所要发送的短信条数
                            returnVal = string.Format("1@您的账户当前余额为:{0},此次消费金额为:{1},将共发送短信{2}条!是否确定发送短信?"
                                                      , sModel.AccountMoney.ToString("C2")
                                                      , sModel.CountFee.ToString("C2")
                                                      , (sModel.WaitSendMobileCount + sModel.WaitSendPHSCount).ToString());
                        }
                        else if (sModel.ErrorMessage.IndexOf("余额不足") > -1)
                        {
                            returnVal = "2@" + sModel.ErrorMessage;
                        }
                        else
                        {
                            returnVal = "0@" + sModel.ErrorMessage;
                        }
                    }
                    sModel    = null;
                    SMS_Model = null;
                    #endregion
                }
                else
                {
                    #region 发送操作

                    EyouSoft.Model.SMSStructure.SendMessageInfo sendMessageInfo = new EyouSoft.Model.SMSStructure.SendMessageInfo();
                    sendMessageInfo.CompanyId    = CompanyID;
                    sendMessageInfo.CompanyName  = this.SiteUserInfo.CompanyName;
                    sendMessageInfo.UserId       = this.SiteUserInfo.ID;
                    sendMessageInfo.UserFullName = sendCustomer;
                    sendMessageInfo.SMSContent   = tmpSendInfo;
                    sendMessageInfo.SendTime     = sendTime;
                    sendMessageInfo.Mobiles      = list;
                    sendMessageInfo.SendChannel  = sendChannel;
                    sendMessageInfo.SendType     = sendType;

                    EyouSoft.Model.SMSStructure.SendResultInfo SendResultModel = sBll.Send(sendMessageInfo);

                    if (SendResultModel.IsSucceed)
                    {
                        string isHasSendUser = "";

                        if (!string.IsNullOrEmpty(sendMessageInfo.UserFullName))
                        {
                            isHasSendUser = "******";
                        }

                        decimal costFee = sendMessageInfo.SendType == EyouSoft.Model.SMSStructure.SendType.直接发送 ? SendResultModel.SendFee : SendResultModel.CountFee;
                        returnVal = "1@您本次共发送短信" + sendMessageInfo.SMSContentSendComplete.Length + "个字" + isHasSendUser + "!\n发送移动、联通共" + SendResultModel.MobileSendNumberCount + "个号码、\n发送小灵通共" + SendResultModel.PHSSendNumberCount + "个号码、\n实际共消费金额为:" + costFee.ToString("C2") + "、\n实际发送短信" + (SendResultModel.MobileSendCount + SendResultModel.PHSSendCount) + "条";
                    }
                    else if (SendResultModel.ErrorMessage.IndexOf("余额不足") > -1)
                    {
                        returnVal = "2@" + SendResultModel.ErrorMessage;
                    }
                    else
                    {
                        returnVal = "0@" + SendResultModel.ErrorMessage;
                    }

                    SendResultModel = null;
                    sendMessageInfo = null;

                    #endregion
                }
            }
            Response.Clear();
            Response.Write(returnVal);
            Response.End();
            sBll = null;
        }
Exemplo n.º 4
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
            }
        }
Exemplo n.º 5
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
        }
Exemplo n.º 6
0
 public EyouSoft.Model.SMSStructure.SendResultInfo Send(EyouSoft.Model.SMSStructure.SendMessageInfo sendMessageInfo)
 {
     return(EyouSoft.BLL.SMSStructure.SendMessage.CreateInstance().Send(sendMessageInfo));
 }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 验证要发送的短信
        /// </summary>
        /// <param name="sendMessageInfo">发送短信提交的业务实体</param>
        /// <returns></returns>
        public EyouSoft.Model.SMSStructure.SendResultInfo ValidateSend(EyouSoft.Model.SMSStructure.SendMessageInfo sendMessageInfo)
        {
            EyouSoft.Model.SMSStructure.SendResultInfo validateResultInfo = new EyouSoft.Model.SMSStructure.SendResultInfo(true, null);

            if (sendMessageInfo.CompanyId <= 0)
            {
                validateResultInfo.IsSucceed    = false;
                validateResultInfo.ErrorMessage = "未填写发送短信的公司编号";

                return(validateResultInfo);
            }

            if (sendMessageInfo.SendChannel.PriceOne <= 0)
            {
                validateResultInfo.IsSucceed    = false;
                validateResultInfo.ErrorMessage = "短信费用不能小于等于零";

                return(validateResultInfo);
            }

            if (string.IsNullOrEmpty(sendMessageInfo.SMSContent))
            {
                validateResultInfo.IsSucceed    = false;
                validateResultInfo.ErrorMessage = "短信内容不能为空";

                return(validateResultInfo);
            }

            if (sendMessageInfo.Mobiles == null || sendMessageInfo.Mobiles.Count < 1)
            {
                validateResultInfo.IsSucceed    = false;
                validateResultInfo.ErrorMessage = "未填写任何接收短信人的手机号码";

                return(validateResultInfo);
            }

            if (sendMessageInfo.SendType == EyouSoft.Model.SMSStructure.SendType.定时发送 && sendMessageInfo.SendTime <= DateTime.Now)
            {
                validateResultInfo.IsSucceed    = false;
                validateResultInfo.ErrorMessage = "定时发送时间不能小于当前时间";

                return(validateResultInfo);
            }

            string keyWord = this.IsIncludeKeyWord(sendMessageInfo.SMSContentSendComplete);

            if (!string.IsNullOrEmpty(keyWord))
            {
                validateResultInfo.IsSucceed    = false;
                validateResultInfo.ErrorMessage = string.Format("您要发送的短信内容中包含:{0} 这些禁止发送的关键字,请重新编辑!", keyWord);

                return(validateResultInfo);
            }

            //短信内容针对移动联通手机实际产生的短信条数
            validateResultInfo.FactCount = this.GetSmsTotalCount(sendMessageInfo.SMSContentSendComplete, EyouSoft.Model.SMSStructure.SMSNoType.Mobiel, sendMessageInfo.SendChannel);
            //短信内容针对小灵通实际产生的短信条数
            validateResultInfo.PHSFactCount = this.GetSmsTotalCount(sendMessageInfo.SMSContentSendComplete, EyouSoft.Model.SMSStructure.SMSNoType.PHS, sendMessageInfo.SendChannel);

            //小灵通号码个数
            validateResultInfo.PHSNumberCount = this.GetPHSCount(sendMessageInfo.Mobiles);
            //移动联通号码个数
            validateResultInfo.MobileNumberCount = sendMessageInfo.Mobiles.Count - validateResultInfo.PHSNumberCount;

            //应扣除的金额
            validateResultInfo.CountFee = 0.01M * sendMessageInfo.SendChannel.PriceOne * (validateResultInfo.WaitSendMobileCount + validateResultInfo.WaitSendPHSCount);

            #region 使用账户余额进行验证
            //用户账户余额
            validateResultInfo.AccountMoney = DalAccount.GetAccountMoney(sendMessageInfo.CompanyId);

            if (validateResultInfo.AccountMoney < validateResultInfo.CountFee)
            {
                validateResultInfo.IsSucceed    = false;
                validateResultInfo.ErrorMessage = string.Format("您的账户余额不足,当前余额为:{0},此次消费:{1}", validateResultInfo.AccountMoney.ToString("C2"), validateResultInfo.CountFee.ToString("C2"));

                return(validateResultInfo);
            }
            #endregion

            #region 使用账户剩余条数进行验证 /**/

            /*
             * //用户账户剩余短信条数
             * validateResultInfo.AccountSMSNumber = EyouSoft.BLL.SMSStructure.Account.CreateInstance().GetAccountSMSNumber(sendMessageInfo.CompanyId);
             * //账户剩余短信条数小于待发送的[移动,联通,小灵通]的总的短信条数
             * if (validateResultInfo.AccountSMSNumber < (validateResultInfo.WaitSendMobileCount + validateResultInfo.WaitSendPHSCount))
             * {
             *  validateResultInfo.IsSucceed = false;
             *  validateResultInfo.ErrorMessage = string.Format("您剩余的短信条数不足,当前剩余短信条数为:{0}条,此次消费将发送短信:{1}条", validateResultInfo.AccountSMSNumber, validateResultInfo.WaitSendMobileCount + validateResultInfo.WaitSendPHSCount);
             *
             *  return validateResultInfo;
             * }*/
            #endregion

            #region 平台帐号余额验证
            if (sendMessageInfo.IsValidatePlatform)
            {
                //114平台剩余的短信条数
                int smsPlatformCount = 0;
                try
                {
                    smsPlatformCount = sms.QuerySMSLeft(this.EnterpriseId, sendMessageInfo.SendChannel.UserName, sendMessageInfo.SendChannel.Pw);
                    //smsPlatformCount = sms.QuerySMSLeft(this.EnterpriseId, "yn3", "298748");
                }
                catch { }
                if (smsPlatformCount < validateResultInfo.WaitSendMobileCount + validateResultInfo.WaitSendPHSCount)
                {
                    validateResultInfo.IsSucceed    = false;
                    validateResultInfo.ErrorMessage = "对不起,暂时不能发送,请联系管理员!";

                    return(validateResultInfo);
                }
            }
            #endregion 平台帐号余额验证

            return(validateResultInfo);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 发送订单预定短信,返回1成功,其它失败
        /// </summary>
        /// <param name="info">订单短信信息业务实体</param>
        /// <returns></returns>
        public int SendOrderSMS(EyouSoft.Model.NewTourStructure.MOrderSmsInfo info)
        {
            if (info == null || string.IsNullOrEmpty(info.DSTCompanyId))
            {
                return(-1);
            }
            if (string.IsNullOrEmpty(info.OrderId))
            {
                return(-2);
            }

            EyouSoft.Model.SystemStructure.MSysSettingInfo setting = EyouSoft.BLL.SystemStructure.SystemInfo.CreateInstance().GetSysSetting();
            if (setting == null || !setting.OrderSmsIsEnable)
            {
                return(-3);
            }

            EyouSoft.Model.NewTourStructure.MOrderSmsDstInfo dstInfo = EyouSoft.BLL.CompanyStructure.CompanyInfo.CreateInstance().GetOrderSmsDstInfo(info.DSTCompanyId);

            if (dstInfo == null)
            {
                return(-4);
            }
            if (dstInfo.DstPhones == null || dstInfo.DstPhones.Count < 1)
            {
                return(-5);
            }

            if (setting.OrderSmsCompanyTypes == null || !setting.OrderSmsCompanyTypes.Contains(dstInfo.DstCompanyType))
            {
                return(-6);
            }

            if (info.OrderType == EyouSoft.Model.NewTourStructure.OrderSource.线路散拼订单)
            {
                string s = setting.OrderSmsTemplate;

                //信息替换
                s = s.Replace("[预定公司]", info.BookCompanyName);
                s = s.Replace("[预定联系电话]", info.BookPhone);
                s = s.Replace("[预定出发时间]", info.BookLTime.ToString("yyyy-MM-dd"));
                s = s.Replace("[预定产品]", info.BookName);
                s = s.Replace("[预定数量]", info.BookNumber.ToString());

                //收费和签约公司特有内容
                int startIndex = s.IndexOf('{');
                int endIndex   = s.IndexOf('}');
                if (startIndex > -1 && endIndex > -1 && startIndex < endIndex)
                {
                    if (dstInfo.DstCompanyType == EyouSoft.Model.CompanyStructure.CompanyLev.签约商户 ||
                        dstInfo.DstCompanyType == EyouSoft.Model.CompanyStructure.CompanyLev.推荐商户)
                    {
                        s = s.Replace("{", string.Empty).Replace("}", string.Empty);
                    }
                    else
                    {
                        s = s.Substring(0, startIndex) + s.Substring(endIndex + 1);
                    }
                }

                EyouSoft.Model.SMSStructure.SendMessageInfo         message = new EyouSoft.Model.SMSStructure.SendMessageInfo();
                List <EyouSoft.Model.SMSStructure.AcceptMobileInfo> mobiles = new List <EyouSoft.Model.SMSStructure.AcceptMobileInfo>();

                foreach (var item in dstInfo.DstPhones)
                {
                    if (!string.IsNullOrEmpty(item) && EyouSoft.Common.Utility.IsMobile(item))
                    {
                        mobiles.Add(new EyouSoft.Model.SMSStructure.AcceptMobileInfo()
                        {
                            IsEncrypt = false,
                            Mobile    = item
                        });
                        break;
                    }
                }

                message.CompanyId   = setting.OrderSmsCompanyId;
                message.CompanyName = string.Empty;
                message.Mobiles     = mobiles;
                message.SendChannel = new EyouSoft.Model.SMSStructure.SMSChannelList()[setting.OrderSmsChannelIndex];
                message.SendTime    = DateTime.Now;
                message.SendType    = EyouSoft.Model.SMSStructure.SendType.直接发送;
                message.SMSContent  = s;
                //message.SMSContentSendComplete
                message.SMSType      = 0;
                message.UserFullName = string.Empty;
                message.UserId       = setting.OrderSmsUserId;

                var sendRet = Send(message);
                if (sendRet.IsSucceed)
                {
                    return(1);
                }
                else
                {
                    return(-7);
                }
            }

            return(-8);
        }
Exemplo n.º 10
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
            }
        }