public DeviationList()
        {
            InitializeComponent();

            deviationModel = new DeviationModel();
            autorisation   = new Autorisation();
            emailSender    = new EmailSender();
            languageModel  = new LanguageModel();

            //DataGridViw Configuration
            this.DataViewConfiguration();

            //initilize
            this.setLabelDeviationNumber();

            //init dates
            this.initdates();

            //show deviation list
            this.showDeviationList();

            //set  language
            if (LanguageName.languageName != "DeviationManager.Lang.language_en")
            {
                this.setLanguage();
            }

            this.DeviationDataGridView.Columns[9].DefaultCellStyle.ForeColor = Color.Blue;
        }
Beispiel #2
0
        private void Perform_Click(object sender, EventArgs e)
        {
            Operations operations = new Operations();

            ResultOut.Text = operations.GetResultCalculation(Autorisation.GetUserId(), expressionInput.Text);
            UpdateCalculations();
        }
Beispiel #3
0
 public MainPage AutorisationFields(Autorisation autorisation)
 {
     UserLogin.SendKeys(autorisation.Email);
     UserPassword.SendKeys(autorisation.Password);
     SignInButton.Click();
     return(this);
 }
Beispiel #4
0
        public void BuyTicketWithNoCVVCode()
        {
            #region TestData
            const string ERA = "Введите корректные данные.";
            #endregion

            Route           route          = RouteCreator.WithAllPropertiesJitomir();
            User            user           = UserCreator.CorrectParameters();
            MainPage        fillFormsRoute = new MainPage(Driver);
            Autorisation    autorisation   = AutorisationCreator.RightParameters();
            SelectTrainPage selectOther    = new SelectTrainPage(Driver);
            Payment         payment        = PaymentCreator.AllCorrect();
            PaymentPage     paymentPage    = new PaymentPage(Driver);
            MainPage        mainPage       = new MainPage(Driver);
            mainPage
            .MyTicket()
            .AutorisationFields(autorisation);
            fillFormsRoute
            .FillFieldFrom(route)
            .SelectTodayDate()
            .Submit();
            selectOther
            .FillForm()
            .FillUserForm(user)
            .AcceptIATA()
            .BuyTicket()
            .BuyBuyTicket();
            paymentPage
            .FillForm(payment)
            .CompleteOrder();
            Assert.AreEqual(paymentPage.NoCVVErrorMessage(), ERA);
        }
Beispiel #5
0
 public MainForm()
 {
     InitializeComponent();
     label3.Text = $"User name: {Autorisation.GetName()}";
     if (!Autorisation.IsAdmin())
     {
         tabControl1.TabPages.Remove(Settings);
     }
     UpdateCalculations();
     UpdateCosts();
 }
Beispiel #6
0
        public PrincipalWin()
        {
            InitializeComponent();
            this.autorisation = new Autorisation();
            this.emailSender  = new EmailSender();

            deviationModel = new DeviationModel();
            this.init();

            //initilize deviation list
            this.setLabelDeviationNumber();

            this.DeviationDataGridView.Columns[9].DefaultCellStyle.ForeColor = Color.Goldenrod;
        }
Beispiel #7
0
        public void AutorisationAccept()
        {
            #region TestData
            const string ERA = "Мой билет";
            #endregion

            Autorisation autorisation = AutorisationCreator.RightParameters();
            MainPage     mainPage     = new MainPage(Driver);
            mainPage
            .MyTicket()
            .AutorisationFields(autorisation);

            Assert.AreEqual(mainPage.CheckLogOutText(), ERA);
        }
Beispiel #8
0
        public void AutorisationFail()
        {
            #region TestData
            const string ERA = "Вам не удалось авторизоваться. Для ознакомления с возможными причинами, перейдите по ссылке";
            #endregion

            Autorisation autorisation = AutorisationCreator.WrongEmail();
            MainPage     mainPage     = new MainPage(Driver);
            mainPage
            .MyTicket()
            .AutorisationFields(autorisation);

            Assert.AreEqual(mainPage.AutorisationErrorCheck(), ERA);
        }
