public ActionResult StateNext() { IQueryable <StateContextModel> users = (IQueryable <StateContextModel>)Session["users"]; if (users != null) { int pageindex = Convert.ToInt32(Session["pageindex"]); pageindex++; var filter = users.OrderBy(p => p.StateId).Skip(pageindex * PageSize).Take(PageSize); if (filter.Count() > 0) { Session["pageindex"] = pageindex; StateDetails obj = new StateDetails() { Status = true, ErrorMessage = "", StateList = filter }; return(Json(obj, JsonRequestBehavior.AllowGet)); } else { StateDetails obj = new StateDetails() { Status = false, ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.NoMoreInformationAvail : "आणखी माहिती उपलब्ध नाही" }; return(Json(obj, JsonRequestBehavior.AllowGet)); } } else { return(StateFirst()); } }
public ActionResult Update(tblState model) { var countries = objState.GetStates(); var test = countries.Where(p => p.StateName.ToUpper() == model.StateName.ToUpper() && p.CountryId == model.CountryId).FirstOrDefault(); StateDetails obj = new StateDetails(); if (test != null) { obj.Status = false; obj.ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.AlreadyExist : "हि माहिती आधीपासून उपलब्ध आहे."; } else { obj.Status = true; obj.ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.UserinformationSaveFailed : "माहितीमध्ये बदल करण्यात आला आहे."; objState.Update(model); } int pageindex = 0; var filter = countries.OrderBy(p => p.StateId).Skip(pageindex * PageSize).Take(PageSize); Session["users"] = countries; Session["pageindex"] = 0; obj.StateList = filter; return(Json(obj, JsonRequestBehavior.AllowGet)); }
public ActionResult StatePrev() { IQueryable <StateContextModel> users = (IQueryable <StateContextModel>)Session["users"]; if (users != null) { int pageindex = Convert.ToInt32(Session["pageindex"]); if (pageindex > 0) { pageindex--; var filter = users.OrderBy(p => p.StateId).Skip(pageindex * PageSize).Take(PageSize); Session["pageindex"] = pageindex; StateDetails obj = new StateDetails() { Status = true, ErrorMessage = "", StateList = filter, }; return(Json(obj, JsonRequestBehavior.AllowGet)); } else { StateDetails obj = new StateDetails() { Status = false, ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.FirstPage : "तुम्ही पहिल्याच पानावर आहात", }; return(Json(obj, JsonRequestBehavior.AllowGet)); } } else { return(StateFirst()); } }
public ActionResult StateLast() { var users = objState.GetStates(); StateDetails obj = new StateDetails(); int pageindex = Convert.ToInt32(Session["pageindex"]); pageindex++; obj.Status = true; if (users != null) { Session["pageindex"] = pageindex; if ((users.Count() % PageSize) == 0) { obj.StateList = users.OrderBy(p => p.StateId).Skip(users.Count() - 2).Take(PageSize); return(Json(obj, JsonRequestBehavior.AllowGet)); } else { int rem = users.Count() % PageSize; obj.StateList = users.OrderBy(p => p.StateId).Skip(users.Count() - rem).Take(PageSize); return(Json(obj, JsonRequestBehavior.AllowGet)); } } else { return(StateFirst()); } }
public ActionResult Search(string prefix) { var countries = objState.GetStates().Where(p => p.StateName.ToUpper() == prefix.ToUpper()); int pageindex = 0; var filter = countries.OrderBy(p => p.StateId).Skip(pageindex * PageSize).Take(PageSize); Session["users"] = countries; Session["pageindex"] = 0; if (filter.Count() > 0) { StateDetails obj = new StateDetails() { Status = true, StateList = filter }; return(Json(obj, JsonRequestBehavior.AllowGet)); } else { StateDetails obj = new StateDetails() { Status = false, ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.NoMoreInformationAvail : "आणखी माहिती उपलब्ध नाही" }; return(Json(obj, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// The cmbState_SelectedValueChanged. /// </summary> /// <param name="sender">The sender<see cref="object"/>.</param> /// <param name="e">The e<see cref="EventArgs"/>.</param> private void cmbState_SelectedValueChanged(object sender, EventArgs e) { if (cmbState.SelectedItem != null) { StateDetails selectedState = (StateDetails)cmbState.SelectedItem; LoadCityDetails(Convert.ToInt32(selectedState.StateID)); } }
public void AddSuperState_throws_exception_if_existing_different_sub_state() { var superState1 = new StateDetails <SaleState, SaleEvent>(SaleState.ChangeDue); var superState2 = new StateDetails <SaleState, SaleEvent>(SaleState.Complete); var sut = new StateDetails <SaleState, SaleEvent>(SaleState.Open); sut.AddSuperState(superState1); Assert.Throws <InvalidOperationException>(() => sut.AddSuperState(superState2)); }
public virtual async Task Refresh(IDurableOrchestrationClient starter, StateDetails stateDetails, ExecuteActionRequest exActReq, ApplicationArchitectClient appArch, EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr, IdentityManagerClient idMgr, SecurityManagerClient secMgr, DocumentClient client) { // await EnsureUserEnterprise(entArch, entMgr, secMgr, stateDetails.EnterpriseLookup, stateDetails.Username); State.Loading = false; State.HomePage.Loading = false; State.SSL.Loading = false; }
public void CreateTransitionFrom_creates_transition_from_state() { var completeState = new StateDetails <SaleState, SaleEvent>(SaleState.Complete); var sut = new StateDetails <SaleState, SaleEvent>(SaleState.Open); var transition = sut.CreateTransitionFrom("completeTransition" , SaleEvent.Pay , completeState); Assert.Contains(transition, sut.TransitionsFrom); Assert.False(sut.IsFinalState); Assert.Contains(transition, completeState.TransitionsTo); Assert.False(completeState.IsStartingState); }
private static void PrintPuzzle(Puzzle puzzle) { Console.Clear(); PrintTemplates.Logo2(); Console.WriteLine("\n" + puzzle.CurrentState); StateDetails details = new StateDetails(puzzle); Console.Write(" F = " + details.F); Console.Write("\tG = " + details.G); Console.Write("\tH = " + details.H + "\n"); PrintTemplates.HowToPlay(); }
public void CreateTransitionTo_creates_transition_to_state() { var openState = new StateDetails <SaleState, SaleEvent>(SaleState.Open); var sut = new StateDetails <SaleState, SaleEvent>(SaleState.Complete); var transition = sut.CreateTransitionTo("completeTransition" , openState , SaleEvent.Pay); Assert.Contains(transition, sut.TransitionsTo); Assert.True(sut.IsFinalState); Assert.False(sut.IsStartingState); Assert.Contains(transition, openState.TransitionsFrom); Assert.True(openState.IsStartingState); Assert.False(openState.IsFinalState); }
public ActionResult StateFirst() { IQueryable <StateContextModel> users = (IQueryable <StateContextModel>)Session["users"]; int pageindex = 0; var filter = users.OrderBy(p => p.StateId).Skip(pageindex * PageSize).Take(PageSize); Session["users"] = users; Session["pageindex"] = 0; StateDetails obj = new StateDetails() { Status = true, StateList = filter }; return(Json(obj, JsonRequestBehavior.AllowGet)); }
public void AddSuperState_adds_super_state() { var superState = new StateDetails <SaleState, SaleEvent>(SaleState.ChangeDue); var sut = new StateDetails <SaleState, SaleEvent>(SaleState.Open); sut.AddSuperState(superState); Assert.True(sut.HasSuperState); Assert.False(superState.HasSuperState); Assert.True(superState.IsSuperState); Assert.False(sut.IsSuperState); Assert.Same(superState, sut.SuperState); Assert.Contains(sut, superState.SubStates); }
/// <summary> /// The AssignDevoteeDetails. /// </summary> /// <returns>The <see cref="Devotee"/>.</returns> private Devotee AssignDevoteeDetails() { Devotee devotee = new Devotee(); devotee.ReceiptNumber = Convert.ToInt32(txtReceiptNumber.Text); devotee.DevoteeName = Convert.ToString(txtName.Text); devotee.Address = Convert.ToString(txtAddress.Text); CountryDetails selCountry = (CountryDetails)cmbCountry.SelectedItem; devotee.CountryCode = Convert.ToInt32(selCountry.CountryID); devotee.Country = Convert.ToString(selCountry.CountryName); StateDetails selState = (StateDetails)cmbState.SelectedItem; devotee.StateCode = Convert.ToInt32(selState.StateID); devotee.State = Convert.ToString(selState.StateName); CityDetails selCity = (CityDetails)cmbCity.SelectedItem; devotee.CityCode = Convert.ToInt32(selCity.CityID); devotee.City = Convert.ToString(selCity.CityName); devotee.Amount = 500; devotee.ReceiptCreatedDate = DateTime.Now.Date; devotee.AnadhanamDate = Convert.ToDateTime(dtAnadhanamDate.Value.Date); devotee.ContactNumber = Convert.ToString(txtMobileNumber.Text); if (cmbPaymentMode.SelectedIndex == 1) { devotee.PaymentMode = PaymentMode.CHEQUE; devotee.ChequeNo = Convert.ToString(txtChequeNumber.Text); devotee.ChequeDate = Convert.ToDateTime(dtChequeDate.Value.Date); devotee.ChequeDrawn = Convert.ToString(txtDrawnOn.Text); } else { devotee.PaymentMode = PaymentMode.CASH; } return(devotee); }
public virtual async Task <Status> Refresh(EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr, IdentityManagerClient idMgr, SecurityManagerClient secMgr, StateDetails stateDetails) { await EnsureUserEnterprise(entArch, entMgr, secMgr, stateDetails.EnterpriseLookup, stateDetails.Username); await Task.WhenAll( HasLicenseAccess(idMgr, stateDetails.EnterpriseLookup, stateDetails.Username) ); await Task.WhenAll( EnsureAPISubscription(entArch, stateDetails.EnterpriseLookup, stateDetails.Username), LoadAPIOptions() ); State.Loading = false; return(Status.Success); }
protected virtual async Task <Status> refreshDataFlow(LimitedDataFlowManagementStateHarness harness, ILogger log, StateDetails stateDetails) { await harness.Mock(appMgr, appDev, entMgr, stateDetails.EnterpriseLookup, stateDetails.Host); return(Status.Success); }
protected virtual async Task <Status> refreshDataApps(LimitedDataAppsManagementStateHarness harness, ILogger log, StateDetails stateDetails) { harness.Mock(stateDetails.EnterpriseLookup, stateDetails.Host); return(Status.Success); }
protected virtual async Task <Status> refreshTours(ToursManagementStateHarness harness, ILogger log, StateDetails stateDetails) { await harness.RefreshTours(idMgr, stateDetails.EnterpriseAPIKey, stateDetails.Username); return(Status.Success); }
/// <summary> /// The ValidateDevoteeDetails. /// </summary> /// <returns>The <see cref="bool"/>.</returns> internal bool ValidateDevoteeDetails() { bool blnSubmit = true; if (string.IsNullOrWhiteSpace(txtMobileNumber.Text) && txtMobileNumber.Text.Length <= 10) { blnSubmit = false; MessageBox.Show("Please enter valid mobile number !...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(blnSubmit); } if (string.IsNullOrWhiteSpace(txtReceiptNumber.Text)) { blnSubmit = false; MessageBox.Show("Please enter valid receipt number !...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(blnSubmit); } if (string.IsNullOrWhiteSpace(txtName.Text)) { blnSubmit = false; MessageBox.Show("Please enter valid devotee Name !...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(blnSubmit); } if (string.IsNullOrWhiteSpace(txtAddress.Text)) { blnSubmit = false; MessageBox.Show("Please enter valid devotee address !...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(blnSubmit); } CountryDetails country = (CountryDetails)cmbCountry.SelectedItem; if (string.IsNullOrWhiteSpace(country.CountryName)) { blnSubmit = false; MessageBox.Show("Please choose county details !...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(blnSubmit); } StateDetails state = (StateDetails)cmbState.SelectedItem; if (string.IsNullOrWhiteSpace(state.StateName)) { blnSubmit = false; MessageBox.Show("Please choose state details !...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(blnSubmit); } CityDetails city = (CityDetails)cmbCity.SelectedItem; if (string.IsNullOrWhiteSpace(city.CityName)) { blnSubmit = false; MessageBox.Show("Please choose city details !...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(blnSubmit); } if (dtAnadhanamDate.Value.Day == 1 && dtAnadhanamDate.Value.Month == 1) { blnSubmit = false; MessageBox.Show("Anadhanam cannot be made on this day,please choose other date !...", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return(blnSubmit); } else if (dtAnadhanamDate.Value.Date > DateTime.Now.AddMonths(4).Date) { blnSubmit = false; string strMessage = "Anadhanam date must not exceed more than 4 months (" + (DateTime.Now.AddMonths(4).Date).ToString("dd-MMM-yyyy") + ")!..."; MessageBox.Show(strMessage, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return(blnSubmit); } else if (dtAnadhanamDate.Value.Date < DateTime.Now.Date) { blnSubmit = false; MessageBox.Show("Anadhanam date must be Today or Above,You cannot select past date !...", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return(blnSubmit); } if (!string.IsNullOrWhiteSpace(Convert.ToString(cmbPaymentMode.Text.ToUpper()))) { string strPaymentMode = Convert.ToString(cmbPaymentMode.Text.ToUpper()); if (strPaymentMode == "CHEQUE") { if (string.IsNullOrWhiteSpace(txtChequeNumber.Text)) { blnSubmit = false; MessageBox.Show("Please enter cheque number & proceed !...", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return(blnSubmit); } if (string.IsNullOrWhiteSpace(txtDrawnOn.Text)) { blnSubmit = false; MessageBox.Show("Please enter cheque drawn details & Proceed !...", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return(blnSubmit); } } } else { blnSubmit = false; MessageBox.Show("Please Select Payment Mode!...", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return(blnSubmit); } return(blnSubmit); }
protected virtual async Task <Status> refreshUserManagement(UserManagementStateHarness harness, ILogger log, StateDetails stateDetails, RefreshUserRequest request) { harness.ConfigureInfrastructureOptions(); harness.ConfigureJourneys(); harness.ConfigurePersonas(); harness.SetUserType(harness.State.Personas.FirstOrDefault().Lookup.As <UserTypes>()); harness.DetermineSetupStep(); await Task.WhenAll(new[] { harness.LoadRegistrationHosts(entMgr, stateDetails.EnterpriseAPIKey), harness.HasDevOpsOAuth(entMgr, stateDetails.EnterpriseAPIKey, stateDetails.Username) }); return(Status.Success); }
protected virtual async Task <Status> refreshUserBilling(UserBillingStateHarness harness, ILogger log, StateDetails stateDetails, RefreshBillingRequest request) { await harness.Refresh(entMgr, secMgr, billingEntApiKey, stateDetails.Username, request.LicenseType); return(Status.Success); }
protected virtual async Task <Status> refreshUserBilling(UserBillingStateHarness harness, ILogger log, StateDetails stateDetails, RefreshBillingRequest request) { await harness.Refresh(entBillingMgr, idAccessSvc, secMgr, stateDetails.EnterpriseLookup, stateDetails.Username, request.LicenseType); return(Status.Success); }
protected virtual async Task <Status> refreshJourneys(JourneysManagementStateHarness harness, ILogger log, StateDetails stateDetails) { await harness.RefreshJourneys(); return(Status.Success); }
public virtual async Task <Status> Run([HttpTrigger] HttpRequest req, ILogger log, [SignalR(HubName = UserManagementState.HUB_NAME)] IAsyncCollector <SignalRMessage> signalRMessages, [Blob("state-api", FileAccess.ReadWrite)] CloudBlobContainer blobContainer) { using var bodyRdr = new StreamReader(req.Body); var json = await bodyRdr.ReadToEndAsync(); var stripeEvent = EventUtility.ParseEvent(json); var stateDetails = new StateDetails(); if (stripeEvent.Type == Events.ChargeFailed) { var charge = (Charge)stripeEvent.Data.Object; var userEmail = charge.BillingDetails.Email; stateDetails = new StateDetails() { EnterpriseLookup = req.Query["lcu-ent-lookup"], HubName = UserManagementState.HUB_NAME, StateKey = "billing", Username = userEmail }; } else { stateDetails = new StateDetails() { EnterpriseLookup = req.Query["lcu-ent-lookup"], HubName = UserManagementState.HUB_NAME, StateKey = "billing", Username = "" }; } log.LogInformation($"State Details {stateDetails.ToJSON()}"); var stateBlob = blobContainer.GetBlockBlobReference($"{stateDetails.EnterpriseLookup}/{stateDetails.HubName}/{stateDetails.Username}/{stateDetails.StateKey}"); var exActReq = await req.LoadBody <ExecuteActionRequest>(); //If Stripe.Event doesn't work... MetadataModel return(await stateBlob.WithStateHarness <UserBillingState, Stripe.Event, UserBillingStateHarness>(stateDetails, exActReq, signalRMessages, log, async (harness, dataReq) => { log.LogInformation($"Executing CompletePayment Action."); var status = Status.Initialized; switch (stripeEvent.Type) { case Events.ChargeFailed: status = await harness.HandleChargeFailed(entBillingMgr, idMgr, stateDetails.EnterpriseLookup, stateDetails.Username, stripeEvent); break; default: status = Status.Success.Clone("Stripe Web Hook not handled"); break; } log.LogInformation($"Completed execution of web hook with: {status.ToJSON()}"); return status; })); }
public async Task <string> AddInstructorAudioMedia(string instructorId, string firstName, string lastName, string title, int durationInMinutes, DateTime recordingDate, DateTime uploadDate, byte[] streamedFileContent) { // TODO: calculate this some way automatically... someday string fileExtension = "m4a"; // Generate Container Name - InstructorSpecific string containerName = $"{firstName[0].ToString().ToLower()}{lastName.ToLower()}-{instructorId}"; // TODO: calculate this some way automatically... someday string contentType = "audio/mp4"; // TODO: calculate this some way automatically... someday FileType fileType = FileType.audio; string authorName = $"{firstName} {lastName}"; string authorShortName = $"{firstName[0]}{lastName}"; string description = $"{authorShortName} - {title}"; // TODO: Get this from FFMPEG... someday long duration = (durationInMinutes * 60000); // Generate new filename string fileName = $"{firstName[0].ToString().ToLower()}{lastName.ToLower()}-{Guid.NewGuid()}"; // TODO: Move this to a BlobCreatedResponse object BlobCreatedEvent blobCreatedResult; try { // Update file properties in storage Dictionary <string, string> fileProperties = new Dictionary <string, string>(); fileProperties.Add("ContentType", contentType); // update file metadata in storage Dictionary <string, string> metadata = new Dictionary <string, string>(); metadata.Add("author", authorShortName); metadata.Add("tite", title); metadata.Add("description", description); metadata.Add("duration", duration.ToString()); metadata.Add("recordingDate", recordingDate.ToString()); metadata.Add("uploadDate", uploadDate.ToString()); var fileNameWExt = $"{fileName}.{fileExtension}"; blobCreatedResult = await _cloudStorageService.CreateBlob(containerName, fileNameWExt, streamedFileContent, "audio", fileProperties, metadata); } catch (StorageException e) { throw e; } Model.Media media = Model.Media.Create(string.Empty, instructorId, authorName, fileName, fileType, fileExtension, recordingDate, uploadDate, ContentDetails.Create(title, description, duration, blobCreatedResult.Size, 0, new List <string>()), StateDetails.Create(StatusType.STAGED, DateTime.MinValue, DateTime.UtcNow, DateTime.MaxValue), Manifest.Create(new Dictionary <string, string>())); // upload to MongoDB if (!blobCreatedResult.Error) { var mapper = new Mapper(_mapperConfiguration); var dao = mapper.Map <ContentDAO>(media); try { await _db.Content.InsertOneAsync(dao); } catch (Exception) { return(string.Empty); } return(dao.Id.ToString()); } else { // metadata wasn't stored, remove blob await _cloudStorageService.DeleteBlob(containerName, fileName, "audio"); throw new AddMediaException($"An issue occurred during media upload: rolling back storage change"); } }
public ReportingManagementState(StateDetails stateDetails) { this.StateDetails = stateDetails; }
protected virtual async Task <Status> refreshItineraries(ItinerariesStateHarness harness, ILogger log, StateDetails stateDetails) { await harness.RefreshItineraries(amblGraph, stateDetails.EnterpriseLookup, stateDetails.Username); return(Status.Success); }