public PaymentModel MCashPayment(PaymentModel objPaymentModel) { try { PaymentLogic objPaymentLogic = new PaymentLogic(); McashIntegration mcashIntegration = new McashIntegration(); //objPaymentModel = new PaymentModel(); //objPaymentModel.PayableAmount = "100"; //objPaymentModel.TransactionNo = "T2404201876575765"; //objPaymentModel.ProposalNo = "50125759"; //objPaymentModel.McashPin = "0000"; //objPaymentModel.McashMobile = "0718929748"; //objPaymentModel.Mobile = "0712911111"; //mcashIntegration.PayUtilitiesDirect(objPaymentModel); if (mcashIntegration.PayUtilitiesDirect(objPaymentModel)) { objPaymentModel = objPaymentLogic.SaveProposalPaymentInfo(objPaymentModel); } return(objPaymentModel); } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); objPaymentModel.Message = "Error"; objPaymentModel.Error.ErrorMessage = "Something went wrong. Please contact the admin, your reference code : " + objPaymentModel.Error.ErrorCode; return(objPaymentModel); } }
public static Boolean AuthenticateUser(String strPath, String strUserName, String strPassword) { try { using (DirectoryEntry deAuthenticate = new DirectoryEntry(strPath, strUserName, strPassword)) { // if user is verified then it will welcome then try { //deAuthenticate.RefreshCache(); Object obj = deAuthenticate.NativeObject; // TODO: add your specific tasks here //DirectorySearcher search = new DirectorySearcher(deAuthenticate); //search.PropertiesToLoad.Add("DisplayName"); ////search.PropertiesToLoad.Add("employeeID"); //search.PropertiesToLoad.Add("mail"); ////search.PropertiesToLoad.Add("SapPrimeDomText"); //SearchResult result = search.FindOne(); } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); return(false); } } return(true); } catch (Exception ex) { return(false); } }
public HttpResponseMessage DownloadFile(DowFile dowFile) { HttpResponseMessage httpResponseMessage = Request.CreateResponse(HttpStatusCode.OK); try { string format = dowFile.FileFormat; string bookPath_Pdf = dowFile.FIlePath; string reqBook = bookPath_Pdf; string bookName = dowFile.FileName + "." + format.ToLower(); //converting Pdf file into bytes array var dataBytes = File.ReadAllBytes(reqBook); //adding bytes to memory stream var dataStream = new MemoryStream(dataBytes); httpResponseMessage.Content = new StreamContent(dataStream); httpResponseMessage.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment"); httpResponseMessage.Content.Headers.ContentDisposition.FileName = bookName; httpResponseMessage.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); } return(httpResponseMessage); }
public ManualAllocation SaveManualAllocation(ManualAllocation objAllocationModel) { try { using (AVOAIALifeEntities Context = new AVOAIALifeEntities()) { foreach (var Item in objAllocationModel.objLstAllocationProposals.Where(a => a.ISSelected == true).ToList()) { if (!string.IsNullOrEmpty(Item.AssignTo)) { DateTime Date = DateTime.Now; var policy = Context.tblPolicies.Where(a => a.ProposalNo == Item.ProposalNo).FirstOrDefault(); if (policy != null) { decimal PolicyID = policy.PolicyID; var PolicyAllocation = Context.tblPolicyUWAllocations.Where(a => a.PolicyID == PolicyID).FirstOrDefault(); if (PolicyAllocation != null) { PolicyAllocation.AllocatedFrom = PolicyAllocation.AllocatedTo; PolicyAllocation.AllocatedTo = Item.AssignTo.ToUpper(); PolicyAllocation.AllocatedDate = Date; policy.IsAllocated = true; policy.ModifiedDate = Date; } else { tblPolicyUWAllocation objPolicyUWAllocation = new tblPolicyUWAllocation(); objPolicyUWAllocation.PolicyID = PolicyID; objPolicyUWAllocation.AllocatedFrom = string.Empty; objPolicyUWAllocation.AllocatedTo = Item.AssignTo; objPolicyUWAllocation.AllocatedDate = Date; objPolicyUWAllocation.Remarks = string.Empty; objPolicyUWAllocation.CreatedDate = Date; Context.tblPolicyUWAllocations.Add(objPolicyUWAllocation); policy.IsAllocated = true; policy.ModifiedDate = Date; } } Context.SaveChanges(); } } } objAllocationModel.Message = "Success"; } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); objAllocationModel.Message = "Error"; } return(objAllocationModel); }
public AllocationModel ResetAllocation(AllocationModel objAllocationModel) { try { using (AVOAIALifeEntities Context = new AVOAIALifeEntities()) { List <string> UWNames = objAllocationModel.objUWdetails.Where(a => a.IsChecked == true).Select(a => a.UWName).ToList(); if (UWNames != null) { string UserInfo = string.Empty; #region Coma Seperated User Ids int Count = 0; foreach (string Userid in Context.AspNetUsers.Where(a => UWNames.Contains(a.UserName)).Select(a => a.Id).ToList()) { if (Count == 0) { UserInfo = Userid; } else { UserInfo = "," + Userid; } Count++; } #endregion var idParam = new SqlParameter { ParameterName = "UserId", Value = UserInfo }; var Result = Context.Database.SqlQuery <string>( "exec usp_UnAllocateProposals @UserId ", idParam).FirstOrDefault(); } } objAllocationModel.Message = "Success"; } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); objAllocationModel.Message = "Error"; } return(objAllocationModel); }
public UserToken GenerateTokenID(UserToken objLogin) { try { UserManagementBusiness objUserManagementBusiness = new UserManagementBusiness(); objLogin = objUserManagementBusiness.GenerateTokenID(objLogin); return(objLogin); } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); return(objLogin); } }
public AllocationModel LoadAllocationDetails(AllocationModel objAllocationModel) { try { using (AVOAIALifeEntities Context = new AVOAIALifeEntities()) { string RoleID = Context.AspNetRoles.Where(a => a.Name == "UW User").FirstOrDefault().Id; var idParam = new SqlParameter { ParameterName = "@RoleId", Value = RoleID }; List <string> UserIDs = Context.Database.SqlQuery <string>( "exec GetUsersByRoleId @RoleId", idParam).ToList(); if (UserIDs != null) { objAllocationModel.objUWdetails = (from aspnetusers in Context.AspNetUsers.Where(a => UserIDs.Contains(a.Id)) join userdetails in Context.tblUserDetails on aspnetusers.UserName equals userdetails.LoginID select new UWDetails { UWName = aspnetusers.UserName, ID = aspnetusers.Id, Availabiliy = false }).ToList(); } objAllocationModel.objChannelDetails = (from objchannel in Context.tblmasChannels select new ChannelDetails { ChannelName = objchannel.ChannelName, ChannelId = objchannel.ChannelID, Availabiliy = false }).ToList(); objAllocationModel.Message = "Success"; return(objAllocationModel); } } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); objAllocationModel.Message = "Error"; return(objAllocationModel); } }
/// <summary> /// This method will fire everytime /// </summary> /// <param name="filterContext"></param> public void OnException(ExceptionContext filterContext) { string UserName = ""; if (HttpContext.Current.User != null && HttpContext.Current.User.Identity != null) { UserName = LoginUser.GetUserName(); } string ErrorCode = Codes.GetErrorCode(); log4net.GlobalContext.Properties["ErrorCode"] = ErrorCode; Logger.Error(filterContext.Exception); //This will execute in case Non Ajax call //if (!filterContext.HttpContext.Request.IsAjaxRequest()) //{ var CustomError = System.Configuration.ConfigurationManager.AppSettings["ShowCustomErrorPage"]; if (CustomError != null && CustomError.ToString() == "true") { if (filterContext.HttpContext.Response.StatusCode != 404) { var routeData = new RouteData(); routeData.Values["controller"] = "Error"; routeData.Values["action"] = "PageNotFoundError"; //IController errorsController = new var exception = HttpContext.Current.Server.GetLastError(); var httpException = exception as HttpException; // assigning new route to controls var rc = new RequestContext ( new HttpContextWrapper(HttpContext.Current), routeData ); rc.RouteData.Values.Add("ErrorCode", ErrorCode); //errorsController.Execute(rc); filterContext.ExceptionHandled = true; } } }
public PaymentModel SaveProposalPaymentInfo(PaymentModel objPaymentModel) { try { PaymentLogic objPaymentLogic = new PaymentLogic(); return(objPaymentLogic.SaveProposalPaymentInfo(objPaymentModel)); } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); if (objPaymentModel.Message == "Success") { objPaymentModel.Message = "Success"; } return(objPaymentModel); } }
public string GetUserName(string UserID) { string UserName = string.Empty; if (!string.IsNullOrEmpty(UserID)) { try { using (AVOAIALifeEntities Context = new AVOAIALifeEntities()) { UserName = Context.AspNetUsers.Where(a => a.Id == UserID).FirstOrDefault().UserName; } } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); } } return(UserName); }
public string GetDecisionDescription(string Decision) { string Description = string.Empty; if (!string.IsNullOrEmpty(Decision)) { try { using (AVOAIALifeEntities Context = new AVOAIALifeEntities()) { int ID = Convert.ToInt32(Decision); Description = Context.tblMasCommonTypes.Where(a => a.CommonTypesID == ID).FirstOrDefault().Description; } } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); } } return(Description); }
public AIA.Life.Models.Opportunity.Prospect LoadAllocateSuspect(AIA.Life.Models.Opportunity.Prospect objProspect) { try { ProspectLogic objlogic = new ProspectLogic(); objProspect.ObjSuspectPool = objlogic.GetAllocateSuspect(objProspect); return(objProspect); } catch (Exception e) { log4net.GlobalContext.Properties["ErrorCode"] = objProspect.Error.ErrorCode = Codes.GetErrorCode(); Logger.Error(e); objProspect.Error.ErrorMessage = "Please inform the IT HelpDesk on this application issue. Error Code is " + objProspect.Error.ErrorCode + ". Sorry for the inconvenience caused"; return(objProspect); } }
public string FileUpload(DomFile obj) { string Result = ""; try { if (!string.IsNullOrEmpty(obj.Department_Code) && !string.IsNullOrEmpty(obj.Agent_Code) && !string.IsNullOrEmpty(obj.Policy_No) && !string.IsNullOrEmpty(obj.FileName)) { //string zipPath = @"E:\AIA\test1.zip"; byte[] FileBytes = Convert.FromBase64String(obj.Filedata); //System.IO.File.ReadAllBytes(zipPath); // string Path = ConfigurationManager.AppSettings["DocumentUploadPath"]; //@"E:\AIA\uploaddocsmobility"; bool IsfolderExist = CheckImageExist(obj.Department_Code); if (IsfolderExist == false) { var directoryInfo1 = new DirectoryInfo(Path); directoryInfo1.CreateSubdirectory(obj.Department_Code); } Path = Path + "//" + obj.Department_Code; IsfolderExist = CheckImageExist(obj.Department_Code + "//" + obj.Agent_Code); if (IsfolderExist == false) { var directoryInfo1 = new DirectoryInfo(Path); directoryInfo1.CreateSubdirectory(obj.Agent_Code); } Path = Path + "//" + obj.Agent_Code; IsfolderExist = CheckImageExist(obj.Department_Code + "//" + obj.Agent_Code + "//" + obj.Policy_No); if (IsfolderExist == false) { var directoryInfo1 = new DirectoryInfo(Path); directoryInfo1.CreateSubdirectory(obj.Policy_No); } Path = Path + "//" + obj.Policy_No; string zipPath1 = ConfigurationManager.AppSettings["DocumentUploadZipPath"]; Random rnd = new Random(); obj.FileName = rnd.Next(1, 9999) + obj.FileName; bool isExist = System.IO.File.Exists(zipPath1 + obj.FileName); FileStream fs = new FileStream(zipPath1 + obj.FileName, FileMode.Append); if (FileBytes.Count() > 0) { fs.Write(FileBytes, 0, FileBytes.Length); } fs.Close(); ZipFile fileToExtract = ZipFile.Read(zipPath1 + obj.FileName); fileToExtract.ExtractAll(Path, ExtractExistingFileAction.DoNotOverwrite); Result = Path; } else { Result = "Kindly provide Department code, Agent Code, Document Name and policy number to proceed..!"; } } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); Result = "Failure"; } return(Result); }
public PaymentModel SavePGTransaction(PaymentModel objPaymentModel) { try { PaymentLogic objPaymentLogic = new PaymentLogic(); objPaymentModel = objPaymentLogic.SavePGTransaction(objPaymentModel); } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = objPaymentModel.Error.ErrorCode = Codes.GetErrorCode(); Logger.Error(ex); objPaymentModel.Error.ErrorMessage = "Something went wrong. Please contact the admin, your reference code : " + objPaymentModel.Error.ErrorCode; } return(objPaymentModel); }
public ManualAllocation ManualAllocationDetails(ManualAllocation objAllocationModel) { try { using (AVOAIALifeEntities Context = new AVOAIALifeEntities()) { string RoleID = Context.AspNetRoles.Where(a => a.Name == "UW User").FirstOrDefault().Id; var idParam = new SqlParameter { ParameterName = "@RoleId", Value = RoleID }; List <string> UserIDs = Context.Database.SqlQuery <string>( "exec GetUsersByRoleId @RoleId", idParam).ToList(); if (UserIDs != null) { objAllocationModel.LstUWName = (from aspnetusers in Context.AspNetUsers.Where(a => UserIDs.Contains(a.Id) && a.LockoutEndDateUtc == null) join userdetails in Context.tblUserDetails on aspnetusers.UserName equals userdetails.LoginID select new MasterListItem { Text = aspnetusers.UserName, Value = aspnetusers.Id }).ToList(); int i = 0; objAllocationModel.objLstAllocationProposals = (from Proposal in Context.tblPolicies.Where(a => a.IsAllocated == false) select new AllocationProposals { ProposalNoDisplay = Proposal.ProposalNo, ProposalNo = Proposal.ProposalNo, PolicyID = Proposal.PolicyID }).OrderByDescending(a => a.PolicyID).ToList().Select((item, index) => new AllocationProposals { ProposalNoDisplay = item.ProposalNoDisplay, ProposalNo = item.ProposalNo, Index = index, PolicyID = item.PolicyID }).ToList(); objAllocationModel.objLstResetProposals = (from Proposal in Context.tblPolicies.Where(a => a.PolicyStageStatusID == 193) // Ref to UW join UWAllocation in Context.tblPolicyUWAllocations on Proposal.PolicyID equals UWAllocation.PolicyID join ASpnetUsers in Context.AspNetUsers on UWAllocation.AllocatedTo equals ASpnetUsers.Id where Proposal.ModifiedDate == UWAllocation.AllocatedDate select new AllocationProposals { ProposalNoDisplay = Proposal.ProposalNo, ProposalNo = Proposal.ProposalNo, UWName = ASpnetUsers.UserName, PolicyID = Proposal.PolicyID }).OrderByDescending(a => a.PolicyID).ToList().Select((item, index) => new AllocationProposals { ProposalNoDisplay = item.ProposalNoDisplay, ProposalNo = item.ProposalNo, UWName = item.UWName, Index = index, PolicyID = item.PolicyID }).ToList(); if (objAllocationModel.objLstAllocationProposals == null) { objAllocationModel.objLstAllocationProposals = new List <AllocationProposals>(); } if (objAllocationModel.objLstResetProposals == null) { objAllocationModel.objLstResetProposals = new List <AllocationProposals>(); } } objAllocationModel.Message = "Success"; return(objAllocationModel); } } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); objAllocationModel.Message = "Error"; return(objAllocationModel); } }
public AIA.Life.Models.Policy.Policy SaveProposal(AIA.Life.Models.Policy.Policy objpolicy) { TpServiceLog tpServiceLog = new TpServiceLog(); tpServiceLog.ServiceRequest = Newtonsoft.Json.JsonConvert.SerializeObject(objpolicy); TransactLog transactLog = new TransactLog(); transactLog.SerivceTraceID = tpServiceLog.ServiceTraceID = objpolicy.ServiceTraceID; transactLog.UserName = objpolicy.UserName; string Message = ValidateUserAuth(transactLog); if (Message != "" && Message != null) { objpolicy.Message = Message; return(objpolicy); } AIA.Life.Business.Policy.PolicyBusiness objPolicyBusiness = new AIA.Life.Business.Policy.PolicyBusiness(); if (objpolicy.MainLifeSign != null) { objpolicy.ProposerSignatureFile = Convert.FromBase64String(objpolicy.MainLifeSign); } if (objpolicy.SpouseLifeSign != null) { objpolicy.SpouseSignatureFile = Convert.FromBase64String(objpolicy.SpouseLifeSign); } if (objpolicy.WPSign != null) { objpolicy.WPSignatureFile = Convert.FromBase64String(objpolicy.WPSign); } objpolicy = objPolicyBusiness.SaveProposal(objpolicy); objpolicy = objPolicyBusiness.InvokeILModifyProposal(objpolicy); string QuoteFilePath = ConfigurationManager.AppSettings["QuoteFilePath"]; if (objpolicy.Message == "Success") { try { AVOAIALifeEntities Context = new AVOAIALifeEntities(); var prdID = Context.tblMasProductPlans.Where(a => a.PlanCode == objpolicy.PlanCode).Select(a => a.ProductId).FirstOrDefault(); var ProductCode = Context.tblProducts.Where(a => a.ProductId == prdID).Select(a => a.ProductCode).FirstOrDefault(); byte[] byteArray = null; ReportsController objReportController = new ReportsController(); try { byteArray = objReportController.ProposalReport(objpolicy.QuoteNo, ProductCode, objpolicy.PreferredLanguage); } catch (Exception) { objpolicy.ByteArray = null; } try { objpolicy.ProposalFilePath = QuoteFilePath + objpolicy.QuoteNo + "_Proposal.pdf"; System.IO.File.WriteAllBytes(objpolicy.ProposalFilePath, byteArray); } catch (Exception ex) { objpolicy.ProposalFilePath = null; } } catch (Exception e) { log4net.GlobalContext.Properties["ErrorCode"] = objpolicy.Error.ErrorCode = Codes.GetErrorCode(); Logger.Error(e); objpolicy.Error.ErrorMessage = "Please inform the IT HelpDesk on this application issue. Error Code is " + objpolicy.Error.ErrorCode + ". Sorry for the inconvenience caused"; } } tpServiceLog.ServiceResponse = Newtonsoft.Json.JsonConvert.SerializeObject(objpolicy); commonBusiness.CreateServiceLog(tpServiceLog); return(objpolicy); }
public string FileUpload(DomFile obj) { string Result = ""; try { if (!string.IsNullOrEmpty(obj.Agent_Code) && !string.IsNullOrEmpty(obj.Policy_No) && !string.IsNullOrEmpty(obj.FileName)) { //string zipPath = @"E:\AIA\test1.zip"; byte[] FileBytes = Convert.FromBase64String(obj.Filedata); //System.IO.File.ReadAllBytes(zipPath); // string Path = ConfigurationManager.AppSettings["DocumentUploadPath"]; //@"E:\AIA\uploaddocsmobility"; //bool IsfolderExist = CheckImageExist(obj.Department_Code); //if (IsfolderExist == false) //{ // var directoryInfo1 = new DirectoryInfo(Path); // directoryInfo1.CreateSubdirectory(obj.Department_Code); //} //Path = Path + @"\" + obj.Department_Code; bool IsfolderExist = CheckImageExist(obj.Agent_Code); if (IsfolderExist == false) { var directoryInfo1 = new DirectoryInfo(Path); directoryInfo1.CreateSubdirectory(obj.Agent_Code); } Path = Path + "//" + obj.Agent_Code; IsfolderExist = CheckImageExist(obj.Agent_Code + @"\" + obj.Policy_No); if (IsfolderExist == false) { var directoryInfo1 = new DirectoryInfo(Path); directoryInfo1.CreateSubdirectory(obj.Policy_No); } Path = Path + @"\" + obj.Policy_No; string zipPath1 = ConfigurationManager.AppSettings["DocumentUploadZipPath"]; Random rnd = new Random(); obj.FileName = rnd.Next(1, 9999) + obj.FileName; bool isExist = System.IO.File.Exists(zipPath1 + obj.FileName); FileStream fs = new FileStream(zipPath1 + obj.FileName, FileMode.Append); if (FileBytes.Count() > 0) { fs.Write(FileBytes, 0, FileBytes.Length); } fs.Close(); #region File validations using (ZipFile zip = ZipFile.Read(zipPath1 + obj.FileName)) { foreach (ZipEntry e in zip) { try { using (var stream = e.OpenReader()) { if (!ValidateFileType.IsAllowedFileType(e.FileName, (Stream)stream)) { Result = "Please Provide Valid File Format"; return(Result); } } } catch (Exception ex) { } } } #endregion #region Convert to PDF List <DocumentUploadFile> LstDocumentUpload = new List <DocumentUploadFile>(); UtilityController objUtilityController = new UtilityController(); using (ZipFile zip = ZipFile.Read(zipPath1 + obj.FileName)) { foreach (ZipEntry e in zip) { try { using (var stream = e.OpenReader()) { DocumentUploadFile objUpload = new DocumentUploadFile(); MemoryStream ms = new MemoryStream(); e.Extract(ms); byte[] bytes = new byte[ms.Length]; bytes = objUtilityController.PdfGeneration(ms.ToArray()); System.IO.File.WriteAllBytes(Path + "//" + e.FileName.Substring(0, e.FileName.IndexOf(".")) + ".pdf", bytes); objUpload.FileName = e.FileName.Split('.')[0].Split('_')[0]; objUpload.FileData = bytes; LstDocumentUpload.Add(objUpload); } //DocumentUploadFile objUpload = new DocumentUploadFile(); //objUpload.FilePath = obj.FileName;.spli //objUpload.ItemType = RequestDoc[i].ItemType; //objUpload.MemberType = RequestDoc[i].MemberType; //objUpload.FileData = fileData; } catch (Exception ex) { } } } byte[] ConcatFiles; var directryPath = ConfigurationManager.AppSettings["FileUpload"] + "\\" + obj.Agent_Code + "\\" + obj.Policy_No + "\\LDMS"; if (!Directory.Exists(directryPath)) { Directory.CreateDirectory(directryPath); } foreach (var fName in LstDocumentUpload.Select(a => a.FileName).Distinct().ToList()) { ConcatFiles = CrossCutting.DataTypeConvExtention.ConcatPdf(LstDocumentUpload.Where(a => a.FileName == fName).Select(a => a.FileData).ToList()); //System.IO.File.WriteAllBytes(ConfigurationManager.AppSettings["LDMSFileUpload"] + "\\" + obj.Agent_Code + "\\" + obj.Policy_No + "\\" + fName + ".pdf", ConcatFiles); System.IO.File.WriteAllBytes(directryPath + "\\" + fName + ".pdf", ConcatFiles); } #endregion //ZipFile fileToExtract = ZipFile.Read(zipPath1 + obj.FileName); //fileToExtract.ExtractAll(Path, ExtractExistingFileAction.DoNotOverwrite); Result = Path; } else { Result = "Kindly provide Department code, Agent Code, Document Name and policy number to proceed..!"; } } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); Result = "Failure"; } return(Result); }
public AIA.Life.Models.Opportunity.Prospect LoadProspectPool(AIA.Life.Models.Opportunity.Prospect objPolicyLoadData) { try { AIA.Data.Life.API.ControllerLogic.Prospect.ProspectLogic objProspectLogic = new ControllerLogic.Prospect.ProspectLogic(); objPolicyLoadData.ObjProspectPool = objProspectLogic.GetProspectPool(objPolicyLoadData); return(objPolicyLoadData); } catch (Exception e) { log4net.GlobalContext.Properties["ErrorCode"] = objPolicyLoadData.Error.ErrorCode = Codes.GetErrorCode(); Logger.Error(e); objPolicyLoadData.Error.ErrorMessage = "Please inform the IT HelpDesk on this application issue. Error Code is " + objPolicyLoadData.Error.ErrorCode + ". Sorry for the inconvenience caused"; return(objPolicyLoadData); } }
public ActionResult ProcessSampathBankResponse(PaymentCompleteRequest paymentCompleteRequest) { if (TempData.ContainsKey("CloseWindows")) { ViewBag.CloseWindow = TempData["CloseWindows"].ToString(); } int clientID = Convert.ToInt32(ConfigurationManager.AppSettings["CLIENTID"].ToString()); paymentCompleteRequest.clientId = clientID; GatewayClient gatewayClient = new GatewayClient(make_ClientConfig_Sampath()); PaymentCompleteResponse paymentCompleteResponse = gatewayClient.payment.complete(paymentCompleteRequest); PaymentModel objPaymentModel = new PaymentModel(); objPaymentModel.UserName = Username; objPaymentModel.ReqId = paymentCompleteRequest.reqid; objPaymentModel.PayableAmount = Convert.ToString(Convert.ToInt32(paymentCompleteResponse.transactionAmount.paymentAmount / 100)); objPaymentModel.PGResponse = paymentCompleteResponse.responseCode + "|" + paymentCompleteResponse.responseText; objPaymentModel = objPaymentBusiness.UpdatePGTransaction(objPaymentModel); string msg = string.Empty; msg = objPaymentModel.Error.ErrorMessage; ViewBag.Message = msg; if (string.IsNullOrEmpty(objPaymentModel.Error.ErrorMessage)) { AIA.Life.Business.Policy.PolicyBusiness objPolicyBusiness = new AIA.Life.Business.Policy.PolicyBusiness(); if (!string.IsNullOrEmpty(objPaymentModel.UWMessage)) { msg = objPaymentModel.UWMessage; } else if (objPaymentModel.Message == "Success") { msg = "Your policy has been issued. Please refer policy number " + objPaymentModel.ProposalNo + " for future reference"; #region policy issuance triggers if (!string.IsNullOrEmpty(objPaymentModel.Message) && objPaymentModel.Message == "Success") { objPaymentModel = objPaymentBusiness.FetchProposals(objPaymentModel); ReportsController objReportController = new ReportsController(); List <byte[]> lstBytes = new List <byte[]>(); try { if (objPaymentModel.lstPaymentItems.Count > 0) { int prdID = objPaymentModel.lstPaymentItems[0].ProductID; var obj = Context.tblMasProductPlans.Where(a => a.ProductId == prdID).FirstOrDefault(); var ProductCode = Context.tblProducts.Where(a => a.ProductId == prdID).Select(a => a.ProductCode).FirstOrDefault(); if (obj != null) { byte[] quoteBytes = objReportController.ReportQuotation(objPaymentModel.QuoteNo, obj.PlanCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage); if (quoteBytes != null) { lstBytes.Add(quoteBytes); } byte[] a = objReportController.ReportForIllustrationPDF(objPaymentModel.QuoteNo, obj.PlanCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage, objPaymentModel.ProposalNo); byte[] b = objReportController.ReportForPolicySchedule(objPaymentModel.ProposalNo, ProductCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage); byte[] c = objReportController.ReportForCoveringLetter(objPaymentModel.ProposalNo, obj.PlanCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage); List <byte[]> vs = new List <byte[]>(); if (c != null) { vs.Add(c); } if (b != null) { vs.Add(b); } if (a != null) { vs.Add(a); } objPaymentModel.ByteArray2 = concatAndAddContent(vs); objPaymentModel.ByteArray3 = objReportController.ProposalReport(objPaymentModel.QuoteNo, ProductCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage); if (objPaymentModel.ByteArray2 != null) { lstBytes.Add(objPaymentModel.ByteArray2); } if (objPaymentModel.ByteArray3 != null) { lstBytes.Add(objPaymentModel.ByteArray3); } } } objPolicyBusiness.PostPolicyIssuanceTriggers(objPaymentModel); } catch (Exception e) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(e); } try { for (int i = 0; i < lstBytes.Count; i++) { LdmsDocuments documents = new LdmsDocuments(); documents.SourcePath = ConfigurationManager.AppSettings["DocumentUploadPath"]; documents.DocCode = i == 0 ? "PRD004" : (i == 1 ? "PRD009" : (i == 2 ? "PRD001" : "")); documents.AgentCode = Username; documents.ProposalNo = objPaymentModel.ProposalNo; documents.SourcePath = documents.SourcePath + @"\UW\" + documents.AgentCode + @"\" + documents.ProposalNo + @"\"; if (!Directory.Exists(documents.SourcePath)) { Directory.CreateDirectory(documents.SourcePath); } documents.SourcePath = documents.SourcePath + documents.DocCode + ".pdf"; System.IO.File.WriteAllBytes(documents.SourcePath, lstBytes[i]); objPolicyBusiness.UploadDocumentsLDMS(documents); } } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); } } #endregion } else { msg = objPaymentModel.Message; } ViewBag.Message = msg; return(View("~/Views/Payment/PaymentSuccess.cshtml")); } else { return(View("~/Views/Payment/PaymentFailure.cshtml")); } }
public PaymentModel PostPolicyIssuanceTriggers(PaymentModel objPaymentModel) { #region policy issuance triggers ReportsController objReportController = new ReportsController(); AIA.Life.Business.Policy.PolicyBusiness objPolicyBusiness = new AIA.Life.Business.Policy.PolicyBusiness(); List <byte[]> lstBytes = new List <byte[]>(); try { if (objPaymentModel.lstPaymentItems.Count > 0) { byte[] quoteBytes = objReportController.ReportQuotation(objPaymentModel.QuoteNo, objPaymentModel.lstPaymentItems[0].PlanCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage); if (quoteBytes != null) { lstBytes.Add(quoteBytes); } byte[] a = objReportController.ReportForIllustrationPDF(objPaymentModel.QuoteNo, objPaymentModel.lstPaymentItems[0].PlanCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage, objPaymentModel.ProposalNo); byte[] b = objReportController.ReportForPolicySchedule(objPaymentModel.ProposalNo, objPaymentModel.lstPaymentItems[0].ProductCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage); byte[] c = objReportController.ReportForCoveringLetter(objPaymentModel.ProposalNo, objPaymentModel.lstPaymentItems[0].PlanCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage); List <byte[]> vs = new List <byte[]>(); if (c != null) { vs.Add(c); } if (b != null) { vs.Add(b); } if (a != null) { vs.Add(a); } objPaymentModel.ByteArray2 = CrossCutting.DataTypeConvExtention.ConcatPdf(vs); objPaymentModel.ByteArray3 = objReportController.ProposalReport(objPaymentModel.QuoteNo, objPaymentModel.lstPaymentItems[0].ProductCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage); if (objPaymentModel.ByteArray2 != null) { lstBytes.Add(objPaymentModel.ByteArray2); } if (objPaymentModel.ByteArray3 != null) { lstBytes.Add(objPaymentModel.ByteArray3); } } objPolicyBusiness.PostPolicyIssuanceTriggers(objPaymentModel); } catch (Exception e) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(e); } try { for (int i = 0; i < lstBytes.Count; i++) { LdmsDocuments documents = new LdmsDocuments(); documents.SourcePath = ConfigurationManager.AppSettings["DocumentUploadPath"]; documents.DocCode = i == 0 ? "PRD004" : (i == 1 ? "PRD009" : (i == 2 ? "PRD001" : "")); documents.AgentCode = objPaymentModel.UserName; documents.ProposalNo = objPaymentModel.ProposalNo; documents.SourcePath = documents.SourcePath + @"\UW\" + documents.AgentCode + @"\" + documents.ProposalNo + @"\"; if (!Directory.Exists(documents.SourcePath)) { Directory.CreateDirectory(documents.SourcePath); } documents.SourcePath = documents.SourcePath + documents.DocCode + ".pdf"; System.IO.File.WriteAllBytes(documents.SourcePath, lstBytes[i]); objPolicyBusiness.UploadDocumentsLDMS(documents); } } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); } #endregion return(objPaymentModel); }
public AllocationModel SaveAllocation(AllocationModel objAllocationModel) { try { using (AVOAIALifeEntities Context = new AVOAIALifeEntities()) { DeleteExisitingAllocationInfo(); #region Add Allocation Info foreach (var UWDetails in objAllocationModel.objUWdetails) { tblUWAllocation objUWAllocation = new tblUWAllocation(); objUWAllocation.UWName = UWDetails.UWName; objUWAllocation.Availability = UWDetails.Availabiliy; Context.tblUWAllocations.Add(objUWAllocation); var UserInfo = Context.AspNetUsers.Where(a => a.UserName == UWDetails.UWName).FirstOrDefault(); if (UserInfo != null) { Guid _Guid = new Guid(UserInfo.Id); var UserDetails = Context.tblUserDetails.Where(a => a.UserID == _Guid).FirstOrDefault(); tblUserAvalibility objUserAvailability = new tblUserAvalibility(); objUserAvailability.NodeId = UserDetails.NodeID; objUserAvailability.UserAvailability = UWDetails.Availabiliy; Context.tblUserAvalibilities.Add(objUserAvailability); } } foreach (var ChannelDetails in objAllocationModel.objChannelDetails) { tblChannelAllocation objChannelAllocation = new tblChannelAllocation(); objChannelAllocation.ChannelName = ChannelDetails.ChannelName; objChannelAllocation.Availability = ChannelDetails.Availabiliy; Context.tblChannelAllocations.Add(objChannelAllocation); } Context.SaveChanges(); #endregion #region Call Allocation List <AllocationSummary> Result = Context.Database.SqlQuery <AllocationSummary>( "exec usp_AllocateProposals").ToList(); if (Result != null) { objAllocationModel.objAllocationSummary = new List <AllocationSummary>(); objAllocationModel.objAllocationSummary = Result; } #endregion objAllocationModel.Message = "Success"; return(objAllocationModel); } } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); objAllocationModel.Message = "Error"; return(objAllocationModel); } }
public AIA.Life.Models.Opportunity.LifeQuote SaveQuote(AIA.Life.Models.Opportunity.LifeQuote ObjQuote) { TpServiceLog tpServiceLog = new TpServiceLog(); tpServiceLog.ServiceRequest = Newtonsoft.Json.JsonConvert.SerializeObject(ObjQuote); TransactLog transactLog = new TransactLog(); transactLog.SerivceTraceID = tpServiceLog.ServiceTraceID = ObjQuote.ServiceTraceID; transactLog.UserName = ObjQuote.UserName; string Message = ValidateUserAuth(transactLog); if (Message != "" && Message != null) { ObjQuote.Message = Message; return(ObjQuote); } string ObjSuspect = Newtonsoft.Json.JsonConvert.SerializeObject(ObjQuote); #region Proposer Signature if (ObjQuote.Signature != null) { ObjQuote.ProspectSign = Convert.FromBase64String(ObjQuote.Signature); string Proposerfilename = "Proposersignature.png"; string ProposerdirectryPath = ""; ProposerdirectryPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Policy/ContactID_" + ObjQuote.objProspect.ContactID); //ProposerdirectryPath = HttpContext.Current.Server.MapPath("ContactID_" + ObjQuote.objProspect.ContactID); if (!Directory.Exists(ProposerdirectryPath)) { Directory.CreateDirectory(ProposerdirectryPath); } string Proposerfilepath = Path.Combine(ProposerdirectryPath, Proposerfilename); System.IO.File.WriteAllBytes(Proposerfilepath, ObjQuote.ProspectSign); ObjQuote.ProposerSignPath = Path.Combine("\\Policy", "ContactID_" + ObjQuote.objProspect.ContactID, Proposerfilename); } #endregion #region Spouse Signature if (ObjQuote.WPProposerSignature != null) { ObjQuote.WPSignature = Convert.FromBase64String(ObjQuote.WPProposerSignature); string WPfilename = "WPProposersignature.png"; string WPdirectryPath = ""; //WPdirectryPath = HttpContext.Current.Server.MapPath("ContactID_" + ObjQuote.objProspect.ContactID); WPdirectryPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Policy/ContactID_" + ObjQuote.objProspect.ContactID); if (!Directory.Exists(WPdirectryPath)) { Directory.CreateDirectory(WPdirectryPath); } string WPfilepath = Path.Combine(WPdirectryPath, WPfilename); System.IO.File.WriteAllBytes(WPfilepath, ObjQuote.WPSignature); ObjQuote.WPProposerSignPath = Path.Combine("\\Policy", "ContactID_" + ObjQuote.objProspect.ContactID, WPfilename); } #endregion AIA.Life.Business.Quote.QuoteBusiness objQuoteBusiness = new AIA.Life.Business.Quote.QuoteBusiness(); ObjQuote = objQuoteBusiness.SaveQuote(ObjQuote); string QuoteFilePath = ConfigurationManager.AppSettings["QuoteFilePath"]; if (ObjQuote.Message == "Success") { try { ReportsController objReportController = new ReportsController(); var byteArray = objReportController.ReportQuotation(ObjQuote.QuoteNo, ObjQuote.objProductDetials.PlanCode, ObjQuote.objProductDetials.PreferredLangauage); ObjQuote.QuotePDFPath = QuoteFilePath + ObjQuote.QuoteNo + "_Quote.pdf"; System.IO.File.WriteAllBytes(ObjQuote.QuotePDFPath, byteArray); ObjQuote.ByteArray = byteArray; objQuoteBusiness.SendEmailAndSMSNotificationOnQuoteCreation(ObjQuote); } catch (Exception e) { log4net.GlobalContext.Properties["ErrorCode"] = ObjQuote.Error.ErrorCode = Codes.GetErrorCode(); Logger.Error(e); ObjQuote.Error.ErrorMessage = "Please inform the IT HelpDesk on this application issue. Error Code is " + ObjQuote.Error.ErrorCode + ". Sorry for the inconvenience caused"; } } tpServiceLog.ServiceResponse = Newtonsoft.Json.JsonConvert.SerializeObject(ObjQuote); commonBusiness.CreateServiceLog(tpServiceLog); return(ObjQuote); }
public AIA.Life.Models.Policy.Policy SignatureUpload(AIA.Life.Models.Policy.Policy objPolicy) { try { #region Proposer Signature if (objPolicy.Sign1 != null) { objPolicy.ByteArray = Convert.FromBase64String(objPolicy.Sign1); string Proposerfilename = "Proposersignature.png"; string ProposerdirectryPath = ""; // ProposerdirectryPath = HttpContext.Current.Server.MapPath("ContactID_" + objPolicy.ContactID); // ProposerdirectryPath = Server.MapPath("ContactID_" + objPolicy.ContactID); // WPdirectryPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Policy/ContactID_" + ObjQuote.objProspect.ContactID); ProposerdirectryPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Policy/ContactID_" + objPolicy.ContactID); if (!Directory.Exists(ProposerdirectryPath)) { Directory.CreateDirectory(ProposerdirectryPath); } string Proposerfilepath = Path.Combine(ProposerdirectryPath, Proposerfilename); System.IO.File.WriteAllBytes(Proposerfilepath, objPolicy.ByteArray); objPolicy.ProposalFilePath = Path.Combine("\\Policy", "ContactID_" + objPolicy.ContactID, Proposerfilename); } #endregion #region Spouse Signature if (objPolicy.Sign2 != null) { objPolicy.ByteArray2 = Convert.FromBase64String(objPolicy.Sign2); string Spousefilename = "Spousesignature.png"; string SpousedirectryPath = ""; SpousedirectryPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Policy/ContactID_" + objPolicy.ContactID); //SpousedirectryPath = HttpContext.Current.Server.MapPath("ContactID_" + objPolicy.ContactID); if (!Directory.Exists(SpousedirectryPath)) { Directory.CreateDirectory(SpousedirectryPath); } string Spousefilepath = Path.Combine(SpousedirectryPath, Spousefilename); System.IO.File.WriteAllBytes(Spousefilepath, objPolicy.ByteArray2); objPolicy.SpouseSignature = Path.Combine("\\Policy", "ContactID_" + objPolicy.ContactID, Spousefilename); } #endregion #region WP Signature if (objPolicy.Sign3 != null) { objPolicy.ByteArray3 = Convert.FromBase64String(objPolicy.Sign3); string WPfilename = "WPProposersignature.png"; string WPdirectryPath = ""; WPdirectryPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Policy/ContactID_" + objPolicy.ContactID); //WPdirectryPath = HttpContext.Current.Server.MapPath("ContactID_" + objPolicy.ContactID); if (!Directory.Exists(WPdirectryPath)) { Directory.CreateDirectory(WPdirectryPath); } string WPfilepath = Path.Combine(WPdirectryPath, WPfilename); System.IO.File.WriteAllBytes(WPfilepath, objPolicy.ByteArray3); objPolicy.WPProposerSignature = Path.Combine("\\Policy", "ContactID_" + objPolicy.ContactID, WPfilename); #endregion } objPolicy.Message = "Success"; } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); objPolicy.Error.ErrorMessage = ex.Message; objPolicy.Message = "Failure"; } return(objPolicy); }
public AIA.Life.Models.Opportunity.Prospect SaveProspect(AIA.Life.Models.Opportunity.Prospect objProspect) { try { ProspectLogic objlogic = new ProspectLogic(); //if (string.IsNullOrEmpty(objProspect.ClientCode)) //{ // objProspect = (Prospect)IL.ClientEnquiry(objProspect); //} objProspect.Error = new AIA.Life.Models.Common.Error(); //if (string.IsNullOrEmpty(objProspect.Error.ErrorMessage)) objProspect = objlogic.SaveProspect(objProspect); return(objProspect); } catch (Exception e) { log4net.GlobalContext.Properties["ErrorCode"] = objProspect.Error.ErrorCode = Codes.GetErrorCode(); Logger.Error(e); objProspect.Error.ErrorMessage = "Please inform the IT HelpDesk on this application issue. Error Code is " + objProspect.Error.ErrorCode + ". Sorry for the inconvenience caused"; return(objProspect); } }
public JsonResult MCashPayment(PaymentModel objPaymentModel) { objPaymentModel.UserName = Username; objPaymentModel = objPaymentBusiness.MCashPayment(objPaymentModel); #region policy issuance triggers if (!string.IsNullOrEmpty(objPaymentModel.Message) && objPaymentModel.Message == "Success") { objPaymentModel = objPaymentBusiness.FetchProposals(objPaymentModel); AIA.Life.Business.Policy.PolicyBusiness objPolicyBusiness = new AIA.Life.Business.Policy.PolicyBusiness(); ReportsController objReportController = new ReportsController(); List <byte[]> lstBytes = new List <byte[]>(); try { if (objPaymentModel.lstPaymentItems.Count > 0) { int prdID = objPaymentModel.lstPaymentItems[0].ProductID; var obj = Context.tblMasProductPlans.Where(a => a.ProductId == prdID).FirstOrDefault(); var ProductCode = Context.tblProducts.Where(a => a.ProductId == prdID).Select(a => a.ProductCode).FirstOrDefault(); if (obj != null) { byte[] quoteBytes = objReportController.ReportQuotation(objPaymentModel.QuoteNo, obj.PlanCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage); if (quoteBytes != null) { lstBytes.Add(quoteBytes); } byte[] a = objReportController.ReportForIllustrationPDF(objPaymentModel.QuoteNo, obj.PlanCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage, objPaymentModel.ProposalNo); byte[] b = objReportController.ReportForPolicySchedule(objPaymentModel.ProposalNo, ProductCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage); byte[] c = objReportController.ReportForCoveringLetter(objPaymentModel.ProposalNo, obj.PlanCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage); List <byte[]> vs = new List <byte[]>(); if (c != null) { vs.Add(c); } if (b != null) { vs.Add(b); } if (a != null) { vs.Add(a); } objPaymentModel.ByteArray2 = concatAndAddContent(vs); objPaymentModel.ByteArray3 = objReportController.ProposalReport(objPaymentModel.QuoteNo, ProductCode, objPaymentModel.lstPaymentItems[0].PreferredLanguage); if (objPaymentModel.ByteArray2 != null) { lstBytes.Add(objPaymentModel.ByteArray2); } if (objPaymentModel.ByteArray3 != null) { lstBytes.Add(objPaymentModel.ByteArray3); } } } objPolicyBusiness.PostPolicyIssuanceTriggers(objPaymentModel); } catch (Exception e) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(e); } try { for (int i = 0; i < lstBytes.Count; i++) { LdmsDocuments documents = new LdmsDocuments(); documents.SourcePath = ConfigurationManager.AppSettings["DocumentUploadPath"]; documents.DocCode = i == 0 ? "PRD004" : (i == 1 ? "PRD009" : (i == 2 ? "PRD001" : "")); documents.AgentCode = Username; documents.ProposalNo = objPaymentModel.ProposalNo; documents.SourcePath = documents.SourcePath + @"\UW\" + documents.AgentCode + @"\" + documents.ProposalNo + @"\"; if (!Directory.Exists(documents.SourcePath)) { Directory.CreateDirectory(documents.SourcePath); } documents.SourcePath = documents.SourcePath + documents.DocCode + ".pdf"; System.IO.File.WriteAllBytes(documents.SourcePath, lstBytes[i]); objPolicyBusiness.UploadDocumentsLDMS(documents); } } catch (Exception ex) { log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode(); Logger.Error(ex); } } #endregion var ObjResponse = new { Message = objPaymentModel.Message, ProposalNo = objPaymentModel.ProposalNo, UWMessage = objPaymentModel.UWMessage, ErrorMessage = objPaymentModel.Error.ErrorMessage }; return(Json(ObjResponse, JsonRequestBehavior.AllowGet)); }