Esempio n. 1
0
 /// <summary>
 /// 根据指定条件获取客户信息
 /// </summary>
 /// <param name="pageSize">每页记录数</param>
 /// <param name="pageIndex">当前页索引</param>
 /// <param name="recordCount">总记录数</param>
 /// <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 IList <EyouSoft.Model.SMSStructure.CustomerInfo> GetCustomers(int pageSize, int pageIndex, ref int recordCount, string companyId, string customerCompanyName, string customerUserFullName, string mobile, int categoryId, EyouSoft.Model.SMSStructure.CustomerInfo.CustomerSource source, int provinceId, int cityId)
 {
     return(dal.GetCustomers(pageSize, pageIndex, ref recordCount, companyId, customerCompanyName, customerUserFullName, mobile, categoryId, source, provinceId, cityId));
 }
Esempio n. 2
0
 /// <summary>
 /// 根据指定条件获取接收短信号信息
 /// </summary>
 /// <param name="companyId">公司编号</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 IList <EyouSoft.Model.SMSStructure.AcceptMobileInfo> GetMobiles(string companyId, string mobile, int categoryId, EyouSoft.Model.SMSStructure.CustomerInfo.CustomerSource source, int provinceId, int cityId)
 {
     return(dal.GetMobiles(companyId, mobile, categoryId, source, provinceId, cityId));
 }
Esempio n. 3
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);
        }
Esempio n. 4
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;
        }
Esempio n. 5
0
        /// <summary>
        /// 根据指定条件获取客户信息
        /// </summary>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="pageIndex">当前页索引</param>
        /// <param name="recordCount">总记录数</param>
        /// <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.CustomerInfo> GetCustomers(int pageSize, int pageIndex, ref int recordCount, string companyId, string customerCompanyName, string customerUserFullName, string mobile, int categoryId, EyouSoft.Model.SMSStructure.CustomerInfo.CustomerSource source, int provinceId, int cityId)
        {
            IList <EyouSoft.Model.SMSStructure.CustomerInfo> customers = new List <EyouSoft.Model.SMSStructure.CustomerInfo>();

            StringBuilder cmdQuery      = new StringBuilder();
            string        tableName     = "view_SMS_Customers";
            string        primaryKey    = "Id";
            string        orderByString = "IssueTime DESC";
            string        fields        = " ID, CompanyID, UserID, CustomerCompanyName, CustomerContactName, ClassID, ReMark, MobileNumber, IssueTime, ClassName,TongYCompanyId, ProvinceId, CityId, ProvinceName, CityName";

            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(customerCompanyName))
            {
                cmdQuery.AppendFormat(" AND (CustomerCompanyName LIKE '%{0}%')", customerCompanyName);
            }

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

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

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

            using (IDataReader rdr = DbHelper.ExecuteReader(base.SMSStore, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fields, cmdQuery.ToString(), orderByString))
            {
                EyouSoft.Model.SMSStructure.CustomerInfo model = null;

                while (rdr.Read())
                {
                    model = new EyouSoft.Model.SMSStructure.CustomerInfo();

                    model.CustomerId          = rdr.GetString(rdr.GetOrdinal("ID"));
                    model.CompanyId           = rdr.GetString(rdr.GetOrdinal("CompanyID"));
                    model.UserId              = rdr.GetString(rdr.GetOrdinal("UserID"));
                    model.CustomerCompanyName = rdr["CustomerCompanyName"].ToString();
                    model.CustomerContactName = rdr["CustomerContactName"].ToString();
                    model.CategoryId          = rdr.GetInt32(rdr.GetOrdinal("ClassID"));
                    model.CategoryName        = rdr["ClassName"].ToString();
                    model.Remark              = rdr["ReMark"].ToString();
                    model.Mobile              = rdr["MobileNumber"].ToString();
                    model.IssueTime           = rdr.GetDateTime(rdr.GetOrdinal("IssueTime"));
                    model.RetailersCompanyId  = rdr.GetString(rdr.GetOrdinal("TongYCompanyId"));
                    model.ProvinceId          = rdr.GetInt32(rdr.GetOrdinal("ProvinceId"));
                    model.ProvinceName        = rdr.IsDBNull(rdr.GetOrdinal("ProvinceName")) ? "" : rdr.GetString(rdr.GetOrdinal("ProvinceName"));
                    model.CityId              = rdr.GetInt32(rdr.GetOrdinal("CityId"));
                    model.CityName            = rdr.IsDBNull(rdr.GetOrdinal("CityName")) ? "" : rdr.GetString(rdr.GetOrdinal("CityName"));

                    customers.Add(model);
                }
            }

            return(customers);
        }