예제 #1
0
 public bool Send(SMSDetails details)
 {
     return(SendMessage(details.Message, details.PhoneNumber));
 }
예제 #2
0
파일: Handler.ashx.cs 프로젝트: uvbs/mmp
        /// <summary>
        /// 投票
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string SubmitInfoDali(HttpContext context)
        {
            string voteId      = context.Request["vid"];
            string phone       = context.Request["phone"];
            var    recordCount = bllVote.GetCount <SMSDetails>(string.Format("PlanID={0} And Receiver='{1}'", voteId, currentUserInfo.UserID));

            if (recordCount == 1)
            {
                resp.errcode = -1;
                resp.errmsg  = "不能再继续抽奖";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            string   token      = "";
            DateTime dtSendTime = DateTime.Now;

            if (dtSendTime.Hour >= 19)
            {
                dtSendTime = Convert.ToDateTime(dtSendTime.ToString("yyyy-MM-dd"));
                dtSendTime = dtSendTime.AddDays(1).AddHours(9);
            }
            Random rand  = new Random();
            int    index = rand.Next(1, 3);

            switch (index)
            {
            case 1:
                token = "我的时尚";
                break;

            case 2:
                token = "加油";
                break;

            default:
                break;
            }
            string sendMsg = string.Format("感谢参与,您的密令为 “{0}”,点击 c.tb.cn/c.ZIW7y 立刻前往官方店联系客服领取!【The.Me】", token);


            UserInfo websiteOwnerUserInfo = bllVote.GetCurrWebSiteUserInfo();

            Common.HttpInterFace webRequest = new Common.HttpInterFace();
            string parm       = string.Format("userName={0}&userPwd={1}&mobile={2}&content={3}&pipeID=membermission&attime={4}", websiteOwnerUserInfo.UserID, websiteOwnerUserInfo.Password, phone, sendMsg, dtSendTime.ToString());
            string returnCode = webRequest.PostWebRequest(parm, "http://sms.comeoncloud.net/Serv/SubmitSMSAPI.aspx", System.Text.Encoding.GetEncoding("gb2312"));

            if (!string.IsNullOrEmpty(returnCode) && (returnCode.ToString().Equals("0")))
            {
                resp.errmsg = "ok";
                SMSDetails model = new SMSDetails();
                model.PlanID   = voteId;
                model.Receiver = currentUserInfo.UserID;
                bllSms.Add(model);
            }
            else
            {
                resp.errcode = -1;
                resp.errmsg  = "code:" + returnCode;
                //if (returnCode=="1002")//余额不足
                //{
                //    resp.errcode = 0;
                //}
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            return(Common.JSONHelper.ObjectToJson(resp));
        }
예제 #3
0
        public PaymentModel AckPaymentandProcess(AVOAIALifeEntities Context, PaymentModel objPaymentModel, tblPolicy objtblpolicy)
        {
            SMSIntegration objSMSIntegration = new SMSIntegration();
            SMSDetails     objSMSDetails     = new SMSDetails();

            Common.CommonBusiness objCommonBusiness = new Common.CommonBusiness();
            #region UW deviations
            UWRuleLogic objLogic       = new UWRuleLogic();
            PolicyLogic objPolicyLogic = new PolicyLogic();
            objPaymentModel.Message = string.Empty;


            bool dataUpdated = false;
            var  ilData      = Context.tblLogILUpdates.Where(a => a.ProposalNo == objPaymentModel.ProposalNo).FirstOrDefault();
            if (ilData != null)
            {
                if (ilData.ServiceStatus == "SUCC" && ilData.ServiceName == "ModifyProposal")
                {
                    dataUpdated = true;
                }
            }
            if (dataUpdated)
            {
                //S003
                var CustomerDetails = objtblpolicy.tblPolicyRelationships.FirstOrDefault().tblPolicyClient;
                //var Title = Context.tblMasCommonTypes.Where(a => a.Code == CustomerDetails.Title).Select(a => a.ShortDesc).FirstOrDefault();
                //objSMSDetails.Salutation = objCommonBusiness.ConverttoTitlecase(Title);
                string Sal        = CustomerDetails.Title;
                var    Salutation = Context.tblMasCommonTypes.Where(a => a.Code == Sal && a.MasterType == "Salutation").Select(a => a.ShortDesc).FirstOrDefault();
                var    Salu       = Context.tblMasCommonTypes.Where(a => a.Description == Sal && a.MasterType == "Salutation").Select(a => a.ShortDesc).FirstOrDefault();
                if (!String.IsNullOrEmpty(Salutation))
                {
                    objSMSDetails.Salutation = Salutation;
                }
                else if (!String.IsNullOrEmpty(Salu))
                {
                    objSMSDetails.Salutation = Salu;
                }
                else
                {
                    objSMSDetails.Salutation = Sal;
                }
                var Name = "";
                if (CustomerDetails.FullName == "CORP")
                {
                    Name = CustomerDetails.CorporateName;
                }
                else
                {
                    Name = CustomerDetails.LastName;
                }
                objSMSDetails.Name           = objCommonBusiness.ConverttoTitlecase(Name);
                objSMSDetails.SMSTemplate    = "S003";
                objSMSDetails.ProposalNumber = objPaymentModel.ProposalNo;
                objSMSDetails.MobileNumber   = CustomerDetails.MobileNo;
                objSMSDetails.SMSEnvironment = Convert.ToString(ConfigurationManager.AppSettings["SMSEnvironment"]);
                if (!String.IsNullOrEmpty(objSMSDetails.MobileNumber))
                {
                    objSMSIntegration.SMSNotification(objSMSDetails);
                }
                objPaymentModel = (PaymentModel)IL.RecieptEnquiry(objPaymentModel);
            }
            if ((objPaymentModel.PayingAmount) >= (Convert.ToDecimal(objPaymentModel.PayableAmount) - 100) || System.Web.Configuration.WebConfigurationManager.AppSettings["PublishEnvironment"] == "SIT")
            {
                AIA.Life.Models.Policy.Policy objPolicy = new AIA.Life.Models.Policy.Policy();
                objPolicy.ProposalFetch = true;
                objPolicy.ProposalNo    = objPaymentModel.ProposalNo;
                objPolicy.QuoteNo       = objtblpolicy.QuoteNo;
                objPolicy = objPolicyLogic.FetchProposalInfo(objPolicy);
                // //S012
                if (objPaymentModel.SelectedPayment == "othertypes")
                {
                    var createdBy = Context.tblPolicies.Where(a => a.ProposalNo == objPolicy.ProposalNo).Select(a => a.Createdby).FirstOrDefault();
                    objSMSDetails.MobileNumber = Context.tblUserDetails.Where(a => a.UserID.ToString() == createdBy).Select(a => a.ContactNo).FirstOrDefault();
                    //objSMSDetails.MobileNumber = Context.tblMasIMOUsers.Where(a => a.UserID == objPolicy.AgentCode).Select(a => a.MobileNo).FirstOrDefault();
                    objSMSDetails.SMSTemplate    = "S012";
                    objSMSDetails.PolicyNo       = objPaymentModel.ProposalNo;
                    objSMSDetails.Premium        = String.Format(CultureInfo.GetCultureInfo(1033), "{0:n0}", objPolicy.AnnualPremium); //Convert.ToString(objPolicy.AnnualPremium);
                    objSMSDetails.SMSEnvironment = Convert.ToString(ConfigurationManager.AppSettings["SMSEnvironment"]);
                    objSMSIntegration.SMSNotification(objSMSDetails);
                }
                string Message = string.Empty;
                if (objtblpolicy.PolicyStageStatusID != 2376)/// Counter offer Case
                {
                    Message = objLogic.ValidateDeviation(objPolicy);
                }

                tblPayment tblPayment = objtblpolicy.tblPolicyPaymentMaps.OrderByDescending(a => a.PolicyPaymentMapID).FirstOrDefault().tblPayment;
                tblPayment.ChequeSubmission = true;
                tblPayment.ReceiptNo        = "ACK";
                string leadNo = Context.tblLifeQQs.Where(a => a.QuoteNo == objtblpolicy.QuoteNo).Select(a => a.tblContact).FirstOrDefault().LeadNo;
                if (dataUpdated)
                {
                    objPaymentModel = (PaymentModel)IL.ProposalPreIssueValidation(objPaymentModel);
                }

                if (!string.IsNullOrEmpty(Message.Trim()) || objtblpolicy.PolicyStageStatusID == 2376)// Or Counter offer Case
                {
                    objPaymentModel.Message = "Success";
                    if (objtblpolicy != null)
                    {
                        objtblpolicy.PolicyRemarks       = Message;
                        objtblpolicy.PolicyStageStatusID = 193;   // UW
                        objtblpolicy.IsAllocated         = false; // Pending for Allocation
                        objtblpolicy.ProposalSubmitDate  = DateTime.Now;
                        if (!string.IsNullOrEmpty(leadNo))
                        {
                            SamsClient samsClient = new SamsClient();
                            samsClient.UpdateLeadStatus(Context, Convert.ToInt32(leadNo), 9);
                        }
                        //SMS S005
                        var createdBy = Context.tblPolicies.Where(a => a.ProposalNo == objPolicy.ProposalNo).Select(a => a.Createdby).FirstOrDefault();
                        objSMSDetails.MobileNumber = Context.tblUserDetails.Where(a => a.UserID.ToString() == createdBy).Select(a => a.ContactNo).FirstOrDefault();
                        //objSMSDetails.WPMobileNumber= Context.tblMasIMOUsers.Where(a => a.UserID == objPolicy.UserName).Select(a => a.MobileNo).FirstOrDefault();
                        objSMSDetails.SMSTemplate    = "S005";
                        objSMSDetails.PolicyNo       = objPaymentModel.ProposalNo;
                        objSMSDetails.SMSEnvironment = Convert.ToString(ConfigurationManager.AppSettings["SMSEnvironment"]);
                        objSMSIntegration.SMSNotification(objSMSDetails);
                    }
                    objPaymentModel.UWMessage = "" + Message;
                    Context.SaveChanges();

                    return(objPaymentModel);
                }
                #endregion



                if (!string.IsNullOrEmpty(objPaymentModel.ProposalNo) && dataUpdated)
                {
                    //objPaymentModel = (PaymentModel)IL.ProposalPreIssueValidation(objPaymentModel);
                    if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage) && (objPaymentModel.PreIssueValidations.Count <= 1))
                    {
                        if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage))
                        {
                            Thread.Sleep(5000);
                            objPaymentModel = (PaymentModel)IL.ProposalUWApproval(objPaymentModel);
                            if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage))
                            {
                                objPaymentModel = (PaymentModel)IL.QualityControl(objPaymentModel);
                                if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage))
                                {
                                    objPaymentModel = (PaymentModel)IL.ProposalIssuance(objPaymentModel);
                                    if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage))
                                    {
                                        objtblpolicy.PolicyNo            = objPaymentModel.ProposalNo = objPolicy.ProposalNo;
                                        objtblpolicy.PolicyStageStatusID = 192;// Issued
                                        DateTime today         = DateTime.Now;
                                        int[]    exceptionDays = new int[3] {
                                            29, 30, 31
                                        };
                                        if (exceptionDays.Contains(today.Day))
                                        {
                                            today = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 28);
                                        }
                                        objtblpolicy.PolicyIssueDate = today;
                                        objtblpolicy.PolicyStartDate = today;
                                        objtblpolicy.PolicyEndDate   = today.AddYears(Convert.ToInt32(objtblpolicy.PolicyTerm));
                                        objPaymentModel.Message      = "Success";
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (dataUpdated)
                        {
                            if (!string.IsNullOrEmpty(leadNo))
                            {
                                SamsClient samsClient = new SamsClient();
                                samsClient.UpdateLeadStatus(Context, Convert.ToInt32(leadNo), 9);
                            }
                            objtblpolicy.PolicyStageStatusID = 193;// UW
                            objtblpolicy.IsAllocated         = false;
                            objtblpolicy.ProposalSubmitDate  = DateTime.Now;
                            objPaymentModel.UWMessage        = "Your proposal has been forwarded to underwriter for further processing.";
                        }
                        else
                        {
                            objPaymentModel.UWMessage = "Payment is Successful. Your proposal is under processing, you will be notified soon.";
                        }
                    }
                    Context.SaveChanges();
                }
            }
            else
            {
                if (objPaymentModel.PayingAmount == 0)
                {
                    objPaymentModel.UWMessage = "Payment is Successful. Your proposal is under processing, you will be notified soon.";
                }
                else
                {
                    objPaymentModel.UWMessage = "Your payment is successful. Payment reference number is " + objPaymentModel.TransactionNo;
                }
            }
            return(objPaymentModel);
        }
