Ejemplo n.º 1
0
        private void ClearMethod()
        {
            IDTB.Clear();
            FirstNameTB.Clear();
            LastNametextBox.Clear();
            DateOfBirthTB.Value    = DateTime.Now;
            GenderTB.SelectedIndex = -1;
            ContacttextBox.Clear();
            NICtextBox.Clear();
            HouseNOtextBox.Clear();
            AddLine1Tb.Clear();
            AddLine2tb.Clear();
            postCodetextBox.Clear();
            DepartmentTextBoc.SelectedIndex  = -1;
            designationtextBox.SelectedIndex = -1;

            StatuscomboBox.SelectedIndex = -1;
            DateOfHired.Value            = DateTime.Now;
            BasicSalarytextBox.Clear();
            JobTitletextBox.Clear();
            PasswordTb.Clear();

            UpdateBtn.Enabled = false;
            button1.Enabled   = false;
            ReadID();

            ProfilePicture.Image = Resources.User1;
        }
        private void ClearMethod()
        {

            FirstNameTB.Clear();
            LastNametextBox.Clear();
            DateOfBirthTB.Value = DateTime.Now;
            GenderTB.SelectedIndex = -1;
            ContacttextBox.Text = "03";
            NICtextBox.Clear();
            HouseNOtextBox.Clear();
            AddLine1Tb.Clear();
            AddLine2tb.Clear();
            postCodetextBox.Clear();
            DepartmentTextBoc.SelectedIndex = -1;
            designationtextBox.SelectedIndex = -1; ;

            StatuscomboBox.SelectedIndex = -1;
            DateOfHired.Value = DateTime.Now;
            BasicSalarytextBox.Clear();
            JobTitletextBox.Clear();
            PasswordTb.Clear();

            ImgLocation = "";
            


            ProfilePicture.Image = Resources.User1;
        }
Ejemplo n.º 3
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     //добавление данных о пользователе в БД, если все данные введены верно
     if (PasswordTB.Password == RepPasswordTB.Password)
     {
         DB     dB    = new DB(Properties.Settings.Default.CinemaDBConnectionString);
         object login = dB.ExecuteScalarQuery($"SELECT Логин FROM Пользователь WHERE Логин = '{LoginTB.Text}'");
         if (login == null)
         {
             int rows = dB.ExecuteQuery($"INSERT INTO [Пользователь] Values(N'{LoginTB.Text}', N'{PasswordTB.Password}', N'{EmailTB.Text}', N'{PhoneTB.Text}', 0, 0, N'{LastNameTB.Text}', N'{FirstNameTB.Text}', N'{MiddleNameTB.Text}')");
             if (rows == 1)
             {
                 MessageBox.Show("Регистрация прошла успешно!");
                 LastNameTB.Clear();
                 FirstNameTB.Clear();
                 MiddleNameTB.Clear();
                 EmailTB.Clear();
                 PhoneTB.Clear();
                 LoginTB.Clear();
                 PasswordTB.Clear();
                 RepPasswordTB.Clear();
                 AddText();
             }
         }
         else
         {
             MessageBox.Show("Такой логин уже существует!");
         }
     }
     else
     {
         MessageBox.Show("Пароли не совпадают!");
     }
 }
Ejemplo n.º 4
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            if(StudentListBox.SelectedItem == null)
            {
                var sID = int.TryParse(StudentIDTB.Text, out int studentID);
                if (sID == false)
                {
                    MessageBox.Show("Invalid Entry. Please enter a valid number");
                }
                var sFirstName = FirstNameTB.Text;
                var sLastName = LastNameTB.Text;
                var age = int.TryParse(AgeTB.Text, out int sAge);
                var allergies = AllergiesTB.Text;
                var parentName = ParentNameTB.Text;
                var parentContact = ParentContactNoTB.Text;
                var parentEmail = ParentEmailTB.Text;
                var classID = int.TryParse(ClassIDTB.Text, out int sClassID);

                _crudManager.AddStudent(studentID, sFirstName, sLastName, sAge, allergies, parentName, parentContact, parentEmail, sClassID);
            }

            PopulateStudentListBox();
            StudentIDTB.Clear();
            FirstNameTB.Clear();
            LastNameTB.Clear();
            AgeTB.Clear();
            AllergiesTB.Clear();
            ParentNameTB.Clear();
            ParentContactNoTB.Clear();
            ParentEmailTB.Clear();
            ClassIDTB.Clear();
        }
