void buttonPassword_Click(object sender, EventArgs e)
        {
            this.widgetEmailFeedback.Reset();
            this.widgetPasswordFeedback.Reset();

            FormChecker checker = new FormChecker();
            string password = checker.GetStringValue(new ControlReference(this.textPassword, "Password"), true);
            string confirm = checker.GetStringValue(new ControlReference(this.textConfirm, "Confirm"), true);

            // check...
            if (!(checker.HasErrors))
            {
                // match?
                if (password == confirm)
                {
                    // set...
                    this.CurrentUser.SetPassword(password, true);

                    // show...
                    this.widgetPasswordFeedback.SetInfo("Your password has been changed.");
                }
                else
                    checker.AddError("The passwords do not match.");
            }

            // show...
            if (checker.HasErrors)
                this.widgetPasswordFeedback.SetError(checker);
        }
        void buttonReset_Click(object sender, EventArgs e)
        {
            this.widgetFeedback.Reset();

            // get...
            FormChecker checker = new FormChecker();
            string email = checker.GetStringValue(new ControlReference(this.textEmail, "Email"), true);

            // not...
            if(!(checker.HasErrors))
            {
                // find...
                ApiKey key = ApiKey.GetByEmail(email);
                if (key != null)
                {
                    // reset...
                    string password = key.ResetPassword();

                    // send...
                    IDictionary values = CollectionsUtil.CreateCaseInsensitiveHashtable();
                    values["password"] = password;
                    EmailHelper.SendEmail(EmailKeys.ForgotPassword, key, values);

                    // show...
                    this.widgetFeedback.SetInfo("Your new password has been sent.");
                }
                else
                    checker.AddError(string.Format("An account for email address '{0}' was not found.", email));
            }

            // show...
            if (checker.HasErrors)
                this.widgetFeedback.SetError(checker);
        }
        public ModuleDto CheckForm(CreateModuleDto dto)
        {
            var form = new Form
            {
                name        = dto.Name,
                description = dto.Description,
                techstack   = dto.TechStack
            };

            var formChecker = new FormChecker(form, 32, 64, 32);

            if (formChecker.Check())
            {
                return(ObjectMapper.Map <ModuleDto>(dto));
            }
            else
            {
                var newForm = formChecker.Modify(form);
                return(new ModuleDto
                {
                    Name = newForm.name,
                    Description = newForm.description,
                    TechStack = newForm.techstack
                });
            }
        }
Exemple #4
0
        private bool BeforSave()
        {
            bool b = true;

            b &= FormChecker.CheckEmpty(txtDescription, lblDescription);

            return(b);
        }
Exemple #5
0
        private bool BeforSave()
        {
            bool b;

            b  = FormChecker.CheckEmpty(txtAgentName, lblAgentName);
            b &= FormChecker.CheckEmpty(txtTelephone, lblTel);
            //b &= FormChecker.CheckEmpty(txtAddress, lblAddress);
            return(b);
        }
Exemple #6
0
        private bool BeforSave()
        {
            bool b;

            b  = FormChecker.CheckEmpty(txtCompanyName, lblCompanyName);
            b  = FormChecker.CheckEmpty(txtTel, lblTel);
            b &= FormChecker.CheckEmpty(txtAddress, lblAddress);
            return(b);
        }
        private bool BeforSave()
        {
            bool b;

            b  = FormChecker.CheckDate(txtDate, lblDate);
            b &= FormChecker.CheckEmpty(txtNumber, lblNumber);

            return(b);
        }
