Exemplo n.º 1
0
        /* Configuración:
         * Recuerda abrir App.config y agregar la cadena de conexión
         * la cual obtienes desde el portal de Azure
         * además, hay que agregar  Column Encryption Setting=Enabled
         * para que autorice las operaciones de encriptación
         *
         * También se agregó una referencia a la librería System.Configuration
         */

        private void Add_Click(object sender, EventArgs e)
        {
            using (var connection = new SqlConnection())
            {
                connection.ConnectionString = ConfigurationManager.ConnectionStrings["DemoConnectionString"].ToString();
                connection.Open();

                using (var command = new SqlCommand("AddEmployee", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;

                    var lastName = new SqlParameter("@LastName", SqlDbType.VarChar, 32);
                    lastName.Value = LastNameText.Text;

                    var salary = new SqlParameter("@Salary", SqlDbType.Decimal);
                    salary.Value = decimal.Parse(SalaryText.Text);

                    command.Parameters.Add(lastName);
                    command.Parameters.Add(salary);

                    command.ExecuteNonQuery();

                    MessageBox.Show("Employee added!");

                    SalaryText.Clear();
                    LastNameText.Clear();
                }
            }
        }
Exemplo n.º 2
0
 private void registerAthleteButton_Click(object sender, EventArgs e)
 {
     AthleteCurr.setAttributes(FirstNameText.Text, LastNameText.Text, Convert.ToInt32(AthleteAge.SelectedItem), AthleteLevel.SelectedItem.ToString(), AthleteSex.SelectedItem.ToString());
     AthleteCurr.produceAndSetKey();
     AthleteCurr.registerCurr(CountryCurr);
     FirstNameText.Clear();
     LastNameText.Clear();
     AthleteAge.SelectedIndex     = -1;
     AthleteLevel.SelectedIndex   = -1;
     AthleteSex.SelectedIndex     = -1;
     AthleteCountry.SelectedIndex = -1;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Verify last name is same as entered
        /// </summary>
        /// <param name="LastNameOnScreen"></param>
        /// <returns></returns>
        public bool VerifyLastName(String lastNameOnFile)
        {
            WebDriverWait customWait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));

            customWait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@class='col-sm-6 pad-left-none']//span[@class='form-value']")));

            String LastName      = LastNameText.GetText(driver);
            bool   lastNameValue = false;

            Thread.Sleep(1000);
            if (LastName.Contains(lastNameOnFile))
            {
                lastNameValue = true;
                _logger.Info($" Last Name Is Correct");
            }
            return(lastNameValue);
        }