Ejemplo n.º 5
0
        private void ClearMethod()
        {
            IDTB.Clear();
            FirstNameTB.Clear();
            LastNametextBox.Clear();
            designationtextBox.Clear();
            DepartmentTextBoc.Clear();
            BasicSalarytextBox.Clear();
            ConvancetextBox.Clear();
            MedicalAlltextBox.Clear();
            TotalAmounttextBox.Clear();
            HouseRentTextBoc.Clear();
            AbsenceTextBox.Text    = "0";
            LateTextBox.Text       = "0";
            HalfDayTextBox.Text    = "0";
            OverTimeHrtextBox.Text = "0";
            AddedAllowanceTB.Clear();
            DeductedAmountTB.Clear();
            IncomeTextextBox.Clear();
            NetSalaryTB.Clear();


            Off             = 0;
            NetSalary       = 0;
            Allownc         = 0;
            Deducted        = 0;
            incomeTex       = 0;
            OvertimeAmount  = 0;
            OvertimeHours   = 0;
            TotalAmount     = 0;
            AtdDec          = 0;
            halfDayAmount   = 0;
            button3.Enabled = false;
        }
Ejemplo n.º 6
0
        public Customer_Login()
        {
            InitializeComponent();

            //Initial hidden objects
            label4.Hide();
            label5.Hide();
            FirstNameTB.Hide();
            LastNameTB.Hide();
        }
Ejemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            newUser         = true;
            button1.Enabled = false;
            label2.Text     = "New Username:"******"New Password:";

            label4.Show();
            label5.Show();
            FirstNameTB.Show();
            LastNameTB.Show();
        }
Ejemplo n.º 8
0
 private void ResetBt_Click(object sender, RoutedEventArgs e)
 {
     StudentIDTB.Clear();
     FirstNameTB.Clear();
     LastNameTB.Clear();
     AgeTB.Clear();
     AllergiesTB.Clear();
     ParentNameTB.Clear();
     ParentContactNoTB.Clear();
     ParentEmailTB.Clear();
     ClassIDTB.Clear();
 }
Ejemplo n.º 9
0
 private void ClearMethod()
 {
     FirstNameTB.Clear();
     designationtextBox.Clear();
     LastNametextBox.Clear();
     StatusTB.Clear();
     DateOfHired.Clear();
     BasicSalaryTB.Clear();
     Amountlabel.Text          = "Basic Salary : 0";
     UpdatedSalaryTb.Text      = "Salary After Updation : 0";
     perradioButton.Checked    = false;
     AmountradioButton.Checked = false;
 }
