示例#1
0
        /// <summary>
        /// Mark a command step as being completed
        /// </summary>
        /// <param name="stepName">
        /// The name of the step that has been completed
        /// </param>
        /// <param name="completionMessage">
        /// Additional text for the step completion
        /// </param>
        public async Task StepCompleted(string stepName,
                                        string completionMessage,
                                        string targetDomain         = "",
                                        string targetEntityType     = "",
                                        string targetEntityInstance = "")
        {
            if (!string.IsNullOrWhiteSpace(stepName))
            {
                EventStream esCmd = new EventStream(new EventStreamAttribute(MakeDomainCommandName(DomainName),
                                                                             CommandName,
                                                                             UniqueIdentifier),
                                                    context: _commandContext);

                StepCompleted evStep = new StepCompleted()
                {
                    StepName       = stepName,
                    Message        = completionMessage,
                    DateLogged     = DateTime.UtcNow,
                    DomainName     = targetDomain,
                    EntityTypeName = targetEntityType,
                    InstanceKey    = targetEntityInstance
                };

                await esCmd.AppendEvent(evStep);
            }
        }
 public void HandleEventInstance(StepCompleted eventInstance)
 {
     if (null != eventInstance)
     {
         _currentStatus = STATUS_RUNNING;
         _message       = $"Completed {eventInstance.StepName} - {eventInstance.Message} ";
     }
 }
 private void RollbackStep(TStep step)
 {
     StatusMessage = step.RollbackStatusMessage;
     _logger.Info($"{WorkflowName} - {StatusMessage}");
     StepStarted?.Invoke();
     step.RollBackAction?.Invoke(_context);
     StepCompleted?.Invoke();
 }
示例#4
0
        /// <summary>
        /// Notifies event handlers about step completion.
        /// </summary>
        /// <param name="result">Step result.</param>
        private void ReportStepResult(StepResult result)
        {
            StepCompleted stepCompleted = OnStepCompleted;

            if (stepCompleted != null)
            {
                stepCompleted(result);
            }
        }
    protected void lbtnNextStep_Click(object sender, EventArgs e)
    {
        try
        {
            string sss         = Session["SetupASPNETID"].ToString();
            Guid   setASPNETID = Guid.Parse(Session["SetupASPNETID"].ToString());
            int    setAccId    = Int32.Parse(Session["SetupAcountId"].ToString());
            DictionaryModel.Account account = entities.Accounts.FirstOrDefault(acc => acc.ASPNETID == setASPNETID);

            if (hdnEditPersonalInformation.Value == "") //New Account
            {
                account.FirstName = txtFirstName.Text.Trim();
                account.LastName  = txtLastName.Text.Trim();
                account.Country   = Int32.Parse((ddlCountry.SelectedValue != "0") ? ddlCountry.SelectedValue :"27");

                entities.SaveChanges();


                if (StepCompleted != null)
                {
                    NewAccountStepCompletedEventArgs args = new NewAccountStepCompletedEventArgs(NewAccountWizardSteps.PersonalInformation);

                    args.ASPNETID         = setASPNETID;
                    args.CurrentAccountId = setAccId;
                    args.CurrentCountryId = account.Country.Value;

                    StepCompleted.Invoke(this, args);
                }
            }
            else // Edit Account
            {
                account.FirstName = txtFirstName.Text.Trim();
                account.LastName  = txtLastName.Text.Trim();
                account.Country   = Int32.Parse((ddlCountry.SelectedValue != "0") ? ddlCountry.SelectedValue : "27");

                entities.SaveChanges();

                if (StepCompleted != null)
                {
                    NewAccountStepCompletedEventArgs args = new NewAccountStepCompletedEventArgs(NewAccountWizardSteps.PersonalInformation);

                    args.ASPNETID         = setASPNETID;
                    args.CurrentAccountId = SetupAccountId;
                    args.CurrentCountryId = account.Country.Value;

                    StepCompleted.Invoke(this, args);
                }
            }
        }
        catch
        {
            lblError.Text = "Възникна проблем, моля опитайте по-късно.";
        }
    }
        private void RunStep(TStep step)
        {
            StatusMessage = step.StatusMessage;
            _logger.Info($"{WorkflowName} - {StatusMessage}");

            _cancellationToken.ThrowIfCancellationRequested();

            StepStarted?.Invoke();
            step.ExecuteAction?.Invoke(_context);
            StepCompleted?.Invoke();
        }
示例#7
0
        private void Action_Completed(object sender, SessionStepResult result)
        {
            var action = (ITimelineStepViewModel)sender;

            if (Action == action)
            {
                ClearCallbacks();

                _execution.Result = result;

                StepCompleted?.Invoke(this, _execution);
            }
        }
示例#8
0
    protected void lbtnContinue_Click(object sender, EventArgs e)
    {
        if (StepCompleted != null)
        {
            NewAccountStepCompletedEventArgs args = new NewAccountStepCompletedEventArgs(NewAccountWizardSteps.SetupCompleted);

            Guid setASPNETID = Guid.Parse(Session["SetupASPNETID"].ToString());
            int  setAccId    = Int32.Parse(Session["SetupAcountId"].ToString());
            args.SetupCompleted   = 1;
            args.CurrentAccountId = setAccId;
            args.ASPNETID         = setASPNETID;

            StepCompleted.Invoke(this, args);
        }
    }
