public void OnPostSort(string colName) { string lastCol = HttpContext.Session.GetString("MyColumn"); string mySort = HttpContext.Session.GetString("MySort"); if (lastCol == colName) { if (mySort == "asc") { mySort = "desc"; } else { mySort = "asc"; } } else { mySort = "asc"; HttpContext.Session.SetString("MyColumn", colName); } HttpContext.Session.SetString("MySort", mySort); string chapterId = HttpContext.Session.GetString("OfficerChapterId"); DataSet ds = Utility.AMS_Query_Result("ACR_GET_STATE_CHAPTER_ROSTER_PORTAL_SP", "@master_customer_id", chapterId).Result; ProcessData(ds); ds.Tables[0].DefaultView.Sort = (colName + " " + mySort); OfficerList = ds.Tables[0].DefaultView.ToTable(); ProcessData(OfficerList); }
public void OnGet() { string chapterId = HttpContext.Session.GetString("OfficerChapterId"); DataSet ds = Utility.AMS_Query_Result("ACR_GET_STATE_CHAPTER_ROSTER_PORTAL_SP", "@master_customer_id", chapterId).Result; ProcessData(ds); string colName = HttpContext.Session.GetString("MyColumn"); string mySort = HttpContext.Session.GetString("MySort"); if (string.IsNullOrEmpty(colName)) { colName = "LABEL_NAME"; HttpContext.Session.SetString("MyColumn", colName); } if (string.IsNullOrEmpty(mySort)) { mySort = "asc"; HttpContext.Session.SetString("MySort", mySort); } ds.Tables[0].DefaultView.Sort = (colName + " " + mySort); OfficerList = ds.Tables[0].DefaultView.ToTable(); ProcessData(OfficerList); }
public ActionResult OnGetOfficer(int id) { string colName = HttpContext.Session.GetString("MyColumn"); string mySort = HttpContext.Session.GetString("MySort"); if (string.IsNullOrEmpty(colName)) { colName = "LABEL_NAME"; } if (string.IsNullOrEmpty(mySort)) { mySort = "asc"; } string chapterId = HttpContext.Session.GetString("OfficerChapterId"); DataSet ds = Utility.AMS_Query_Result("ACR_GET_STATE_CHAPTER_ROSTER_PORTAL_SP", "@master_customer_id", chapterId).Result; ProcessData(ds); ds.Tables[0].DefaultView.Sort = (colName + " " + mySort); OfficerList = ds.Tables[0].DefaultView.ToTable(); ProcessData(OfficerList); if (id > -1 && id < OfficerList.Rows.Count) { DataRow item = OfficerList.Rows[id]; HttpContext.Session.SetString("FullName", item["LABEL_NAME"].ToString()); HttpContext.Session.SetString("Description", item["POSITION_DESCRIPTION"].ToString()); HttpContext.Session.SetString("BeginDate", item["POSITION_BEGIN_DATE"].ToString()); HttpContext.Session.SetString("EndDate", item["POSITION_END_DATE"].ToString()); HttpContext.Session.SetString("Status", item["VOTING_STATUS"].ToString()); HttpContext.Session.SetString("Email", item["PRIMARY_EMAIL_ADDRESS"].ToString()); HttpContext.Session.SetString("Phone", item["PRIMARY_PHONE"].ToString()); HttpContext.Session.SetString("Comment", string.Empty); } return(Redirect("/ChapterOfficerEdit")); }
public async Task <ActionResult> OnGetAsync(string id) { string chapterId = HttpContext.Session.GetString("OfficerChapterId"); string str = HttpContext.Session.GetString("MyMemberId"); if (!string.IsNullOrEmpty(chapterId) && !string.IsNullOrEmpty(id)) { return(RedirectToPage("/Landing", new { id = str })); } String myparamList = "@master_customer_id"; String myspName = "ACR_GET_STATE_CHAPTER_PORTAL_SP"; String myparamValueList = ""; myparamValueList = HttpContext.Session.GetString("MyMemberId"); try { DataSet myDS = await Utility.AMS_Query_Result(myspName, myparamList, myparamValueList).ConfigureAwait(false); if (myDS.Tables.Count > 0) { foreach (DataTable tbl in myDS.Tables) { if (tbl.TableName == "Table") { if (tbl.Rows.Count > 0) { string pos = myDS.Tables[0].Rows[0]["CHAPTER_PORTAL_ADMIN_POSITION"] as string; string[] positions = pos.Split(','); int ii = positions.Length; string chptPosition = string.Empty; if (ii > 0) { foreach (string p in positions) { if (p == "CHAPTER_PORTAL_ADMIN") { chptPosition = p; break; } } if (string.IsNullOrEmpty(chptPosition)) { foreach (string p in positions) { if (p == "STAFF") { chptPosition = p; break; } } } } myChapters = new List <Chapter>(); int i = 0; while (i < myDS.Tables[0].Rows.Count) { chptPosition = VerifyUserAccess(myDS.Tables[0].Rows[i]["CHAPTER_CUSTOMER_ID"] as string, myDS.Tables[0].Rows[i]["IS_ACTIVE_OFFICER_ON_STATE_CHAPTER"] as string, myDS.Tables[0].Rows[i]["IS_CSC_LIASON"] as string, myDS.Tables[0].Rows[i]["IS_ACTIVE_MEMBER_ON_COMMITTEE_OF_CHAPTERS"] as string, chptPosition); if (!string.IsNullOrEmpty(chptPosition)) { Chapter item = new Chapter(myDS.Tables[0].Rows[i]["NAME_OF_CHAPTER"] as string, myDS.Tables[0].Rows[i]["CHAPTER_CUSTOMER_ID"] as string); myChapters.Add(item); } i++; } } } } } } catch { } //if (myChapters == null) //{ // myChapters = new List<Chapter>(); //} //if (myChapters.Count<1) //{ // Chapter item = new Chapter("American College of Radiology", "05040222"); // myChapters.Add(item); // item = new Chapter("Virginia Association of Radiology", "05040222"); // myChapters.Add(item); //} return(null); }
public async Task <dynamic> GetCustomerChaptersAsync(string CustomerId) { //"02085603"; "00263707"; "05138380"; CustomerId = "05138380"; String myparamList = "@master_customer_id"; String myspName = "ACR_GET_STATE_CHAPTER_PORTAL_SP"; String myparamValueList = ""; myparamValueList = CustomerId; DataSet myDS = await Utility.AMS_Query_Result(myspName, myparamList, myparamValueList).ConfigureAwait(false); if (myDS.Tables.Count > 0) { foreach (DataTable tbl in myDS.Tables) { if (tbl.TableName == "Table") { if (tbl.Rows.Count > 0) { string pos = myDS.Tables[0].Rows[0]["CHAPTER_PORTAL_ADMIN_POSITION"] as string; string[] positions = pos.Split(','); int ii = positions.Length; string chptPosition = string.Empty; if (ii > 0) { foreach (string p in positions) { if (p == "CHAPTER_PORTAL_ADMIN") { chptPosition = p; break; } } if (string.IsNullOrEmpty(chptPosition)) { foreach (string p in positions) { if (p == "STAFF") { chptPosition = p; break; } } } } myChapters = new List <Chapter>(); int i = 0; while (i < myDS.Tables[0].Rows.Count) { chptPosition = VerifyUserAccess(myDS.Tables[0].Rows[i]["CHAPTER_CUSTOMER_ID"] as string, myDS.Tables[0].Rows[i]["IS_ACTIVE_OFFICER_ON_STATE_CHAPTER"] as string, myDS.Tables[0].Rows[i]["IS_CSC_LIASON"] as string, myDS.Tables[0].Rows[i]["IS_ACTIVE_MEMBER_ON_COMMITTEE_OF_CHAPTERS"] as string, chptPosition); if (!string.IsNullOrEmpty(chptPosition)) { Chapter item = new Chapter(myDS.Tables[0].Rows[i]["NAME_OF_CHAPTER"] as string, myDS.Tables[0].Rows[i]["CHAPTER_CUSTOMER_ID"] as string); myChapters.Add(item); } i++; } if (myChapters.Count > 0) { _chapterportalDAL.SaveOrUpdateChapters(myChapters); } } } } } return(myChapters); }
//public async Task<IActionResult> OnGetExportPDF() //{ // string chapterId = HttpContext.Session.GetString("OfficerChapterId"); // DataSet ds = Utility.AMS_Query_Result("ACR_GET_STATE_CHAPTER_ROSTER_PORTAL_SP", "@master_customer_id", chapterId).Result; // ProcessData(ds); // string colName = HttpContext.Session.GetString("MyColumn"); // string mySort = HttpContext.Session.GetString("MySort"); // if (string.IsNullOrEmpty(colName)) // { // colName = "LABEL_NAME"; // HttpContext.Session.SetString("MyColumn", colName); // } // if (string.IsNullOrEmpty(mySort)) // { // mySort = "asc"; // HttpContext.Session.SetString("MySort", mySort); // } // ds.Tables[0].DefaultView.Sort = (colName + " " + mySort); // OfficerList = ds.Tables[0].DefaultView.ToTable(); // // query data from database // await Task.Yield(); // IList<Report> report = new List<Report>(); // //var record = new Report(); // //record.MemberId = "MEMBER_CUSTOMER_ID"; // //record.Name = "LABEL_NAME"; // //record.Description = "POSITION_DESCRIPTION"; // //record.BeginDate = "POSITION_BEGIN_DATE"; // //record.EndDate = "POSITION_END_DATE"; // //record.Status = "VOTING_STATUS"; // //record.EmailAddress = "PRIMARY_EMAIL_ADDRESS"; // //record.Phone = "PRIMARY_PHONE"; // //report.Add(record); // foreach (DataRow item in OfficerList.Rows) // { // var record = new Report(); // record.MemberId = item["MEMBER_CUSTOMER_ID"].ToString(); // record.Name = item["LABEL_NAME"].ToString(); // record.Description = item["POSITION_DESCRIPTION"].ToString(); // record.BeginDate = item["POSITION_BEGIN_DATE"].ToString(); // record.EndDate = item["POSITION_END_DATE"].ToString(); // record.Status = item["VOTING_STATUS"].ToString(); // record.EmailAddress = item["PRIMARY_EMAIL_ADDRESS"].ToString(); // record.Phone = item["PRIMARY_PHONE"].ToString(); // report.Add(record); // } // string pdfName = $"UserList-{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.pdf"; //} public async Task <IActionResult> OnGetExportPDFEPPlus() { string chapterId = HttpContext.Session.GetString("OfficerChapterId"); DataSet ds = Utility.AMS_Query_Result("ACR_GET_STATE_CHAPTER_ROSTER_PORTAL_SP", "@master_customer_id", chapterId).Result; ProcessData(ds); string colName = HttpContext.Session.GetString("MyColumn"); string mySort = HttpContext.Session.GetString("MySort"); if (string.IsNullOrEmpty(colName)) { colName = "LABEL_NAME"; HttpContext.Session.SetString("MyColumn", colName); } if (string.IsNullOrEmpty(mySort)) { mySort = "asc"; HttpContext.Session.SetString("MySort", mySort); } ds.Tables[0].DefaultView.Sort = (colName + " " + mySort); OfficerList = ds.Tables[0].DefaultView.ToTable(); // query data from database await Task.Yield(); IList <Report> report = new List <Report>(); //var record = new Report(); //record.MemberId = "MEMBER_CUSTOMER_ID"; //record.Name = "LABEL_NAME"; //record.Description = "POSITION_DESCRIPTION"; //record.BeginDate = "POSITION_BEGIN_DATE"; //record.EndDate = "POSITION_END_DATE"; //record.Status = "VOTING_STATUS"; //record.EmailAddress = "PRIMARY_EMAIL_ADDRESS"; //record.Phone = "PRIMARY_PHONE"; //report.Add(record); foreach (DataRow item in OfficerList.Rows) { var record = new Report(); record.MemberId = item["MEMBER_CUSTOMER_ID"].ToString(); record.Name = item["LABEL_NAME"].ToString(); record.Description = item["POSITION_DESCRIPTION"].ToString(); record.BeginDate = item["POSITION_BEGIN_DATE"].ToString(); record.EndDate = item["POSITION_END_DATE"].ToString(); record.Status = item["VOTING_STATUS"].ToString(); record.EmailAddress = item["PRIMARY_EMAIL_ADDRESS"].ToString(); record.Phone = item["PRIMARY_PHONE"].ToString(); report.Add(record); } string pdfName = $"UserList-{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.pdf"; var data = new PdfReport().DocumentPreferences(doc => { doc.RunDirection(PdfRunDirection.LeftToRight); doc.Orientation(PageOrientation.Portrait); doc.PageSize(PdfPageSize.A4); doc.DocumentMetadata(new DocumentMetadata { Author = "ACR", Application = "PdfRpt", Keywords = "User List", Subject = "Chapter Officer Roster", Title = "Chapter Portal Officer Roster" }); doc.Compression(new CompressionSettings { EnableCompression = true, EnableFullCompression = true }); doc.PrintingPreferences(new PrintingPreferences { ShowPrintDialogAutomatically = false }); }) .DefaultFonts(fonts => { //fonts.Path(TestUtils.GetVerdanaFontPath(), // TestUtils.GetTahomaFontPath()); fonts.Size(9); fonts.Color(System.Drawing.Color.Black); }) .PagesFooter(footer => { footer.DefaultFooter(DateTime.Now.ToString("MM/dd/yyyy")); }) .PagesHeader(header => { header.CacheHeader(cache: false); // It's a default setting (true) to improve the performance. header.DefaultHeader(defaultHeader => { defaultHeader.RunDirection(PdfRunDirection.LeftToRight); //defaultHeader.ImagePath(TestUtils.GetImagePath("01.png")); defaultHeader.Message("Chapter Portal Officer Roster"); }); }) .MainTableTemplate(template => { template.BasicTemplate(BasicTemplate.ClassicTemplate); }) .MainTablePreferences(table => { table.ColumnsWidthsType(TableColumnWidthType.Relative); //table.NumberOfDataRowsPerPage(5); }) .MainTableDataSource(dataSource => { //var listOfRows = new List<Report> //{ // new User {Id = 0, LastName = "Test Degree Sign: 120°", Name = "Celsius", Balance = 0} //}; //for (var i = 1; i <= 200; i++) //{ // listOfRows.Add(new User { Id = i, LastName = "LastName " + i, Name = "Name " + i, Balance = i + 1000 }); //} dataSource.StronglyTypedList(report); }) .MainTableSummarySettings(summarySettings => { summarySettings.OverallSummarySettings("Summary"); summarySettings.PreviousPageSummarySettings("Previous Page Summary"); summarySettings.PageSummarySettings("Page Summary"); }) .MainTableColumns(columns => { //columns.AddColumn(column => //{ // column.PropertyName("rowNo"); // column.IsRowNumber(true); // column.CellsHorizontalAlignment(HorizontalAlignment.Center); // column.IsVisible(true); // column.Order(0); // column.Width(1); // column.HeaderCell("#"); //}); columns.AddColumn(column => { column.PropertyName <Report>(x => x.MemberId); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(1); column.Width(2); column.HeaderCell("Member Customer ID"); }); columns.AddColumn(column => { column.PropertyName <Report>(x => x.Name); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(1); column.Width(3); column.HeaderCell("Label Name"); column.Font(font => { font.Size(10); font.Color(System.Drawing.Color.Brown); }); }); columns.AddColumn(column => { column.PropertyName <Report>(x => x.Description); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(2); column.Width(4); column.HeaderCell("Position Description", horizontalAlignment: HorizontalAlignment.Left); }); columns.AddColumn(column => { column.PropertyName <Report>(x => x.BeginDate); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(3); column.Width(2); column.HeaderCell("Position Begin Date"); column.PaddingLeft(5); }); columns.AddColumn(column => { column.PropertyName <Report>(x => x.EndDate); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(4); column.Width(2); column.HeaderCell("Position End Date"); column.PaddingLeft(5); }); columns.AddColumn(column => { column.PropertyName <Report>(x => x.Status); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(5); column.Width(2); column.HeaderCell("Voting Status"); column.PaddingLeft(5); }); columns.AddColumn(column => { column.PropertyName <Report>(x => x.EmailAddress); column.CellsHorizontalAlignment(HorizontalAlignment.Left); column.IsVisible(true); column.Order(6); column.Width(3); column.HeaderCell("Primary Email Address"); column.PaddingLeft(5); }); columns.AddColumn(column => { column.PropertyName <Report>(x => x.Phone); column.CellsHorizontalAlignment(HorizontalAlignment.Left); column.IsVisible(true); column.Order(7); column.Width(2); column.HeaderCell("Primary Phone"); column.PaddingLeft(5); }); //columns.AddColumn(column => //{ // column.PropertyName<Report>(x => x.EndDate); // column.CellsHorizontalAlignment(HorizontalAlignment.Left); // column.IsVisible(true); // column.Order(4); // column.Width(2); // column.HeaderCell("Balance"); // column.ColumnItemsTemplate(template => // { // template.TextBlock(); // template.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString()) // ? string.Empty : string.Format("{0:n0}", obj)); // }); // column.AggregateFunction(aggregateFunction => // { // aggregateFunction.NumericAggregateFunction(AggregateFunction.Sum); // aggregateFunction.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString()) // ? string.Empty : string.Format("{0:n0}", obj)); // }); //}); }) .MainTableEvents(events => { events.DataSourceIsEmpty(message: "There is no data available to display."); }).MainTableSummarySettings(summarySettings => { summarySettings.PreviousPageSummarySettings("Cont."); summarySettings.OverallSummarySettings("Total: " + report.Count); //summarySettings.AllGroupsSummarySettings("Groups Sum"); }) .Export(export => { export.ToExcel(); export.ToCsv(); export.ToXml(); }).GenerateAsByteArray(); //.Generate(data => data.AsPdfStream(stream, closeStream: false)); return(File(data, "application/pdf", pdfName)); }
public async Task <IActionResult> OnGetExportExcelEPPlus() { string chapterId = HttpContext.Session.GetString("OfficerChapterId"); DataSet ds = Utility.AMS_Query_Result("ACR_GET_STATE_CHAPTER_ROSTER_PORTAL_SP", "@master_customer_id", chapterId).Result; ProcessData(ds); string colName = HttpContext.Session.GetString("MyColumn"); string mySort = HttpContext.Session.GetString("MySort"); if (string.IsNullOrEmpty(colName)) { colName = "LABEL_NAME"; HttpContext.Session.SetString("MyColumn", colName); } if (string.IsNullOrEmpty(mySort)) { mySort = "asc"; HttpContext.Session.SetString("MySort", mySort); } ds.Tables[0].DefaultView.Sort = (colName + " " + mySort); OfficerList = ds.Tables[0].DefaultView.ToTable(); // query data from database await Task.Yield(); IList <Report> report = new List <Report>(); var record = new Report(); record.MemberId = "MEMBER_CUSTOMER_ID"; record.Name = "LABEL_NAME"; record.Description = "POSITION_DESCRIPTION"; record.BeginDate = "POSITION_BEGIN_DATE"; record.EndDate = "POSITION_END_DATE"; record.Status = "VOTING_STATUS"; record.EmailAddress = "PRIMARY_EMAIL_ADDRESS"; record.Phone = "PRIMARY_PHONE"; report.Add(record); foreach (DataRow item in OfficerList.Rows) { record = new Report(); record.MemberId = item["MEMBER_CUSTOMER_ID"].ToString(); record.Name = item["LABEL_NAME"].ToString(); record.Description = item["POSITION_DESCRIPTION"].ToString(); record.BeginDate = item["POSITION_BEGIN_DATE"].ToString(); record.EndDate = item["POSITION_END_DATE"].ToString(); record.Status = item["VOTING_STATUS"].ToString(); record.EmailAddress = item["PRIMARY_EMAIL_ADDRESS"].ToString(); record.Phone = item["PRIMARY_PHONE"].ToString(); report.Add(record); } var stream = new MemoryStream(); ExcelPackage.LicenseContext = LicenseContext.NonCommercial; using (var package = new ExcelPackage(stream)) { var workSheet = package.Workbook.Worksheets.Add("Sheet1"); workSheet.Cells.LoadFromCollection(report, false); package.Save(); } stream.Position = 0; string excelName = $"UserList-{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.xlsx"; //return File(stream, "application/octet-stream", excelName); return(File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", excelName)); }
//private Boolean IsUserMemberOfGroup(SPGroup oGroup, SPUser user) //{ // Boolean userIsInGroup = false; // foreach (SPUser item in oGroup.Users) // { // if (item.UserToken.CompareUser(user.UserToken)) // { // userIsInGroup = true; // break; // } // } // return userIsInGroup; //} //private bool IsMobileBrowser() //{ // ////GETS THE CURRENT USER CONTEXT // HttpContext context = HttpContext.Current; // if (context.Request.ServerVariables["HTTP_USER_AGENT"] != null) // { // string[] mobiles = System.Configuration.ConfigurationManager.AppSettings["Mobile_Browsers"].Split(';'); // //Loop through each item in the list created above // //and check if the header contains that text // foreach (string s in mobiles) // { // if (context.Request.ServerVariables["HTTP_USER_AGENT"].ToLower().Contains(s.ToLower())) // { // return true; // } // } // } // return false; //} public async Task <ActionResult> OnGetAsync(string ct, string returnUrl) { serviceSoapClient client = null; string SSOWebService_service = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOWebService_service").Value; // "https://login75.acr.org/webservice/service.asmx"; string SSOLoginUrl = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOLoginUrl").Value; // "https://login75.acr.org/Login.aspx"; string SSOVendorIdentifier = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOVendorIdentifier").Value; // "2"; string SSOVendorUsername = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOVendorUsername").Value; // "TIMSS"; string SSOVendorPassword = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOVendorPassword").Value; // "A0468692C8563BF06ADED9F85BBE3F5D"; string SSOVendorBlock = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("SSOVendorBlock").Value; // "3AD654E5CF0CCBECB96A35049FD529C6"; Utility.PIWSAcc_Login = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("PIWSAcc_Login").Value; // "airpapplication"; Utility.PIWSAcc_Password = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("PIWSAcc_Password").Value; // "*AiRPmor1!"; Utility.Pws_Acc_OrgId = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("Pws_Acc_OrgId").Value; // "acr"; Utility.Pws_Acc_OrgUnitId = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("Pws_Acc_OrgUnitId").Value; // "acr"; Utility.PersonifySSOWebService_Default = Configuration.GetSection("MyConfiguration").GetSection("SSO").GetSection("PersonifySSOWebService_Default").Value; // "https://personifyws75.acr.org/SimpleWebService/Default.asmx"; try { bool acriCookie = Request.Cookies["ACRICookie"] != null ? true : false; if (ct == null) { string _connType = "http"; if (Request.IsHttps) { _connType = "https"; } returnUrl = string.Empty; string ssoURL = string.Empty; string rURL = String.Format("{0}|{1}://{2}{3}", GetTimeStamp(), _connType, Request.Headers["HOST"], returnUrl); var basicHttpBinding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport); basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; var endpointAddress = new EndpointAddress(new Uri(SSOWebService_service)); client = new serviceSoapClient(basicHttpBinding, endpointAddress); if (client.State == System.ServiceModel.CommunicationState.Faulted) { client.Abort(); client = new serviceSoapClient(basicHttpBinding, endpointAddress); } var vt = await client.VendorTokenEncryptAsync(SSOVendorUsername, SSOVendorPassword, SSOVendorBlock, rURL).ConfigureAwait(false); if (acriCookie) { ssoURL = String.Format( "{0}?vi={1}&vt={2}&DPLF=Y", SSOLoginUrl, SSOVendorIdentifier, vt.VendorToken); } else { ssoURL = String.Format( "{0}?vi={1}&vt={2}", SSOLoginUrl, SSOVendorIdentifier, vt.VendorToken); } client.Abort(); client = null; return(Redirect(ssoURL)); } else { var basicHttpBinding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport); basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; var endpointAddress = new EndpointAddress(new Uri(SSOWebService_service)); client = new serviceSoapClient(basicHttpBinding, endpointAddress); if (client.State == System.ServiceModel.CommunicationState.Faulted) { client.Abort(); client = new serviceSoapClient(basicHttpBinding, endpointAddress); } string encCusToken = ct; var decCt = await client.CustomerTokenDecryptAsync(SSOVendorUsername, SSOVendorPassword, SSOVendorBlock, encCusToken).ConfigureAwait(false); //HttpContext.Session.SetString("MyToken", decCt.CustomerToken); var validCT = await client.SSOCustomerTokenIsValidAsync(SSOVendorUsername, SSOVendorPassword, decCt.CustomerToken).ConfigureAwait(false); var customerToken = validCT.NewCustomerToken; HttpContext.Session.SetString("MyToken", customerToken); var fullCustomerIdentifier = await client.TIMSSCustomerIdentifierGetAsync(SSOVendorUsername, SSOVendorPassword, customerToken).ConfigureAwait(false); string customerId = fullCustomerIdentifier.CustomerIdentifier; string masterCustomerId = customerId.Remove(customerId.IndexOfAny(new char[] { '|' }));; client.Abort(); client = null; String myparamList = "@master_customer_id"; String myspName = "ACR_GET_STATE_CHAPTER_PORTAL_SP"; String myparamValueList = ""; myparamValueList = masterCustomerId; HttpContext.Session.SetString("MyMemberId", masterCustomerId); try { DataSet myDS = await Utility.AMS_Query_Result(myspName, myparamList, myparamValueList).ConfigureAwait(false); if (myDS.Tables.Count > 0) { foreach (DataTable tbl in myDS.Tables) { if (tbl.TableName == "Table") { if (tbl.Rows.Count > 0) { string pos = myDS.Tables[0].Rows[0]["CHAPTER_PORTAL_ADMIN_POSITION"] as string; string chapterId = myDS.Tables[0].Rows[0]["CHAPTER_CUSTOMER_ID"] as string; string[] positions = pos.Split(','); int ii = positions.Length; string chptPosition = string.Empty; if (ii > 0) { foreach (string p in positions) { if (p == "CHAPTER_PORTAL_ADMIN") { chptPosition = p; break; } } if (string.IsNullOrEmpty(chptPosition)) { foreach (string p in positions) { if (p == "STAFF") { chptPosition = p; break; } } } } int i = 0; int multipleChap = 0; string chapterName = string.Empty; while (i < myDS.Tables[0].Rows.Count) { chptPosition = VerifyUserAccess(myDS.Tables[0].Rows[i]["CHAPTER_CUSTOMER_ID"] as string, myDS.Tables[0].Rows[i]["IS_ACTIVE_OFFICER_ON_STATE_CHAPTER"] as string, myDS.Tables[0].Rows[i]["IS_CSC_LIASON"] as string, myDS.Tables[0].Rows[i]["IS_ACTIVE_MEMBER_ON_COMMITTEE_OF_CHAPTERS"] as string, chptPosition); if (!string.IsNullOrEmpty(chptPosition)) { chapterId = myDS.Tables[0].Rows[i]["CHAPTER_CUSTOMER_ID"] as string; chapterName = myDS.Tables[0].Rows[i]["NAME_OF_CHAPTER"] as string; multipleChap++; } i++; } if (string.IsNullOrEmpty(chptPosition) && masterCustomerId == "05054397") { chptPosition = "CHAPTER_PORTAL_ADMIN"; chapterName = "Virginia Chapter of the ACR"; //HttpContext.Session.SetString("OfficerChapterId", "05040222"); } if (string.IsNullOrEmpty(chptPosition)) { return(RedirectToPage("/Error", new { Id = "Sorry that you are not allowed to log in. Please contact ACR staff for assistance." })); } HttpContext.Session.SetString("OfficerChapterId", chapterId); HttpContext.Session.SetString("OfficerChapterName", chapterName); var claims = new[] { new Claim(ClaimTypes.Name, masterCustomerId), new Claim(ClaimTypes.Role, chptPosition) }; var identity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme); await HttpContext.SignInAsync( CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(identity)); string str = HttpContext.Session.GetString("MyMemberId"); if (multipleChap > 1) { HttpContext.Session.SetString("OfficerChapterId", string.Empty); return(RedirectToPage("/Chapters", new { id = masterCustomerId })); } else { return(RedirectToPage("/Landing", new { id = masterCustomerId })); } } } } } } catch (Exception ex) { string error = ex.Message; _logger.LogError(ex, error); } return(RedirectToPage("/Error", new { Id = "Sorry that you are not allowed to log in. Please contact ACR staff for assistance." })); } } catch (TimeoutException ex) { string error = ex.Message; _logger.LogError(ex, error); if (client != null) { client.Abort(); } } catch (FaultException <string> ex) { string error = ex.Message; _logger.LogError(ex, error); if (client != null) { client.Abort(); } } catch (FaultException ex) { string error = ex.Message; _logger.LogError(ex, error); if (client != null) { client.Abort(); } } catch (CommunicationException ex) { string error = ex.Message + ex.StackTrace; _logger.LogError(ex, error); if (client != null) { client.Abort(); } } catch (Exception ex) { string error = ex.Message; _logger.LogError(ex, error); if (client != null) { client.Abort(); } } return(RedirectToPage("/Error", new { Id = "You encountered some technical issues. Please contact System Administrator for assistance." })); }