Ejemplo n.º 10
0
 private void DeleteBt_Click(object sender, RoutedEventArgs e)
 {
     _crudManager.DeleteStudent(int.Parse(StudentIDTB.Text));
     StudentIDTB.Clear();
     FirstNameTB.Clear();
     LastNameTB.Clear();
     AgeTB.Clear();
     AllergiesTB.Clear();
     ParentNameTB.Clear();
     ParentContactNoTB.Clear();
     ParentEmailTB.Clear();
     ClassIDTB.Clear();
     StudentListBox.ItemsSource = null;
     PopulateStudentListBox();
 }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (FirstNameTB.Text != "" || EmailTB.Text != "" || PhoneTB.Text != "" ||
         LoginTB.Text != "" || PasswordTB.Password != "" || RepPasswordTB.Password != "")
     {
         if (PasswordTB.Password == RepPasswordTB.Password)
         {
             using (SqlConnection connection = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=E:\OlineCinema\OlineCinema\CinemaDB.mdf;Integrated Security=True"))
             {
                 try
                 {
                     connection.Open();
                 }
                 catch
                 {
                     MessageBox.Show("Ошибка соединения с базой данных!");
                     return;
                 }
                 string     query   = $"INSERT INTO [Пользователь] Values('{LoginTB.Text}', '{PasswordTB.Password}', '{EmailTB.Text}', '{PhoneTB.Text}', 0, 0, '{LastNameTB.Text}', '{FirstNameTB.Text}', '{MiddleNameTB.Text}')";
                 SqlCommand command = new SqlCommand(query, connection);
                 command.ExecuteNonQuery();
                 MessageBox.Show("Регистрация прошла успешно!");
                 LastNameTB.Clear();
                 FirstNameTB.Clear();
                 MiddleNameTB.Clear();
                 EmailTB.Clear();
                 PhoneTB.Clear();
                 LoginTB.Clear();
                 PasswordTB.Clear();
                 RepPasswordTB.Clear();
             }
         }
         else
         {
             MessageBox.Show("Пароли не свопадают!");
         }
     }
     else
     {
         MessageBox.Show("Есть незаполненные поля!");
     }
 }
Ejemplo n.º 12
0
 private void EditBTN_Click(object sender, EventArgs e)
 {
     if (press == 0)
     {
         EditBTN.BackColor = Color.LightGreen;
         EditBTN.Text      = "Update";
         press             = 1;
         enableTB(true);
         FirstNameTB.Focus();
     }
     else
     {
         EditBTN.BackColor = Color.LightBlue;
         EditBTN.Text      = "Edit";
         press             = 0;
         enableTB(false);
         DB.UpdateUserInfo(LogIn.uname, FirstNameTB.Text, LastNameTB.Text, AddressTB.Text, TelTB.Text, PassWordTB.Text);
         MessageBox.Show("Updated");
     }
 }
Ejemplo n.º 13
0
        private void ClearMethod()
        {
            IDTB.Clear();
            FirstNameTB.Clear();
            LastNametextBox.Clear();
            DateOfBirthTB.Value = DateTime.Now;
            DepartmentTextBoc.Clear();
            BasicSalarytextBox.Clear();
            AmounttextBox.Text     = "0";
            ReasonCB.SelectedIndex = -1;
            AttendanceAllowancetb.SelectedIndex = -1;
            MonthYear.Value = DateTime.Now;


            ConvenceAllLBL.Text = "0";
            HouseRentLbl.Text   = "0";
            MedicalLBL.Text     = "0";
            Amountlabel.Text    = "Total Amount : 0";

            button1.Enabled = false;
            button3.Enabled = false;
        }
Ejemplo n.º 14
0
        private void ClearMethod()
        {
            IDTB.Clear();
            FirstNameTB.Clear();
            LastNametextBox.Clear();
            DateOfHired.Clear();
            BasicSalarytextBox.Clear();
            DepartmentTextBoc.Clear();
            designationtextBox.Clear();
            StatusTB.Clear();
            MonthYear.Value           = DateTime.Now;
            perradioButton.Checked    = false;
            AmountradioButton.Checked = false;
            PertextBox.Clear();
            AmounttextBox.Clear();
            ReasontextBox.Clear();

            button1.Enabled        = false;
            button3.Enabled        = false;
            Amountlabel.Text       = "Total Salary : 0";
            DeductionSalaryTb.Text = "Salary After Deduction : 0";
        }