示例#9
0
        public void Update()
        {
            if (_type == BonusType.HorDestroyer)
            {
                if (_position1.X != _finalPosition1.X)
                {
                    Move(ref _position1.X, _finalPosition1.X);
                    if (Math.Abs(_position1.X - _startPosition1.X) > _step &&
                        Math.Abs(_position1.X - _startPosition1.X) % _step < _speed)
                    {
                        StepCompleted.Invoke(this, new EventArgs());
                    }
                }

                if (_position2.X != _finalPosition2.X)
                {
                    Move(ref _position2.X, _finalPosition2.X);
                    if (Math.Abs(_position2.X - _startPosition2.X) > _step &&
                        Math.Abs((_position2.X - _startPosition2.X)) % _step < _speed + 1)
                    {
                        StepCompleted.Invoke(this, new EventArgs());
                    }
                }
            }
            else
            {
                if (_position1.Y != _finalPosition1.Y)
                {
                    Move(ref _position1.Y, _finalPosition1.Y);
                    if (Math.Abs(_position1.Y - _startPosition1.Y) > _step &
                        Math.Abs(_position1.Y - _startPosition1.Y) % _step < _speed + 1)
                    {
                        StepCompleted.Invoke(this, new EventArgs());
                    }
                }

                if (_position2.Y != _finalPosition2.Y)
                {
                    Move(ref _position2.Y, _finalPosition2.Y);
                    if (Math.Abs(_position2.Y - _startPosition2.Y) > _step &&
                        Math.Abs(_position2.Y - _startPosition2.Y) % _step < _speed + 1)
                    {
                        StepCompleted.Invoke(this, new EventArgs());
                    }
                }
            }
        }
示例#10
0
        private bool Complete(ITimelineStepViewModel action)
        {
            ClearCallbacks();

            if (action != null && Action == action)
            {
                action.Completed -= Action_Completed;

                _execution.Result = action.Complete();      // Complete may be called twice

                StepCompleted?.Invoke(this, _execution);

                return(true);
            }

            return(false);
        }