예제 #4
0
        public bool SMSNotification(SMSDetails objsmsDetails)
        {
            bool Res = false;

            try
            {
                string message = string.Empty;
                switch (objsmsDetails.SMSTemplate)
                {
                case "S001":
                    message = SMSIntegrationTemplete.S001.Replace("txtSalutation", objsmsDetails.Salutation);
                    message = message.Replace("txtSurname", objsmsDetails.Name);
                    message = message.Replace("txtWPMobileNo", objsmsDetails.WPMobileNumber);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S002":
                    message = SMSIntegrationTemplete.S002.Replace("txtSalutation", objsmsDetails.Salutation);
                    message = message.Replace("txtSurname", objsmsDetails.Name);
                    message = message.Replace("txtWPMobileNo", objsmsDetails.WPMobileNumber);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S003":
                    message = SMSIntegrationTemplete.S003.Replace("txtSalutation", objsmsDetails.Salutation);
                    message = message.Replace("txtSurname", objsmsDetails.Name);
                    message = message.Replace("txtProposalNo", objsmsDetails.ProposalNumber);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);

                    break;

                case "S004":
                    message = SMSIntegrationTemplete.S004.Replace("txtSalutation", objsmsDetails.Salutation);
                    message = message.Replace("txtSurname", objsmsDetails.Name);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);

                    break;

                case "S005":
                    message = SMSIntegrationTemplete.S005.Replace("txtProposalNo", objsmsDetails.PolicyNo);

                    break;

                case "S006":
                    message = SMSIntegrationTemplete.S006.Replace("txtProposalNo", objsmsDetails.PolicyNo);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);

                    break;

                case "S007":
                    message = SMSIntegrationTemplete.S007.Replace("txtSalutation", objsmsDetails.Salutation);
                    message = message.Replace("txtSurname", objsmsDetails.Name);
                    message = message.Replace("txtProposalNo", objsmsDetails.PolicyNo);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S008":
                    message = SMSIntegrationTemplete.S008.Replace("txtSalutation", objsmsDetails.Salutation);
                    message = message.Replace("txtSurname", objsmsDetails.Name);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S009":
                    message = SMSIntegrationTemplete.S009.Replace("txtSalutation", objsmsDetails.Salutation);
                    message = message.Replace("txtSurname", objsmsDetails.Name);
                    //message = message.Replace("txtReq1", objsmsDetails.Req1);
                    //message = message.Replace("txtReq2", objsmsDetails.Req2);
                    //message = message.Replace("txtReq3", objsmsDetails.Req3);
                    //message = message.Replace("txtReq4", objsmsDetails.Req4);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S010":
                    message = SMSIntegrationTemplete.S010.Replace("txtProposalNo", objsmsDetails.PolicyNo);
                    //message = message.Replace("txtReq1", objsmsDetails.Req1);
                    //message = message.Replace("txtReq2", objsmsDetails.Req2);
                    //message = message.Replace("txtReq3", objsmsDetails.Req3);
                    //message = message.Replace("txtReq4", objsmsDetails.Req4);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);

                    break;

                case "S011":
                    message = SMSIntegrationTemplete.S011.Replace("txtSalutation", objsmsDetails.Salutation);
                    message = message.Replace("txtSurname", objsmsDetails.Name);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S012":
                    message = SMSIntegrationTemplete.S012.Replace("txtProposalNo", objsmsDetails.PolicyNo);
                    message = message.Replace("txtPremium", objsmsDetails.Premium);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S013":
                    message = SMSIntegrationTemplete.S013.Replace("txtProposalNo", objsmsDetails.PolicyNo);
                    message = message.Replace("txtProposalEndDate ", objsmsDetails.PolicyEndDate);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S014":
                    message = SMSIntegrationTemplete.S014.Replace("txtSalutation", objsmsDetails.Salutation);
                    message = message.Replace("txtSurname", objsmsDetails.Name);
                    message = message.Replace("txtProposalNo", objsmsDetails.PolicyNo);
                    message = message.Replace("txtProposalEndDate ", objsmsDetails.PolicyEndDate);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S015":
                    message = SMSIntegrationTemplete.S015.Replace("txtProposalNo", objsmsDetails.PolicyNo);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    message = message.Replace("txtHealthconditionOccupation", objsmsDetails.HealthconditionOccupation);
                    break;

                case "S016":
                    message = SMSIntegrationTemplete.S016.Replace("txtSalutation", objsmsDetails.Salutation);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    message = message.Replace("txtSurname", objsmsDetails.Name);
                    message = message.Replace("txtHealthconditionOccupation", objsmsDetails.HealthconditionOccupation);
                    break;

                case "S017":
                    message = SMSIntegrationTemplete.S017.Replace("txtProposalNo", objsmsDetails.PolicyNo);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    message = message.Replace("txtHealthconditionOccupation", objsmsDetails.HealthconditionOccupation);
                    break;

                case "S018":
                    message = SMSIntegrationTemplete.S018.Replace("txtSalutation", objsmsDetails.Salutation);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    message = message.Replace("txtSurname", objsmsDetails.Name);
                    message = message.Replace("txtHealthconditionOccupation", objsmsDetails.HealthconditionOccupation);
                    message = message.Replace("txtMonths", objsmsDetails.Months);
                    break;

                case "S019":
                    message = SMSIntegrationTemplete.S019.Replace("txtProposalNo", objsmsDetails.PolicyNo);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S020":
                    message = SMSIntegrationTemplete.S020.Replace("txtSalutation", objsmsDetails.Salutation);
                    message = message.Replace("txtSurname", objsmsDetails.Name);
                    message = message.Replace("txtProposalNo", objsmsDetails.PolicyNo);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S021":
                    message = SMSIntegrationTemplete.S021.Replace("txtProposalNo", objsmsDetails.PolicyNo);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S022":
                    message = SMSIntegrationTemplete.S022.Replace("txtProposalNo", objsmsDetails.PolicyNo);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S023":
                    message = SMSIntegrationTemplete.S023.Replace("txtSalutation", objsmsDetails.Salutation);
                    message = message.Replace("txtSurname", objsmsDetails.Name);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S024":
                    message = SMSIntegrationTemplete.S024.Replace("txtSalutation", objsmsDetails.Salutation);
                    message = message.Replace("txtSurname", objsmsDetails.Name);
                    message = message.Replace("txtPolicyNo", objsmsDetails.PolicyNo);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;

                case "S025":
                    message = SMSIntegrationTemplete.S025.Replace("txtPolicyNo", objsmsDetails.PolicyNo);
                    message = message.Replace("txtSMSEnvironment", objsmsDetails.SMSEnvironment);
                    break;
                }
                // SamsIntegration.SamsClient samsClient = new SamsIntegration.SamsClient();
                // string send = samsClient.SendMessage(objsmsDetails.MobileNumber, message);
                //if (send == "success")
                //{
                //  Res = true;
                //}
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Res);
        }