Ejemplo n.º 15
0
        private Boolean Validation()
        {

            

            if (FirstNameTB.Text == "")
            {
                FirstNameTB.BackColor = Color.DodgerBlue;
                MessageBox.Show("First Name Is Required", "Please Enter First Name", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                FirstNameTB.Focus();
                return true;
            }
            if (LastNametextBox.Text == "")
            {
                LastNametextBox.BackColor = Color.DodgerBlue;
                MessageBox.Show("Last Name Is Required", "Please Enter Last Name", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                LastNametextBox.Focus();
                return true;
            }
            if (DateOfBirthTB.Value == Dt)
            {
                DateOfBirthTB.BackColor = Color.DodgerBlue;
                MessageBox.Show("Date Of Birth Is Required", "Please Enter Date Of Birth", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                DateOfBirthTB.Focus();
                return true;
            }

            if (GenderTB.SelectedIndex == -1)
            {
                GenderTB.BackColor = Color.DodgerBlue;
                MessageBox.Show("Gender Is Required", "Please Select Gender", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                GenderTB.Focus();
                return true;
            }

            if (ContacttextBox.Text == "")
            {
                ContacttextBox.BackColor = Color.DodgerBlue;
                MessageBox.Show("Contact Number Is Required", "Please Enter Contact", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                ContacttextBox.Focus();
                return true;
            }
            if (NICtextBox.Text == "")
            {
                NICtextBox.BackColor = Color.DodgerBlue;
                MessageBox.Show("NIC Is Required", "Please Enter NIC", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                NICtextBox.Focus();
                return true;
            }

            if (DepartmentTextBoc.SelectedIndex == -1)
            {
                DepartmentTextBoc.BackColor = Color.DodgerBlue;
                MessageBox.Show("Department Is Required", "Please Select Department", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                DepartmentTextBoc.Focus();
                return true;
            }
            if (designationtextBox.SelectedIndex == -1)
            {
                designationtextBox.BackColor = Color.DodgerBlue;
                MessageBox.Show("Designation Is Required", "Please Select Designation", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                designationtextBox.Focus();
                return true;
            }
            if (StatuscomboBox.SelectedIndex == -1)
            {
                StatuscomboBox.BackColor = Color.DodgerBlue;
                MessageBox.Show("Status Is Required", "Please Select Status", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                StatuscomboBox.Focus();
                return true;
            }


            if (DateOfHired.Value == Dt)
            {
                DialogResult Result = MessageBox.Show("Do You Want To Enter To Day's Date ? ", "Yes Or No", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (Result == DialogResult.No)
                {
                    DateOfHired.Focus();
                    return true;
                }

            }


            if (BasicSalarytextBox.Text == "")
            {
                BasicSalarytextBox.BackColor = Color.DodgerBlue;
                MessageBox.Show("Basic Salary Is Required", "Please Enter Basic Salary", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                BasicSalarytextBox.Focus();
                return true;
            }

            if (JobTitletextBox.Text == "")
            {
                JobTitletextBox.BackColor = Color.DodgerBlue;
                MessageBox.Show("Job Title Is Required", "Please Enter Title", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                JobTitletextBox.Focus();
                return true;
            }

            if (HouseNOtextBox.Text == "")
            {
                HouseNOtextBox.BackColor = Color.DodgerBlue;
                MessageBox.Show("House Number Is Required", "Please Enter House Number", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                HouseNOtextBox.Focus();
                return true;
            }

            if (AddLine1Tb.Text == "")
            {
                AddLine1Tb.BackColor = Color.DodgerBlue;
                MessageBox.Show("Address Is Required", "Please Enter Address", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                AddLine1Tb.Focus();
                return true;
            }

            if (PasswordTb.Text == "")
            {
                PasswordTb.BackColor = Color.DodgerBlue;
                MessageBox.Show("Password Number Is Required", "Please Enter Password", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                PasswordTb.Focus();
                return true;
            }


            return false;
        }
 private void FirstNameTBGotFocus(object sender, RoutedEventArgs e)
 {
     FirstNameTB.Clear();
 }