示例#11
0
    protected void lbtnNextStep_Click(object sender, EventArgs e)
    {
        try
        {
            bool password = txtPassword.Text == txtConfirmPassword.Text;
            bool answer   = txtAnswer.Text == txtConfirmAnswer.Text;

            if (!password)
            {
                lblError.Text = "Въведените пароли не съвпадат.";
                return;
            }

            if (password && answer)
            {
                if (hdnEditAccountSecutiry.Value == "") //New Account
                {
                    DictionaryModel.Account account = new DictionaryModel.Account();

                    MembershipCreateStatus status;
                    MembershipUser         user = Membership.CreateUser(DateTime.Now.ToString("ddhhmmssfff"), txtPassword.Text, txtEmail.Text.Trim().ToLower(), txtQuestion.Text.Trim(), txtAnswer.Text.Trim(), chkApproved.Checked, out status);

                    if (status != MembershipCreateStatus.Success)
                    {
                        switch (status)
                        {
                        case MembershipCreateStatus.DuplicateEmail:
                            lblError.Text = "Въведеният Email адрес е зает.";
                            break;

                        case MembershipCreateStatus.DuplicateProviderUserKey:
                            lblError.Text = "Дублиращ се потребителски код.";
                            break;

                        case MembershipCreateStatus.DuplicateUserName:
                            lblError.Text = "Въведеното потребителско име е заето.";
                            break;

                        case MembershipCreateStatus.InvalidAnswer:
                            lblError.Text = "Въведохте невалиден отговор на тайният въпрос.";
                            break;

                        case MembershipCreateStatus.InvalidEmail:
                            lblError.Text = "Въведохте невалиден Email адрес.";
                            break;

                        case MembershipCreateStatus.InvalidPassword:
                            lblError.Text = "Въведохте невалидна парола.";
                            break;

                        case MembershipCreateStatus.InvalidProviderUserKey:
                            lblError.Text = "Невалиден потретбителски код.";
                            break;

                        case MembershipCreateStatus.InvalidQuestion:
                            lblError.Text = "Веведохте невалиден таен въпрос.";
                            break;

                        case MembershipCreateStatus.InvalidUserName:
                            lblError.Text = "Въведохте невалидно потребителско име.";
                            break;

                        case MembershipCreateStatus.ProviderError:
                            lblError.Text = "Възникна грешка, моля опитайте отново.";
                            break;

                        case MembershipCreateStatus.UserRejected:
                            lblError.Text = "Вашият профил е спрян.";
                            break;

                        default:
                            break;
                        }
                        return;
                    }

                    user.IsApproved = chkApproved.Checked;
                    user.Comment    = txtReminder.Text;
                    Membership.UpdateUser(user);
                    Roles.AddUserToRole(user.UserName, "User");

                    account.ASPNETID  = (Guid)user.ProviderUserKey;
                    account.FirstName = string.Empty;
                    account.LastName  = string.Empty;
                    entities.Accounts.AddObject(account);
                    entities.SaveChanges();



                    if (StepCompleted != null)
                    {
                        NewAccountStepCompletedEventArgs args = new NewAccountStepCompletedEventArgs(NewAccountWizardSteps.AccountSecurity);

                        Session["SetupASPNETID"] = args.ASPNETID = account.ASPNETID;
                        Session["SetupAcountId"] = args.CurrentAccountId = account.Id;

                        StepCompleted.Invoke(this, args);
                        //HideEditAddControls();
                    }
                }
                else //Edit Account
                {
                    MembershipUser user = Membership.GetUser(SetupASPNETID);

                    user.ChangePasswordQuestionAndAnswer(txtPassword.Text, txtQuestion.Text, txtAnswer.Text);
                    user.Comment    = txtReminder.Text;
                    user.IsApproved = chkApproved.Checked;
                    Membership.UpdateUser(user);
                    hdnEditAccountSecutiry.Value = null;

                    HideEditAddControls();

                    if (StepCompleted != null)
                    {
                        NewAccountStepCompletedEventArgs args = new NewAccountStepCompletedEventArgs(NewAccountWizardSteps.AccountSecurity);

                        args.ASPNETID = (Guid)user.ProviderUserKey;

                        StepCompleted.Invoke(this, args);
                    }
                }
            }
            else
            {
                lblError.Text = "Въведените отговори на тайният въпрос не съвпадат.";
            }
        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;// "Възникна проблем, моля опитайте по-късно.";
        }
    }
 private void choice_button_Click(object sender, EventArgs e)
 {
     StepCompleted?.Invoke(this, EventArgs.Empty);
 }
    protected void lbtnFinishStep_Click(object sender, EventArgs e)
    {
        try
        {
            Guid setASPNETID = (Guid)Session["SetupASPNETID"];
            int  setAccId    = Int32.Parse(Session["SetupAcountId"].ToString());
            DictionaryModel.Account account = entities.Accounts.FirstOrDefault(acc => acc.ASPNETID == setASPNETID);

            if (ddlArea.SelectedValue != "0")
            {
                account.Area = Int32.Parse(ddlArea.SelectedValue);
                if (ddlCity.SelectedValue != "0")
                {
                    account.City = Int32.Parse(ddlCity.SelectedValue);
                    if (ddlVillage.SelectedValue != "0")
                    {
                        account.Village = Int32.Parse(ddlVillage.SelectedValue);
                    }
                }
            }

            int phone;
            if (Int32.TryParse(txtPhone.Text, out phone))
            {
                account.Phone = phone;
            }

            account.Address = txtAddress.Text;
            account.Notes   = txtNotes.Text;

            if (fuSource.HasFile)
            {
                string fileExt = System.IO.Path.GetExtension(fuSource.PostedFile.FileName);
                if (fileExt == ".jpg" || fileExt == ".jpeg" || fileExt == ".png" || fileExt == ".bmp")
                {
                    if ((fuSource.PostedFile.ContentLength > 0) && (fuSource.PostedFile.ContentLength < 10000000))
                    {
                        string currentTime   = DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "");
                        string fileName      = fuSource.PostedFile.FileName;
                        string fileDirectory = Server.MapPath("~/Files/FileUpload");
                        string SaveLocation  = fileDirectory + "\\" + currentTime + fileName;
                        //string displayedImgThumb = Server.MapPath("~/Files/FileUpload") + "/Thumb/";
                        if (!Directory.Exists(fileDirectory))
                        {
                            Directory.CreateDirectory(fileDirectory);
                        }

                        try
                        {
                            fuSource.PostedFile.SaveAs(SaveLocation);
                            //System.Drawing.Image myimg = System.Drawing.Image.FromFile(SaveLocation);
                            //myimg = myimg.GetThumbnailImage(100, 100, null, IntPtr.Zero);
                            //myimg.Save(displayedImgThumb + SaveLocation, myimg.RawFormat);
                            account.Picture = currentTime + fileName;
                        }
                        catch (Exception ex)
                        {
                            lblError.Text = "Error: " + ex.Message;
                        }
                    }
                    else
                    {
                        lblError.Text = "Файла е прекалено голям.";
                    }
                }
            }

            entities.SaveChanges();

            if (StepCompleted != null)
            {
                NewAccountStepCompletedEventArgs args = new NewAccountStepCompletedEventArgs(NewAccountWizardSteps.AdditionalInformation);

                args.ASPNETID         = setASPNETID;
                args.CurrentAccountId = setAccId;

                StepCompleted.Invoke(this, args);
            }
        }
        catch
        {
            lblError.Text = "Възникна проблем, моля опитайте по-късно.";
        }
    }
示例#14
0
 protected virtual void OnStepCompleted(DebuggeeThreadEventArgs e)
 {
     StepCompleted?.Invoke(this, e);
 }