Beispiel #9
0
        //make the approvement
        private void approvementGroupDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (this.actionType == "newDeviation")
            {
                MessageBox.Show(this.languageModel.getString("alertSaveDeviationFirst"), "Infos", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                if (e.ColumnIndex == 8)
                {
                    //Get The Approvement ID
                    var    approvementID         = (int)this.approvementGroupDataGrid.Rows[e.RowIndex].Cells[0].Value;
                    String approvementValidation = this.validateApprovement((DataGridViewRow)this.approvementGroupDataGrid.Rows[e.RowIndex]);
                    if (approvementValidation == "valid")
                    {
                        //make Sure that the user has the Right to set Approvement
                        Autorisation aut       = new Autorisation();
                        String       toApprove = aut.cannApprove(approvementID);
                        if (toApprove == "canApprove")
                        {
                            //make the Approvement
                            Approvement approvement = deviationModel.getApprovement(approvementID);
                            if (approvement != null)
                            {
                                approvement.name     = this.approvementGroupDataGrid.Rows[e.RowIndex].Cells[2].Value.ToString();
                                approvement.approved = (bool)this.approvementGroupDataGrid.Rows[e.RowIndex].Cells[3].Value;
                                approvement.rejected = (bool)this.approvementGroupDataGrid.Rows[e.RowIndex].Cells[4].Value;
                                approvement.signed   = (bool)this.approvementGroupDataGrid.Rows[e.RowIndex].Cells[5].Value;
                                approvement.date     = DateTime.Now;
                                if (this.approvementGroupDataGrid.Rows[e.RowIndex].Cells[7].Value != null)
                                {
                                    approvement.comment = this.approvementGroupDataGrid.Rows[e.RowIndex].Cells[7].Value.ToString();
                                }

                                deviationModel.updateApprovement(approvement);
                                MessageBox.Show(this.languageModel.getString("approvementDone"), "Infos", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        else
                        {
                            MessageBox.Show(this.languageModel.getString("actionFailed") + toApprove, "Infos", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        MessageBox.Show(this.languageModel.getString("inputsRequired") + approvementValidation, "Infos", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }

                //__ok for approvement
                DataGridViewRow row = (DataGridViewRow)this.approvementGroupDataGrid.Rows[e.RowIndex];

                DataGridViewCheckBoxCell approved = (DataGridViewCheckBoxCell)row.Cells[3];
                DataGridViewCheckBoxCell rejected = (DataGridViewCheckBoxCell)row.Cells[4];

                if (e.ColumnIndex == 3)
                {
                    if (((bool)approved.Value == false) && ((bool)rejected.Value == true))
                    {
                        MessageBox.Show(this.languageModel.getString("alertApprovedRejected"));

                        //interupt checking approved checkbox
                        this.approvementGroupDataGrid.CancelEdit();
                    }
                }

                if (e.ColumnIndex == 4)
                {
                    if (((bool)approved.Value == true) && ((bool)rejected.Value == false))
                    {
                        MessageBox.Show(this.languageModel.getString("alertApprovedRejected"));

                        //interupt checking approved checkbox
                        this.approvementGroupDataGrid.CancelEdit();
                    }
                }

                if (e.ColumnIndex == 3 || e.ColumnIndex == 4)
                {
                    if (((bool)approved.Value == false) && ((bool)rejected.Value == false))
                    {
                        //set Username
                        if (actionType != "newDeviation")
                        {
                            String userWinName = System.DirectoryServices.AccountManagement.UserPrincipal.Current.DisplayName;
                            this.approvementGroupDataGrid.Rows[e.RowIndex].Cells[2].Value = userWinName;
                        }
                    }
                }
            }
        }
Beispiel #10
0
 public void UpdateAutorisation(Autorisation Autorisation)
 {
     _dbContext.Entry(Autorisation).State = EntityState.Modified;
     Save();
 }
Beispiel #11
0
 public void InsertAutorisation(Autorisation Autorisation)
 {
     _dbContext.Add(Autorisation);
     Save();
 }