예제 #1
0
        ///Business Tools

        private void MIAddBusiness_Click(object sender, EventArgs e)
        {
            if (DCom.CountCheckTable("businesses_types") == false)
            {
                MessageBox.Show("There are no businesses types to create a business.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (DCom.CountCheckTable("location") == false)
            {
                MessageBox.Show("There are no location to create a business.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (DCom.CountCheckTable("work_hours") == false)
            {
                MessageBox.Show("There are no work hours to create a business.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (DCom.CountCheckTable("users") == false)
            {
                MessageBox.Show("There are no users to create a business.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                BusinessForms.AddBusinessForm AddBusinessForm = new BusinessForms.AddBusinessForm();
                AddBusinessForm.ShowDialog();
                MainGridView.DataSource = DCom.GetData(SqlBusiness);
                AddBusinessForm.Dispose();
            }
        }
예제 #2
0
        ///Businesses Types Tools

        /// <summary>
        ///When the client clicks this Menu Item the form for the creation
        /// of a businesses type(AddBusinessesTypes) is opening for any actions.
        /// Then refill the MainGridView and then dispose the AddBusinessesTypes form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MIAddBusinessesTypes_Click(object sender, EventArgs e)
        {
            Businesses_Types.AddBusinessesTypes AddBusinesses_Types = new Businesses_Types.AddBusinessesTypes();
            AddBusinesses_Types.ShowDialog();
            MainGridView.DataSource = DCom.GetData(SqlBusinesses_Types);
            AddBusinesses_Types.Dispose();
        }
예제 #3
0
        ///Province Tools

        /// <summary>
        /// When the client clicks this Menu Item the form for the creation
        /// of a province(AddProvince) is opening for any actions.
        /// Then refill the MainGridView and then dispose the EditUser form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MIAddProvince_Click(object sender, EventArgs e)
        {
            ProvinceForms.AddProvince AddProvince = new ProvinceForms.AddProvince();
            AddProvince.ShowDialog();
            MainGridView.DataSource = DCom.GetData(SqlProvince);
            AddProvince.Dispose();
        }
예제 #4
0
        ///User Types Tools

        /// <summary>
        /// When the client clicks this Menu Item the form for the creation
        /// of a user type(AddUsersTypes) is opening for any actions.
        /// Then refill the MainGridView and then dispose the EditUser form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MIAddUserT_Click(object sender, EventArgs e)
        {
            UserTypesForms.AddUsersTypes AddUsersTypes = new UserTypesForms.AddUsersTypes();
            AddUsersTypes.ShowDialog();
            MainGridView.DataSource = DCom.GetData(SqlUsersTypes);
            AddUsersTypes.Dispose();
        }
예제 #5
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(TbxPassword.Text) || string.IsNullOrWhiteSpace(TbxPassword.Text))
            {
                MessageBox.Show("PLEASE ADD ALL THE DATA", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DataTable getLogin = DCom.GetData(String.Format("SELECT COUNT(*) FROM login WHERE Username = '******' AND Password = '******'", TbxUsername.Text, TbxPassword.Text));
                string    getCount = getLogin.Rows[0]["COUNT(*)"].ToString();


                if (getCount == "1")
                {
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    checktries++;
                    if (checktries > 3)
                    {
                        MessageBox.Show("USER NOT FOUND, PLEASE TRY AGAIN", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.DialogResult = DialogResult.No;
                    }
                    MessageBox.Show("USER NOT FOUND, PLEASE TRY AGAIN", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #6
0
        ///Days Tools

        /// <summary>
        /// When the client clicks this Menu Item the form for the creation
        /// of a day(AddDays) is opening for any actions.
        /// Then refill the MainGridView and then dispose the AddDays form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MIAddDays_Click(object sender, EventArgs e)
        {
            DaysForms.AddDays AddDays = new DaysForms.AddDays();
            AddDays.ShowDialog();
            MainGridView.DataSource = DCom.GetData(SqlDays);
            AddDays.Dispose();
        }
예제 #7
0
        ///Work Hours Tools

        private void MIAddWorkHours_Click(object sender, EventArgs e)
        {
            WorkHoursForms.AddWorkHours AddWorkHours = new WorkHoursForms.AddWorkHours();
            AddWorkHours.ShowDialog();
            MainGridView.DataSource = DCom.GetData(SqlWorkHours);
            AddWorkHours.Dispose();
        }
예제 #8
0
 /// <summary>
 /// When the client clicks this Menu Item the system first checks if
 /// any businesses types exist. If a businesses types exists the form for the delete
 /// of a businesses types(DeleteBusinessesTypes) is opening for any actions.
 /// Else shows a error message.
 /// Then refill the MainGridView and then dispose the DeleteBusinessesTypes form.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MIDeleteBusinessesTypes_Click(object sender, EventArgs e)
 {
     if (DCom.CountCheckTable("businesses_types") == false)
     {
         MessageBox.Show("There are no businesses types to delete.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Businesses_Types.DeleteBusinessesTypes DeleteBusinessesTypes = new Businesses_Types.DeleteBusinessesTypes();
         DeleteBusinessesTypes.ShowDialog();
         MainGridView.DataSource = DCom.GetData(SqlBusinesses_Types);
         DeleteBusinessesTypes.Dispose();
     }
 }
예제 #9
0
 /// <summary>
 /// When the client clicks this Menu Item the system first checks if
 /// any province exist. If a province exists the form for the delete
 /// of a province(DeleteProvince) is opening for any actions.
 /// Else shows a error message.
 /// Then refill the MainGridView and then dispose the DeleteProvince form.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MIDeleteProvince_Click(object sender, EventArgs e)
 {
     if (DCom.CountCheckTable("province") == false)
     {
         MessageBox.Show("There are no province to edit.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         ProvinceForms.DeleteProvince DeleteProvince = new ProvinceForms.DeleteProvince();
         DeleteProvince.ShowDialog();
         MainGridView.DataSource = DCom.GetData(SqlProvince);
         DeleteProvince.Dispose();
     }
 }
예제 #10
0
 /// <summary>
 /// When the client clicks this Menu Item the system first checks if
 /// any user type exist. If a login info exists the form for the edit
 /// of a login info(EditLogin) is opening for any actions.
 /// Else shows a error message.
 /// Then refill the MainGridView and then dispose the EditUsersTypes form.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MIEditLogin_Click(object sender, EventArgs e)
 {
     if (DCom.CountCheckTable("login") == false)
     {
         MessageBox.Show("There are no login info to edit.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         LoginForms.EditLogin EditLogin = new LoginForms.EditLogin();
         EditLogin.ShowDialog();
         MainGridView.DataSource = DCom.GetData(SqlLogin);
         EditLogin.Dispose();
     }
 }
예제 #11
0
 /// <summary>
 /// When the client clicks this Menu Item the system first checks if
 /// any user exist. If a user exists the form for the edit
 /// of a user(EditUser) is opening for any actions.
 /// Else shows a error message.
 /// Then refill the MainGridView and then dispose the EditUser form.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MIEditUser_Click(object sender, EventArgs e)
 {
     if (DCom.CountCheckTable("users") == false)
     {
         MessageBox.Show("There are no users to edit.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         UserForms.EditUser EditUser = new UserForms.EditUser();
         EditUser.ShowDialog();
         MainGridView.DataSource = DCom.GetData(SqlUsers);
         EditUser.Dispose();
     }
 }
예제 #12
0
        ///User Tools

        /// <summary>
        /// When the client clicks this Menu Item the system first checks if
        /// any user type exist. If a user type exists the form for the creation
        /// of a user(AddUser) is opening for any actions.
        /// Else shows a error message.
        /// Then refill the MainGridView and then dispose the AddUser form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MIAddUser_Click(object sender, EventArgs e)
        {
            if (DCom.CountCheckTable("users_types") == false)
            {
                MessageBox.Show("There are no users types that reqiured to create a user.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                UserForms.AddUser AddUser = new UserForms.AddUser();
                AddUser.ShowDialog();
                MainGridView.DataSource = DCom.GetData(SqlUsers);
                AddUser.Dispose();
            }
        }
예제 #13
0
 private void MIEditReservation_Click(object sender, EventArgs e)
 {
     if (DCom.CountCheckTable("reservation") == false)
     {
         MessageBox.Show("There are no reservations to edit.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         ReservationForms.EditReservationForm EditReservationForm = new ReservationForms.EditReservationForm();
         EditReservationForm.ShowDialog();
         MainGridView.DataSource = DCom.GetData(SqlReservation);
         EditReservationForm.Dispose();
     }
 }
예제 #14
0
 /// <summary>
 /// When the client clicks this Menu Item the system first checks if
 /// any day exist. If a day exists the form for the edit
 /// of a day(EditDays) is opening for any actions.
 /// Else shows a error message.
 /// Then refill the MainGridView and then dispose the EditDays form.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MIEditDays_Click(object sender, EventArgs e)
 {
     if (DCom.CountCheckTable("days") == false)
     {
         MessageBox.Show("There are no days to edit.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         DaysForms.EditDays EditDays = new DaysForms.EditDays();
         EditDays.ShowDialog();
         MainGridView.DataSource = DCom.GetData(SqlDays);
         EditDays.Dispose();
     }
 }
예제 #15
0
 private void MIEditBusiness_Click(object sender, EventArgs e)
 {
     if (DCom.CountCheckTable("businesses") == false)
     {
         MessageBox.Show("There are no business to edit.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         BusinessForms.EdiBusinessForm EdiBusinessForm = new BusinessForms.EdiBusinessForm();
         EdiBusinessForm.ShowDialog();
         MainGridView.DataSource = DCom.GetData(SqlBusiness);
         EdiBusinessForm.Dispose();
     }
 }
예제 #16
0
        ///Ratings Tools

        private void MIAddRatings_Click(object sender, EventArgs e)
        {
            if (DCom.CountCheckTable("users") == false)
            {
                MessageBox.Show("There are no user to create a rating.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                RatingsForms.AddRatingsForm AddRatingsForms = new RatingsForms.AddRatingsForm();
                AddRatingsForms.ShowDialog();
                MainGridView.DataSource = DCom.GetData(SqlRatings);
                AddRatingsForms.Dispose();
            }
        }
예제 #17
0
 private void MIEditWorkHours_Click(object sender, EventArgs e)
 {
     if (DCom.CountCheckTable("work_hours") == false)
     {
         MessageBox.Show("There are no work hours to edit.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         WorkHoursForms.EditWorkHours EditWorkHours = new WorkHoursForms.EditWorkHours();
         EditWorkHours.ShowDialog();
         MainGridView.DataSource = DCom.GetData(SqlWorkHours);
         EditWorkHours.Dispose();
     }
 }
예제 #18
0
 private void MIEditMunicipality_Click(object sender, EventArgs e)
 {
     if (DCom.CountCheckTable("muminipality") == false)
     {
         MessageBox.Show("There are no municipalities to edit.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Municipality.EditMunicipality EditMunicipality = new Municipality.EditMunicipality();
         EditMunicipality.ShowDialog();
         MainGridView.DataSource = DCom.GetData(SqlMunicipality);
         EditMunicipality.Dispose();
     }
 }
예제 #19
0
 /// <summary>
 /// When the client clicks this Menu Item the system first checks if
 /// any day exist. If a day exists the form for the delete
 /// of a location(DeleteLocation) is opening for any actions.
 /// Else shows a error message.
 /// Then refill the MainGridView and then dispose the DeleteLocation form.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MIDeleteLocation_Click(object sender, EventArgs e)
 {
     if (DCom.CountCheckTable("location") == false)
     {
         MessageBox.Show("There are no location to delete.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         LocationForms.DeleteLocation DeleteLocation = new LocationForms.DeleteLocation();
         DeleteLocation.ShowDialog();
         MainGridView.DataSource = DCom.GetData(SqlLocation);
         DeleteLocation.Dispose();
     }
 }
예제 #20
0
        ///Location Tools

        /// <summary>
        /// When the client clicks this Menu Item the form for the creation
        /// of a location(AddLocation) is opening for any actions.
        /// Then refill the MainGridView and then dispose the Location form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MIAddLocation_Click(object sender, EventArgs e)
        {
            if (DCom.CountCheckTable("municipality") == false)
            {
                MessageBox.Show("There are no municipality to create a location.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                LocationForms.AddLocation AddLocation = new LocationForms.AddLocation();
                AddLocation.ShowDialog();
                MainGridView.DataSource = DCom.GetData(SqlLocation);
                AddLocation.Dispose();
            }
        }
예제 #21
0
        //Municipality Tools

        private void MIAddMunicipality_Click(object sender, EventArgs e)
        {
            if (DCom.CountCheckTable("province") == false)
            {
                MessageBox.Show("There are no provinces to create a municipality.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Municipality.AddMunicipality addMunicipality = new Municipality.AddMunicipality();
                addMunicipality.ShowDialog();
                MainGridView.DataSource = DCom.GetData(SqlMunicipality);
                addMunicipality.Dispose();
            }
        }
예제 #22
0
 private void MIDeleteRatings_Click(object sender, EventArgs e)
 {
     if (DCom.CountCheckTable("ratings") == false)
     {
         MessageBox.Show("There are no ratings to delete.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         RatingsForms.DeleteRatingsForm DeleteRatingsForm = new RatingsForms.DeleteRatingsForm();
         DeleteRatingsForm.ShowDialog();
         MainGridView.DataSource = DCom.GetData(SqlRatings);
         DeleteRatingsForm.Dispose();
     }
 }
예제 #23
0
        ///Reservation Tools

        private void MIAddReservation_Click(object sender, EventArgs e)
        {
            if (DCom.CountCheckTable("users") == false)
            {
                MessageBox.Show("There are no users to create a reservation.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (DCom.CountCheckTable("businesses") == false)
            {
                MessageBox.Show("There are no businesses to create a reservation.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                ReservationForms.AddReservationForm AddReservationForm = new ReservationForms.AddReservationForm();
                AddReservationForm.ShowDialog();
                MainGridView.DataSource = DCom.GetData(SqlReservation);
                AddReservationForm.Dispose();
            }
        }
예제 #24
0
        /// <summary>
        /// This method counts how many times there is a Value in a particular Row and Table.
        /// </summary>
        /// <param name="Table">The table we want to check.</param>
        /// <param name="Row">The row we want to check.</param>
        /// <param name="Value">The value we want to check.</param>
        /// <returns>Returns the true if it finds the value at least once else returns false.</returns>
        public static bool CountCheck(string Table, string Row, string Value)
        {
            string    SqlExec = "SELECT COUNT(*) CNT FROM " + Table + " WHERE " + Row + " = '" + Value + "'";
            DataTable DT      = DCom.GetData(SqlExec);

            Boolean Check;

            if ((long)DT.Rows[0][0] == 0)
            {
                Check = false;
            }
            else
            {
                Check = true;
            }

            return(Check);
        }
예제 #25
0
        /// <summary>
        /// This method counts the entries of a particular table.
        /// </summary>
        /// <param name="Table">The table we want to check.</param>
        /// <returns>Returns the true if it finds at least one entrie else returns false.</returns>
        public static bool CountCheckTable(string Table)
        {
            string    SqlExec = "SELECT COUNT(*) CNT FROM " + Table;
            DataTable DT      = DCom.GetData(SqlExec);

            Boolean Check;

            if ((long)DT.Rows[0][0] == 0)
            {
                Check = false;
            }
            else
            {
                Check = true;
            }

            return(Check);
        }
예제 #26
0
        ///Login Tools

        /// <summary>
        /// When the client clicks this Menu Item the form for the creation
        /// of a login info(AddLogin) is opening for any actions.
        /// Then refill the MainGridView and then dispose the AddLogin form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MIAddLogin_Click(object sender, EventArgs e)
        {
            DataTable DT = DCom.GetData("SELECT count(*) FROM users where users.Username NOT IN (SELECT login.Username FROM login)");

            if (DCom.CountCheckTable("users") == false)
            {
                MessageBox.Show("There are no users to create a login account.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if ((long)DT.Rows[0][0] == 0)
            {
                MessageBox.Show("All the users have a login account.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                LoginForms.AddLogin AddLogin = new LoginForms.AddLogin();
                AddLogin.ShowDialog();
                MainGridView.DataSource = DCom.GetData(SqlLogin);
                AddLogin.Dispose();
            }
        }
예제 #27
0
        ///Constructor

        /// <summary>
        /// In form constractor the connection is created.
        /// Then the DataGridView of the form(MainGridView) is fill up with the users table from databse.
        /// </summary>
        public MainForm()
        {
            DCom.Connect();


            LoginForm loginForm = new LoginForm();

            loginForm.ShowDialog();

            if (loginForm.DialogResult == DialogResult.No)
            {
                loginForm.Dispose();
                DCom.Close();
                Environment.Exit(1);
            }
            else
            {
                InitializeComponent();
                MainGridView.DataSource = DCom.GetData(SqlUsers);
            }
        }
예제 #28
0
 /// <summary>
 /// When the client clicks this Menu Item the source
 /// of DataGridView fills this the table Reservation from Database.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MIViewReservation_Click(object sender, EventArgs e)
 {
     MainGridView.DataSource = DCom.GetData(SqlReservation);
 }
예제 #29
0
 /// <summary>
 /// When the client clicks this Menu Item the source
 /// of DataGridView fills this the table Ratings from Database.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MIViewRatings_Click(object sender, EventArgs e)
 {
     MainGridView.DataSource = DCom.GetData(SqlRatings);
 }
예제 #30
0
 /// <summary>
 /// When the client clicks this Menu Item the source
 /// of DataGridView fills this the table Businesses from Database.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MIViewBusinesses_Click(object sender, EventArgs e)
 {
     MainGridView.DataSource = DCom.GetData(SqlBusiness);
 }