Exemple #8
0
        private void btnShow_Click(object sender, EventArgs e)
        {
            bool b = FormChecker.CheckDate(txtFromDate, lblFromDate);

            b &= FormChecker.CheckDate(txtToDate, lblToDate);

            if (!b)
            {
                MessageBox.Show("خطا در تاریخ های وارده شده");
                return;
            }
            loadList(RMX_TOOLS.date.DateXFormer.persianToGreGorian(txtFromDate.Text),
                     RMX_TOOLS.date.DateXFormer.persianToGreGorian(txtToDate.Text));
        }
        private void btnShow_Click(object sender, EventArgs e)
        {
            bool b = FormChecker.CheckDate(txtFromDate, lblFromDate);

            b &= FormChecker.CheckDate(txtToDate, lblToDate);
            int count = 0;

            try
            {
                count = int.Parse(txtReferLimit.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show("عدد وارد شده صحیح نیست");
                return;
            }
            if (!b)
            {
                MessageBox.Show("خطا در تاریخ های وارده شده");
                return;
            }
            try
            {
                while (dataGridView1.Rows.Count > 0)
                {
                    dataGridView1.Rows.RemoveAt(0);
                }
            }
            catch (Exception ex) { }

            DateTime dateFrom = RMX_TOOLS.date.DateXFormer.persianToGreGorian(txtFromDate.Text);
            DateTime dateTo   = RMX_TOOLS.date.DateXFormer.persianToGreGorian(txtToDate.Text);

            ReferCountLetterEntity en = _referLetterBL.getReferCount(count, dateFrom, dateTo);

            ArrayList list            = getLetterWithReffereds(en);
            int       currentRowIndex = 0;

            for (int i = 0; i < list.Count; i++)
            {
                currentRowIndex = dataGridView1.Rows.Add();
                dataGridView1.Rows[currentRowIndex].Cells[0].Value = ((ArrayList)list[i])[0];
                dataGridView1.Rows[currentRowIndex].Cells[1].Value = ((ArrayList)list[i])[1];
                dataGridView1.Rows[currentRowIndex].Cells[2].Value = ((ArrayList)list[i])[2];
                dataGridView1.Rows[currentRowIndex].Cells[3].Value = ((ArrayList)list[i])[3];
                dataGridView1.Rows[currentRowIndex].Cells[4].Value = ((ArrayList)list[i])[4];
            }
        }
        void buttonLogon_Click(object sender, EventArgs e)
        {
            this.widgetFeedback.Reset();

            // get...
            FormChecker checker = new FormChecker(this);
            string username = checker.GetStringValue(new ControlReference(this.textUsername, "Username"), true);
            string password = checker.GetStringValue(new ControlReference(this.textPassword, "Password"), true);

            // not...
            if (!(checker.HasErrors))
            {
                // find...
                ApiKey key = ApiKey.GetByUsername(username);
                if (key != null)
                {
                    if (key.IsActive)
                    {
                        // password...
                        string hashed = EncryptionHelper.HashPasswordToBase64String(password, key.PasswordSalt);
                        if (hashed == key.PasswordHash)
                        {
                            // logon...
                            RememberUserFlags flags = RememberUserFlags.DoNotRememberUsers;
                            if(this.checkRemember.Checked)
                                flags = RememberUserFlags.UsernameAndPassword;
                            this.Logon(key, flags, new TimeSpan(90, 0, 0, 0));

                            // go...
                            this.Response.Redirect("~/default.aspx");
                        }
                        else
                            checker.AddError("The password is invalid.");
                    }
                    else
                        checker.AddError("The API account is not active.");
                }
                else
                    checker.AddError("The username is invalid.");
            }

            // show...
            if (checker.HasErrors)
                this.widgetFeedback.SetError(checker);
        }
Exemple #11
0
        private bool checkData()
        {
            bool b;

            b  = FormChecker.CheckEmpty(txtRecievePattern, lblRecievePattern);
            b &= FormChecker.CheckEmpty(txtSendPattern, lblSendPattern);

            b &= checkYearTandem(txtRecievePattern.Text);
            b &= checkMonthTandem(txtRecievePattern.Text);
            b &= checkDayTandem(txtRecievePattern.Text);

            b &= checkYearTandem(txtSendPattern.Text);
            b &= checkMonthTandem(txtSendPattern.Text);
            b &= checkDayTandem(txtSendPattern.Text);

            b &= checkNumberSignsTandem(txtRecievePattern.Text);
            int n1 = _NumberSignCount;

            b &= checkNumberSignsTandem(txtSendPattern.Text);
            int n2 = _NumberSignCount;

            if (n1 != txtLastNumbeRecieve.Text.Length)
            {
                MessageBox.Show("لطفا تعداد ارقام برای آخرین شماره نامه  تولیده شده وارده را به تعداد ارقام انتخابی وارد نمایید،");
                return(false);
            }
            if (n2 != txtLastNumbeSend.Text.Length)
            {
                MessageBox.Show("لطفا تعداد ارقام برای آخرین شماره نامه  تولیده شده صادره را به تعداد ارقام انتخابی وارد نمایید،");
                return(false);
            }

            if (!b)
            {
                return(false);
            }

            return(true);
        }
        void buttonEmail_Click(object sender, EventArgs e)
        {
            this.widgetEmailFeedback.Reset();
            this.widgetPasswordFeedback.Reset();

            FormChecker checker = new FormChecker();
            string email = checker.GetStringValue(new ControlReference(this.textEmail, "Email"), true);

            // check...
            if (!(checker.HasErrors))
            {
                // get...
                ApiKey existing = ApiKey.GetByEmail(email);
                if (existing == null)
                {
                    // set...
                    this.CurrentUser.Email = email;
                    this.CurrentUser.SaveChanges();

                    // show...
                    this.widgetEmailFeedback.SetInfo("The email address has been changed.");
                }
                else
                {
                    // us?
                    if(CurrentUser == null)
	                    throw new InvalidOperationException("'CurrentUser' is null.");
                    if (existing.ApiKeyId == this.CurrentUser.ApiKeyId)
                        checker.AddError("Please enter a new email address.");
                    else
                        checker.AddError("Another account is already using this email address.");
                }
            }

            // show...
            if (checker.HasErrors)
                this.widgetEmailFeedback.SetError(checker);
        }
Exemple #13
0
        private bool BeforSave()
        {
            bool b;

            b  = FormChecker.CheckEmpty(txtRecieptBillNumber, lblRecieptBillNumber);
            b &= FormChecker.CheckDate(txtIssueDate, lblIssueDate);
            b &= FormChecker.CheckEmpty(txtPrice, lblPrice);

            try
            {
                if (txtPrice.Text.Length > 0)
                {
                    int i = int.Parse(txtPrice.Text);
                    lblPrice.ForeColor = Color.Red;
                }
            }
            catch (Exception ex)
            {
                b &= false;
                lblPrice.ForeColor = Color.Red;
            }

            return(b);
        }
        public ProjectDto CheckForm(CreateProjectDto dto)
        {
            var form = new Form
            {
                name        = dto.Name,
                description = dto.Description
            };

            var formChecker = new FormChecker(form, 32, 64, 32);

            if (formChecker.Check())
            {
                return(ObjectMapper.Map <ProjectDto>(dto));
            }
            else
            {
                var newForm = formChecker.Modify(form);
                return(new ProjectDto
                {
                    Name = newForm.name,
                    Description = newForm.description,
                });
            }
        }
Exemple #15
0
 public QaTestCase() {
     appChecker = new FormChecker(Root.mainForm);
 }
Exemple #16
0
 /// <summary>
 /// Открывает форму "О системе"
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void infoComputerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FormChecker.ControlOpenedForm(typeof(AboutOfSystem));
 }