Exemplo n.º 4
0
        public override void ViewDidLayoutSubviews()
        {
            base.ViewDidLayoutSubviews();

            HeaderView.Frame = new CGRect(View.Frame.Left, View.Frame.Top, View.Frame.Width, StyledTextField.StyledFieldHeight);

            ScrollView.Frame = new CGRect(View.Frame.Left, HeaderView.Frame.Bottom, View.Frame.Width, View.Frame.Height - HeaderView.Frame.Height);

            UserNameText.SetFrame(new CGRect(-10, View.Frame.Height * .05f, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            PasswordText.SetFrame(new CGRect(-10, UserNameText.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            ConfirmPasswordText.SetFrame(new CGRect(-10, PasswordText.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));

            NickNameText.SetFrame(new CGRect(-10, ConfirmPasswordText.Background.Frame.Bottom + 40, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            LastNameText.SetFrame(new CGRect(-10, NickNameText.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));

            EmailText.SetFrame(new CGRect(-10, LastNameText.Background.Frame.Bottom + 40, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));
            CellPhoneText.SetFrame(new CGRect(-10, EmailText.Background.Frame.Bottom, View.Frame.Width + 20, StyledTextField.StyledFieldHeight));

            DoneButton.Frame   = new CGRect(View.Frame.Left + 10, CellPhoneText.Background.Frame.Bottom + 20, View.Bounds.Width - 20, ControlStyling.ButtonHeight);
            CancelButton.Frame = new CGRect((View.Frame.Width - ControlStyling.ButtonWidth) / 2, DoneButton.Frame.Bottom + 20, ControlStyling.ButtonWidth, ControlStyling.ButtonHeight);

            // for the scroll size, if the content is larger than the screen, we'll take the bottom
            // of the content plus some padding. Otherwise, we'll just use the window height plus a tiny bit so there's
            // a subtle scroll effect
            nfloat controlBottom = CancelButton.Frame.Bottom + (View.Bounds.Height * .25f);

            ScrollView.ContentSize = new CGSize(0, (nfloat)Math.Max(controlBottom, View.Bounds.Height * 1.05f));

            // setup the header shadow
            UIBezierPath shadowPath = UIBezierPath.FromRect(HeaderView.Bounds);

            HeaderView.Layer.MasksToBounds = false;
            HeaderView.Layer.ShadowColor   = UIColor.Black.CGColor;
            HeaderView.Layer.ShadowOffset  = new CGSize(0.0f, .0f);
            HeaderView.Layer.ShadowOpacity = .23f;
            HeaderView.Layer.ShadowPath    = shadowPath.CGPath;

            if (LogoView != null)
            {
                LogoView.Layer.Position = new CoreGraphics.CGPoint((HeaderView.Bounds.Width - LogoView.Bounds.Width) / 2, 0);
            }

            ResultView.SetBounds(View.Frame.ToRectF( ));
            BlockerView.SetBounds(View.Frame.ToRectF( ));
        }
Exemplo n.º 5
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            listBox1.SelectionMode = SelectionMode.MultiExtended;
            listBox1.Items.Clear();

            if (radioButton1.Checked == true)
            {
                if (!String.IsNullOrEmpty(FirstNameText.Text) && !String.IsNullOrEmpty(LastNameText.Text))
                {
                    Person.Add(new Male("Mr", FirstNameText.Text, LastNameText.Text));
                }
                else
                {
                    MessageBox.Show("Enter First and Lastname!");
                }
            }
            else if (radioButton2.Checked == true)
            {
                if (!String.IsNullOrEmpty(FirstNameText.Text) && !String.IsNullOrEmpty(LastNameText.Text))
                {
                    Person.Add(new Female("Miss", FirstNameText.Text, LastNameText.Text));
                }
                else
                {
                    MessageBox.Show("Enter First and Lastname!");
                }
            }
            else
            {
                MessageBox.Show("Enter First and Lastname! \n or Pick Male or Female!");
                return;
            }
            radioButton1.Checked = false;
            radioButton2.Checked = false;
            FirstNameText.Clear();
            LastNameText.Clear();
            PrintNameLists();
        }
Exemplo n.º 6
0
 private void GetAll_Click(object sender, EventArgs e)
 {
     LastNameText.Clear();
     people = db.GetAllPeople();
     refreshPeopleFoundBox();
 }
Exemplo n.º 7
0
        private void SaveStudentButton_Click(object sender, EventArgs e)
        {
            try
            {
                Person person = new Person();
                try
                {
                    person.fname = FirstNametext.Text;
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Please Enter correct first name!");
                    FirstNametext.Clear();
                    throw new ArgumentException();
                }
                try
                {
                    person.lname = LastNameText.Text;
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Please Enter correct last name!");
                    LastNameText.Clear();
                    throw new ArgumentException();
                }
                try
                {
                    person.Contact = ContactText.Text;
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Please enter the correct 11 digit contact number");
                    ContactText.Clear();
                    throw new ArgumentException();
                }
                try
                {
                    person.Email = EmailText.Text;
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Please Enter the email address");
                    EmailText.Clear();
                    throw new ArgumentException();
                }
                catch (FormatException)
                {
                    MessageBox.Show("Please Enter the correct email address");
                    EmailText.Clear();
                    throw new ArgumentException();
                }
                try
                {
                    person.DOB = DOBdateTimePicker.Value;
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Person Age Must Be Greater Than 18");
                    DOBdateTimePicker.Value = DateTime.Now;
                    throw new ArgumentException();
                }
                try
                {
                    person.Gender = GenderComboBox.Text;
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Please Select the gender From the dropdown list");
                    throw new ArgumentException();
                }

                Student student = new Student();
                try
                {
                    student.regNo = RegistrationNoText.Text;
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Please Enter the Registration Number in the Format 1234-XY-567");
                    RegistrationNoText.Clear();
                    throw new ArgumentException();
                }

                if (value1 == "add")
                {
                    SqlConnection connection = new SqlConnection(connString);
                    connection.Open();
                    string     genderid = string.Format("SELECT Id FROM LookUp WHERE Value = '{0}' AND Category = 'GENDER'", person.Gender);
                    SqlCommand cmd      = new SqlCommand(genderid, connection);
                    int        id       = (Int32)cmd.ExecuteScalar();

                    String cmdtext = String.Format("INSERT INTO Person(FirstName, LastName, Contact, Email, DateOfBirth, Gender) values('{0}','{1}', '{2}', '{3}', '{4}', '{5}' )", person.fname, person.lname, person.Contact, person.Email, person.DOB, id);
                    cmd.CommandText = cmdtext;
                    cmd.ExecuteNonQuery();

                    string getid = string.Format("SELECT id FROM Person WHERE Email = '{0}'", person.Email);
                    cmd.CommandText = getid;
                    id = (Int32)cmd.ExecuteScalar();

                    string addStudent = string.Format("INSERT INTO Student(Id, RegistrationNo) values('{0}' , '{1}')", id, student.regNo);
                    cmd.CommandText = addStudent;
                    cmd.ExecuteNonQuery();

                    MessageBox.Show("Student Added");
                    connection.Close();
                }
                else if (value1 == "edit")
                {
                    SqlConnection connection = new SqlConnection(connString);
                    connection.Open();

                    string     getGenderId = string.Format("SELECT Id FROM LookUp WHERE Value = '{0}' AND Category = 'GENDER'", GenderComboBox.Text);
                    SqlCommand cmd         = new SqlCommand(getGenderId, connection);
                    int        gender      = (Int32)cmd.ExecuteScalar();
                    string     update      = string.Format("UPDATE Student SET RegistrationNo = '{0}' WHERE Id = '{1}'", RegistrationNoText.Text, IDStudent);
                    cmd.CommandText = update;
                    cmd.ExecuteNonQuery();
                    cmd.CommandText = string.Format("UPDATE Person SET FirstName = '{0}', LastName = '{1}', Contact = '{2}', Email = '{3}', " +
                                                    "DateOfBirth = '{4}', Gender = '{5}' WHERE Id = '{6}'", FirstNametext.Text, LastNameText.Text, ContactText.Text, EmailText.Text, DOBdateTimePicker.Value, gender, IDStudent);
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("Student Updated!");
                    connection.Close();
                }
                ManageStudentsForm form = new ManageStudentsForm();
                this.Close();
                form.Show();
            }
            catch (Exception)
            {
                MessageBox.Show("Student not saved. Please try again!");
            }
        }
Exemplo n.º 8
0
        //Fill out the tenant form
        internal void AddTenantDetails()
        {
            ExcelLib.PopulateInCollection(Base.ExcelPath, "Add Tenant");
            //enter the tenant email
            TenantEmailText.SendKeys(ExcelLib.ReadData(2, "Tenant Email"));

            //select is main tenant
            String        isMainTenant = ExcelLib.ReadData(2, "Is Main Tenant");
            SelectElement select1      = new SelectElement(IsMainTenantDropdown);

            switch (isMainTenant)
            {
            case "Yes":
                select1.SelectByValue("true");
                break;

            case "No":
                select1.SelectByValue("false");
                break;
            }
            try
            {
                //enter first name and last name
                Thread.Sleep(1000);
                FirstNameText.SendKeys(ExcelLib.ReadData(2, "First Name"));
                Thread.Sleep(1000);
                LastNameText.SendKeys(ExcelLib.ReadData(2, "Last Name"));
            }
            catch (Exception e)
            {
                Console.Write("enter first name and last name exception: " + e.Message);
            }


            //select rent start date
            string rentStartDate = ExcelLib.ReadData(2, "Rent Start Date");

            string[] temp = rentStartDate.Split(' ');
            rentStartDate = temp[0];
            RentStartDatepicker.Click();
            RentStartDatepicker.Clear();
            RentStartDatepicker.SendKeys(rentStartDate);

            //select rent end date
            string rentEndDate = ExcelLib.ReadData(2, "Rent End Date");

            temp        = rentEndDate.Split(' ');
            rentEndDate = temp[0];
            RentEndDatepicker.Click();
            RentEndDatepicker.Clear();
            RentEndDatepicker.SendKeys(rentEndDate);

            //enter rent amount
            RentAmountText.SendKeys(ExcelLib.ReadData(2, "Rent Amount"));

            //select payment frequency
            String        paymentFrequency = ExcelLib.ReadData(2, "Payment Frequency");
            SelectElement select2          = new SelectElement(PaymentFrequencyDropdown);

            switch (paymentFrequency)
            {
            case "Weekly":
                select2.SelectByValue("1");
                break;

            case "Fortnightly":
                select2.SelectByValue("2");
                break;

            case "Monthly":
                select2.SelectByValue("3");
                break;
            }

            //select payment start date
            string PaymentStartDate = ExcelLib.ReadData(2, "Payment Start Date");

            temp             = PaymentStartDate.Split(' ');
            PaymentStartDate = temp[0];
            PaymentStartDatepicker.Click();
            PaymentStartDatepicker.Clear();
            PaymentStartDatepicker.SendKeys(PaymentStartDate);

            //select payment due date
            String        paymentDuedate = ExcelLib.ReadData(2, "Payment Due Date");
            SelectElement select3        = new SelectElement(PaymentDueDateDropdown);

            switch (paymentDuedate)
            {
            case "1":
                select3.SelectByValue("1");
                break;

            case "2":
                select3.SelectByValue("2");
                break;

            case "3":
                select3.SelectByValue("3");
                break;

            case "4":
                select3.SelectByValue("4");
                break;

            case "5":
                select3.SelectByValue("5");
                break;

            case "6":
                select3.SelectByValue("6");
                break;

            case "7":
                select3.SelectByValue("7");
                break;
            }
        }
Exemplo n.º 9
0
        void ReleaseDesignerOutlets()
        {
            if (CancelButton != null)
            {
                CancelButton.Dispose();
                CancelButton = null;
            }

            if (FirstNameLabel != null)
            {
                FirstNameLabel.Dispose();
                FirstNameLabel = null;
            }

            if (FirstNameText != null)
            {
                FirstNameText.Dispose();
                FirstNameText = null;
            }

            if (LastNameLabel != null)
            {
                LastNameLabel.Dispose();
                LastNameLabel = null;
            }

            if (LastNameText != null)
            {
                LastNameText.Dispose();
                LastNameText = null;
            }

            if (PasswordLabel != null)
            {
                PasswordLabel.Dispose();
                PasswordLabel = null;
            }

            if (PasswordText != null)
            {
                PasswordText.Dispose();
                PasswordText = null;
            }

            if (StatusMessageLabel != null)
            {
                StatusMessageLabel.Dispose();
                StatusMessageLabel = null;
            }

            if (SubmitButton != null)
            {
                SubmitButton.Dispose();
                SubmitButton = null;
            }

            if (UserInputContainerView != null)
            {
                UserInputContainerView.Dispose();
                UserInputContainerView = null;
            }
        }
        private void AddAdvisor1_Click(object sender, EventArgs e)
        {
            try
            {
                Person person = new Person();
                try
                {
                    person.fname = FirstNametext.Text;
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Please Enter correct first name!");
                    FirstNametext.Clear();
                    throw new ArgumentException();
                }
                try
                {
                    person.lname = LastNameText.Text;
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Please Enter correct last name!");
                    LastNameText.Clear();
                    throw new ArgumentException();
                }
                try
                {
                    person.Contact = ContactText.Text;
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Please enter the correct 11 digit contact number");
                    ContactText.Clear();
                    throw new ArgumentException();
                }
                try
                {
                    person.Email = EmailText.Text;
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Please Enter the email address");
                    EmailText.Clear();
                    throw new ArgumentException();
                }
                catch (FormatException)
                {
                    MessageBox.Show("Please Enter the correct email address");
                    EmailText.Clear();
                    throw new ArgumentException();
                }
                try
                {
                    person.DOB = DOBdateTimePicker.Value;
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Person Age Must Be Greater Than 18");
                    DOBdateTimePicker.Value = DateTime.Now;
                    throw new ArgumentException();
                }
                try
                {
                    person.Gender = GenderComboBox.Text;
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Please Select the gender From the dropdown list");
                    throw new ArgumentException();
                }

                Advisor advisor = new Advisor();
                try
                {
                    advisor.designation = designationComboBox.Text;
                }
                catch (ArgumentException)
                {
                    MessageBox.Show("Please select designation from the dropdown list");
                    designationComboBox.ResetText();
                    throw new ArgumentException();
                }

                try
                {
                    advisor.salary = SalaryTextBox.Text;
                }
                catch
                {
                    MessageBox.Show("Please enter the salary in digits");
                    throw new ArgumentException();
                }
                if (value1 == "add")
                {
                    SqlConnection connection = new SqlConnection(connString);
                    connection.Open();
                    string     genderid = string.Format("SELECT Id FROM LookUp WHERE Value = '{0}' AND Category = 'GENDER'", GenderComboBox.Text);
                    SqlCommand cmd      = new SqlCommand(genderid, connection);
                    int        id       = (Int32)cmd.ExecuteScalar();

                    String cmdtext = String.Format("INSERT INTO Person(FirstName, LastName, Contact, Email, DateOfBirth, Gender) values('{0}','{1}', '{2}', '{3}', '{4}', '{5}' )", FirstNametext.Text, LastNameText.Text, ContactText.Text, EmailText.Text, DOBdateTimePicker.Value, id);
                    cmd.CommandText = cmdtext;
                    cmd.ExecuteNonQuery();

                    string getid = string.Format("SELECT id FROM Person WHERE Email = '{0}'", EmailText.Text);
                    cmd.CommandText = getid;
                    id = (Int32)cmd.ExecuteScalar();

                    cmd.CommandText = string.Format("SELECT Id FROM Lookup WHERE Value = '{0}' AND Category = 'DESIGNATION'", designationComboBox.Text);
                    int desig = (Int32)cmd.ExecuteScalar();

                    string addStudent = string.Format("INSERT INTO Advisor(Id, Designation, Salary) values('{0}' , '{1}', '{2}')", id, desig, SalaryTextBox.Text);
                    cmd.CommandText = addStudent;
                    cmd.ExecuteNonQuery();

                    MessageBox.Show("Advisor Added");
                    connection.Close();
                }
                else if (value1 == "edit")
                {
                    SqlConnection connection = new SqlConnection(connString);
                    connection.Open();

                    string     getGenderId = string.Format("SELECT Id FROM LookUp WHERE Value = '{0}' AND Category = 'GENDER'", GenderComboBox.Text);
                    SqlCommand cmd         = new SqlCommand(getGenderId, connection);
                    int        gender      = (Int32)cmd.ExecuteScalar();

                    cmd.CommandText = String.Format("SELECT Id FROM Lookup WHERE Value = '{0}' AND Category = 'DESIGNATION'", designationComboBox.Text);
                    int desig = (Int32)cmd.ExecuteScalar();

                    cmd.CommandText = string.Format("UPDATE Person SET FirstName = '{0}', LastName = '{1}', Contact = '{2}', Email = '{3}', " +
                                                    "DateOfBirth = '{4}', Gender = '{5}' WHERE Id = '{6}'", FirstNametext.Text, LastNameText.Text, ContactText.Text, EmailText.Text, DOBdateTimePicker.Value, gender, IDadvisor);
                    cmd.ExecuteNonQuery();

                    cmd.CommandText = string.Format("UPDATE Advisor SET Designation = '{0}', Salary = '{1}' " +
                                                    "WHERE Id = '{2}'", desig, int.Parse(SalaryTextBox.Text), IDadvisor);
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("Advisor Updated!");
                    connection.Close();
                }
                ManageAdvisors form = new ManageAdvisors();
                this.Close();
                form.Show();
            }
            catch (Exception)
            {
                MessageBox.Show("Advisor not saved. Please try again!");
            }
        }