Esempio n. 1
0
 public void SetUp()
 {
     _mock  = new Mock <IProspectRequest>();
     target = new ProspectController {
         ProspectRequest = _mock.Object
     };
 }
Esempio n. 2
0
        public AIA.Life.Models.Opportunity.Prospect SaveProspect(AIA.Life.Models.Opportunity.Prospect objProspect)
        {
            TpServiceLog tpServiceLog = new TpServiceLog();

            tpServiceLog.ServiceRequest = Newtonsoft.Json.JsonConvert.SerializeObject(objProspect);
            TransactLog transactLog = new TransactLog();

            transactLog.SerivceTraceID = tpServiceLog.ServiceTraceID = objProspect.ServiceTraceID;
            transactLog.UserName       = objProspect.UserName;
            string Message = ValidateUserAuth(transactLog);

            if (Message != "" && Message != null)
            {
                objProspect.Message = Message;
                return(objProspect);
            }
            ProspectController Prospect = new ProspectController();

            if (objProspect.NotePad != null)
            {
                objProspect.NotePadByteArray = Convert.FromBase64String(objProspect.NotePad);

                string Proposerfilename     = "NotePad.png";
                string ProposerdirectryPath = "";
                //ProposerdirectryPath = HttpContext.Current.Server.MapPath("ContactID_" + objProspect.ContactID);
                ProposerdirectryPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Policy/ContactID_" + objProspect.ContactID);
                if (!Directory.Exists(ProposerdirectryPath))
                {
                    Directory.CreateDirectory(ProposerdirectryPath);
                }
                string Proposerfilepath = Path.Combine(ProposerdirectryPath, Proposerfilename);
                System.IO.File.WriteAllBytes(Proposerfilepath, objProspect.NotePadByteArray);
                objProspect.objNeedAnalysis.NotePadPath = Path.Combine("\\Policy", "ContactID_" + objProspect.ContactID, Proposerfilename);
            }
            Prospect.GetByteArray(objProspect);
            if (!string.IsNullOrEmpty(objProspect.objNeedAnalysis.ByteArraygraph))
            {
                objProspect.ByteArrayGraph = Convert.FromBase64String(objProspect.objNeedAnalysis.ByteArraygraph);
                objProspect.ByteArrayGraph = Prospect.Appgeneratepdf(objProspect.ByteArrayGraph, objProspect);
            }
            AIA.Life.Business.Prospect.ProspectBusiness objProspectBusiness = new AIA.Life.Business.Prospect.ProspectBusiness();
            objProspect = objProspectBusiness.SaveProspect(objProspect);
            if (objProspect.ProspectStage == 4)
            {
                AIA.Life.Business.Quote.QuoteBusiness QuoteBusiness = new AIA.Life.Business.Quote.QuoteBusiness();
                objProspect = QuoteBusiness.SendEmailAndSMSNotificationOnSAveProspect(objProspect);
            }

            tpServiceLog.ServiceResponse = Newtonsoft.Json.JsonConvert.SerializeObject(objProspect);
            commonBusiness.CreateServiceLog(tpServiceLog);
            return(objProspect);
        }