Exemple #17
0
 /// <summary>
 /// Открываем форму добавления устройства.
 /// Состоит из двух форм - добавления данных об устройстве, и его параметров
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void addDeviceToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FormChecker.ControlOpenedForm(typeof(DeviceStepOne));
 }
Exemple #18
0
 private void connectToDBToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FormChecker.ControlOpenedForm(typeof(SettingsDB));
 }
Exemple #19
0
 private void connectToFTPToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FormChecker.ControlOpenedForm(typeof(Connection_FTP_Data));
 }
        void buttonSave_Click(object sender, EventArgs e)
        {
            this.widgetFeedback.Reset();

            // get...
            FormChecker checker = new FormChecker();
            string username = checker.GetStringValue(new ControlReference(this.textUsername, "Username"), true);
            string password = checker.GetStringValue(new ControlReference(this.textPassword, "Password"), true);
            string confirm = checker.GetStringValue(new ControlReference(this.textConfirm, "Confirm"), true);
            string firstName = checker.GetStringValue(new ControlReference(this.textFirstName, "First name"), true);
            string lastName = checker.GetStringValue(new ControlReference(this.textLastName, "Last name"), true);
            string company = checker.GetStringValue(new ControlReference(this.textCompany, "Company"), true);
            string address1 = checker.GetStringValue(new ControlReference(this.textAddress1, "Address 1"), true);
            string address2 = checker.GetStringValue(new ControlReference(this.textAddress2, "Address 2"), false);
            string address3 = checker.GetStringValue(new ControlReference(this.textAddress3, "Address 3"), false);
            string city = checker.GetStringValue(new ControlReference(this.textCity, "City/town"), true);
            string region = checker.GetStringValue(new ControlReference(this.textRegion, "Region/county"), false);
            string postalCode = checker.GetStringValue(new ControlReference(this.textPostalCode, "Postal code/postcode"), true);
            Country country = (Country)checker.GetEntity(new ControlReference(this.listCountry, "Country"), typeof(Country), true);
            string email = checker.GetStringValue(new ControlReference(this.textEmail, "Email"), true);

            // not...
            if (!(checker.HasErrors))
            {
                // check...
                if (password == confirm)
                {
                    // find...
                    ApiKey existing = ApiKey.GetByUsername(username);
                    if (existing == null)
                    {
                        // check email...
                        ApiKey byUser = ApiKey.GetByEmail(email);
                        if(byUser == null)
                        {
                            // create...
                            ApiKey key = new ApiKey();
                            key.Username = username;
                            key.SetPassword(password, false);
                            key.FirstName = firstName;
                            key.LastName = lastName;
                            key.Company = company;
                            key.Address1 = address1;
                            key.Address2 = address2;
                            key.Address3 = address3;
                            key.City = city;
                            key.Region = region;
                            key.PostalCode = postalCode;
                            key.Country = country;
                            key.Email = email;
                            key.Subscribe = this.checkSubscribe.Checked;
                            key.IsActive = true;

                            // save...
                            key.SaveChanges();

                            // send...
                            EmailHelper.SendEmail(EmailKeys.NewRegistration, key);

                            // logon...
                            this.Logon(key, RememberUserFlags.DoNotRememberUsers, TimeSpan.MinValue);
                            
                            // redirect...
                            this.Response.Redirect("~/");
                        }
                        else
                            checker.AddError(string.Format("The email address '{0}' has already been used.", email));
                    }
                    else
                        checker.AddError(string.Format("The username '{0}' already exists.", username));
                }
                else
                    checker.AddError("Passwords do not match.");
            }

            // not...
            if (checker.HasErrors)
                this.widgetFeedback.SetError(checker);
        }
