Beispiel #1
0
        private bool isFormValid()
        {
            if (StudentNameTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Name is required");
                StudentNameTextBox.Focus();
                return(false);
            }

            if (PhoneNumberTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Phone number is required");
                PhoneNumberTextBox.Focus();
                return(false);
            }

            if (DepartmentComboBox.SelectedIndex == -1)
            {
                SMSMessageBox.ShowErrorMessage("Department is required");
                DepartmentComboBox.Focus();
                return(false);
            }

            return(true);
        }
        private void DeleteRecordToolStripButton_Click(object sender, EventArgs e)
        {
            int rowIndex = StudentDataGridView.Rows.GetFirstRow(DataGridViewElementStates.Selected);

            SqlDataReader dataReader;

            try
            {
                if (rowIndex != -1)
                {
                    int StudentId = Convert.ToInt32(StudentDataGridView.Rows[rowIndex].Cells["StudentId"].Value);

                    string        query  = "DELETE FROM dbo.Student WHERE StudentId='" + StudentId + "';";
                    SqlConnection Sqlcon = new SqlConnection(AppSetting.ConnectionString());
                    SqlCommand    SqlCom = new SqlCommand(query, Sqlcon);
                    Sqlcon.Open();
                    dataReader = SqlCom.ExecuteReader();
                    SMSMessageBox.ShowSuccessMessage("Row Deleted");
                    while (dataReader.Read())
                    {
                    }
                    LoadDataIntoGridView();
                }
                else
                {
                    SMSMessageBox.ShowErrorMessage("Please Select Row");
                }
            }
            catch (Exception ex)
            {
                SMSMessageBox.ShowErrorMessage("Error Message");
            }
        }
Beispiel #3
0
        private bool isFormValid()
        {
            if (BranchNameTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Branch Name is required");
                BranchNameTextBox.Focus();
                return(false);
            }

            if (EmailAddressTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Email is required");
                EmailAddressTextBox.Focus();
                return(false);
            }

            if (TelephoneTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Telephone is required");
                TelephoneTextBox.Focus();
                return(false);
            }

            return(true);
        }
 private void SignInButton_Click(object sender, EventArgs e)
 {
     if (isFormValid())
     {
         DBSQLServer db = new DBSQLServer(AppSetting.ConnectionString());
         bool        isLoginDetailsCorrect = Convert.ToBoolean(db.GetScalarValue("usp_UsersCheckLoginDetails", GetParameter()));
         if (isLoginDetailsCorrect)
         {
             GetLoggedInUserSetting();
             this.Hide();
             DashboardForm df = new DashboardForm();
             df.Show();
         }
         else
         {
             SMSMessageBox.ShowErrorMessage("User name/Password is not correct");
         }
     }
 }
        private bool isFormValid()
        {
            if (UserNameTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("User name is not correct");
                UserNameTextBox.Clear();
                UserNameTextBox.Focus();
                return(false);
            }

            if (PasswordTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Password is not correct");
                PasswordTextBox.Clear();
                PasswordTextBox.Focus();
                return(false);
            }

            return(true);
        }
Beispiel #6
0
        private bool isFormValid()
        {
            if (FullNameTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Full Name is required");
                FullNameTextBox.Focus();
                return(false);
            }

            if (DateOfBirthDateTimePicker.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Date of Birth is required");
                DateOfBirthDateTimePicker.Focus();
                return(false);
            }

            if (CNICTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("CNIC is required");
                FullNameTextBox.Focus();
                return(false);
            }

            if ((MobileTextBox.Text.Trim() == string.Empty) && (TelephoneTextBox.Text.Trim() == string.Empty))
            {
                SMSMessageBox.ShowErrorMessage("Mobile or Telephone number is required");
                MobileTextBox.Focus();
                return(false);
            }

            if (GenderComboBox.SelectedIndex == -1)
            {
                SMSMessageBox.ShowErrorMessage("Gender is required");
                return(false);
            }

            if (EmploymentDateDateTimePicker.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Employment Date is required");
                EmploymentDateDateTimePicker.Focus();
                return(false);
            }

            if (AddressLineTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Address Line is required");
                AddressLineTextBox.Focus();
                return(false);
            }

            if (CityComboBox.SelectedIndex == -1)
            {
                SMSMessageBox.ShowErrorMessage("City is required");
                return(false);
            }

            if (DistrictComboBox.SelectedIndex == -1)
            {
                SMSMessageBox.ShowErrorMessage("District is required");
                return(false);
            }

            if (PostralCodeTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Postral code is required");
                PostralCodeTextBox.Focus();
                return(false);
            }

            if (JobTitleComboBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Job Title is required");
                JobTitleComboBox.Focus();
                return(false);
            }

            if (CurrentSalaryTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Current Salary is required");
                CurrentSalaryTextBox.Focus();
                return(false);
            }
            else
            {
                if (Convert.ToDecimal(CurrentSalaryTextBox.Text.Trim()) < 1)
                {
                    SMSMessageBox.ShowErrorMessage("Current Salary can not be zero or less than zero");
                    CurrentSalaryTextBox.Focus();
                    return(false);
                }
            }

            if (StartingSalaryTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Starting Salary is required");
                StartingSalaryTextBox.Focus();
                return(false);
            }
            else
            {
                if (Convert.ToDecimal(StartingSalaryTextBox.Text.Trim()) < 1)
                {
                    SMSMessageBox.ShowErrorMessage("Starting Salary can not be zero or less than zero");
                    StartingSalaryTextBox.Focus();
                    return(false);
                }
            }

            if (HasLeftComboBox.Text == "Yes")
            {
                if (DateLeftDateTimePicker.Text.Trim() == string.Empty)
                {
                    SMSMessageBox.ShowErrorMessage("Date Left is required");
                    DateLeftDateTimePicker.Focus();
                    return(false);
                }

                if (ReasonLeftComboBox.Text.Trim() == string.Empty)
                {
                    SMSMessageBox.ShowErrorMessage("Leaving reason is required");
                    ReasonLeftComboBox.Focus();
                    return(false);
                }

                if (CommentsTextBox.Text.Trim() == string.Empty)
                {
                    SMSMessageBox.ShowErrorMessage("Leaving Comments are required");
                    CommentsTextBox.Focus();
                    return(false);
                }
            }
            return(true);
        }