Exemple #21
0
        private void btnReffferLetter_Click(object sender, EventArgs e)
        {
            LetterBL letterBL = new LetterBL();
            ChequeBL chequeBL = new ChequeBL();

            IsRefferDone = false;
            int assignedUserId = 0;

            if (LetterId > 0)
            {
                LetterEntity letterEntity       = letterBL.getByLetterId(LetterId);
                int          assignedUserTreeId = int.Parse(letterEntity.get(LetterEntity.FIELD_USER_TREE_ID).ToString());
                assignedUserId = _userTreeBL.getUserIdByTreeId(assignedUserTreeId);
                bool b = FormChecker.CheckDate(txtRefferDate, lblRefferDate);
                if (!b)
                {
                    return;
                }
            }

            if (ChequeId > 0)
            {
                ChequeEntity chequeEntity       = chequeBL.get(ChequeId);
                int          assignedUserTreeId = int.Parse(chequeEntity.get(ChequeEntity.FIELD_USER_TREE_ID).ToString());
                assignedUserId = _userTreeBL.getUserIdByTreeId(assignedUserTreeId);
            }
            if (lstUserList.Items.Count <= 0 || lstUserList.SelectedIndex < 0)
            {
                MessageBox.Show("لطفا کاربری را انتخاب نمایید !");
                return;
            }
            ComboBoxItem item       = (ComboBoxItem)lstUserList.Items[lstUserList.SelectedIndex];
            int          userTreeId = int.Parse(item.Value);


            int assigntoNewUserID = _userTreeBL.getUserIdByTreeId(userTreeId);

            if (assignedUserId == assigntoNewUserID)
            {
                MessageBox.Show("آیتم مورد نظر در حال حاضر در اختیار کاربر انتخاب شده می باشد. ");
                return;
            }

            DialogResult re = MessageBox.Show("آیا از انجام عمل ارجاع مطمئن هستید ؟  ", "", MessageBoxButtons.YesNo);

            if (re.Equals(DialogResult.No))
            {
                return;
            }


            if (_letterId >= 0)
            {
                letterBL.updateRefferenceUser(_letterId, userTreeId);

                letterBL.updateRefferenceDate(RMX_TOOLS.date.DateXFormer.persianToGreGorian(txtRefferDate.Text), LetterId);

                lblMsg.Text = "ارجاع انجام گردید!";
            }
            else if (_chequeId >= 0)
            {
                chequeBL.updateRefferenceUser(_chequeId, userTreeId);
                lblMsg.Text = "ارجاع انجام گردید!";
            }
            IsRefferDone = true;

            // this.Close();
        }
Exemple #22
0
 public void ElementProperty() {
     MenuItem prop = FormChecker.FindMenuItem(screenMenu, "Element Properties...");
     ClickElementById("TheContent");
     Invoke(delegate() {
         prop.PerformClick();
     });
     ElementProperties propForm = Root.mainForm.TheScreen.PropertyForm;
     AssertNotNull( propForm );
     FormChecker u = new FormChecker(propForm);
     u.Invoke(delegate() {
         TextBox tbox = u.FindControl("tboxElementHtml") as TextBox;
         AssertNotNull(tbox);
         AssertTrue(tbox.Text.IndexOf("The Content") > 0);
         propForm.Close();
     });
 }
Exemple #23
0
        private bool BeforSave()
        {
            bool b;

            lblAccountHolderName.ForeColor = Color.Black;
            lblAccountNumber.ForeColor     = Color.Black;
            lblBankName.ForeColor          = Color.Black;
            lblChequeNumber.ForeColor      = Color.Black;
            //lblChqueReply.ForeColor = Color.Black;
            //lblDescription.ForeColor = Color.Black;
            lblDescription2.ForeColor    = Color.Black;
            lblEntryDate.ForeColor       = Color.Black;
            lblInsuranceNumber.ForeColor = Color.Black;
            lblIssueDate.ForeColor       = Color.Black;
            lblMaturityDate.ForeColor    = Color.Black;
            lblPayType.ForeColor         = Color.Black;

            b  = FormChecker.CheckEmpty(cmbPayType, lblPayType);
            b &= FormChecker.CheckEmpty(cmbInsuranceCompany, lblInsuranceCompany);

/*            b &= FormChecker.CheckEmpty(txtCompany, lblCompany);
 *          if (txtCompany.Tag == null || ((int)txtCompany.Tag) <= 0)
 *          {
 *              b &= false;
 *              lblCompany.ForeColor = Color.Red;
 *          }
 *          else
 *              lblCompany.ForeColor = Color.Black;
 */
            if (_id < 0)
            {
                b &= FormChecker.CheckEmpty(cmbReferenceUserId, lblReferenceUserId);
            }

            if (cmbPayType.SelectedIndex == 0)
            {
                b &= FormChecker.CheckEmpty(txtChequeNumber, lblChequeNumber);
                b &= FormChecker.CheckDate(txtMaturityDate, lblMaturityDate);
                b &= FormChecker.CheckEmpty(txtPrice, lblPrice);
                b &= FormChecker.CheckEmpty(cmbBankId, lblBankName);
                b &= FormChecker.CheckEmpty(txtAccountNumber, lblAccountNumber);
                b &= FormChecker.CheckEmpty(txtAccountHolderName, lblAccountHolderName);
                b &= FormChecker.CheckEmpty(txtInsuranceNumber, lblInsuranceNumber);
            }
            else if (cmbPayType.SelectedIndex == 1)
            {
                b &= FormChecker.CheckEmpty(txtPrice, lblPrice);
                b &= FormChecker.CheckEmpty(txtInsuranceNumber, lblInsuranceNumber);
            }

            try
            {
                if (txtPrice.Text.Length > 0)
                {
                    int i = int.Parse(txtPrice.Text);
                    lblPrice.ForeColor = Color.Black;
                }
            }
            catch (Exception ex)
            {
                b &= false;
                lblPrice.ForeColor = Color.Red;
            }

            return(b);
        }