Exemplo n.º 1
0
 /// <summary>
 /// This is forms constructor.
 /// In this constructor the combobox for user types(CmbUsersTypes) is
 /// filling from the user types table(users_types).
 /// </summary>
 public DeleteUsersTypes()
 {
     InitializeComponent();
     CmbUsersTypes.DataSource    = DCom.GetData("SELECT * FROM users_types");
     CmbUsersTypes.DisplayMember = "Type";
     CmbUsersTypes.ValueMember   = "Type";
 }
Exemplo n.º 2
0
        /// <summary>
        /// Finally when the client made the changes that he wants the program checks if all the fields
        /// all fields are fill. If all fields are fill then the program exec the apropriate querry for the
        /// update of the rating, else show a error message.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSelect_Click(object sender, EventArgs e)
        {
            LblRatingValue.Show();
            LblComment.Show();
            LblUsername.Show();

            TbxComment.Show();
            TbxRatingValue.Show();
            CmbUsername.Show();

            BtnEdit.Show();

            LblSelect.Hide();
            CmbSelect.Hide();
            BtnSelect.Hide();


            SelectedData        = DCom.GetData(String.Format(SqlExec, CmbSelect.SelectedValue));
            TbxRatingValue.Text = SelectedData.Rows[0]["Rating_Value"].ToString();
            TbxComment.Text     = SelectedData.Rows[0]["Comment"].ToString();

            CmbUsername.DataSource    = DCom.GetData("SELECT * FROM users");
            CmbUsername.DisplayMember = "Username";
            CmbUsername.ValueMember   = "Username";
        }
Exemplo n.º 3
0
        /// <summary>
        /// When the client select the user that wants to edit the not necessarily labels, tetxboxes and comboboxes are hiding
        /// from the form and then the neccesarily labels, tetxboxes and comboboxes are pop up. Then fills all the fields with
        /// the data of the selected user.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSelect_Click(object sender, EventArgs e)
        {
            Guidelbl.Hide();
            CmbUser.Hide();
            BtnSelect.Hide();
            label1.Show();
            label2.Show();
            label3.Show();
            label4.Show();
            label5.Show();
            label6.Show();
            TbxFirstName.Show();
            TbxLastName.Show();
            TbxUsername.Show();
            TbxTelephone.Show();
            TbxEmail.Show();
            CmbTypes.Show();
            BtnEdit.Show();

            SelectedData      = DCom.GetData(String.Format(SqlExec, CmbUser.SelectedValue));
            TbxFirstName.Text = (string)SelectedData.Rows[0]["First_Name"];
            TbxLastName.Text  = (string)SelectedData.Rows[0]["Last_Name"];
            TbxUsername.Text  = (string)SelectedData.Rows[0]["Username"];
            TbxEmail.Text     = (string)SelectedData.Rows[0]["Email"];
            TbxTelephone.Text = (string)SelectedData.Rows[0]["Telephone"];

            DataTable GetUserType = DCom.GetData(String.Format("SELECT users_types.Type FROM users, users_types WHERE users.Username='******' and users.Type=users_types.Type", CmbUser.SelectedValue));

            CmbTypes.DataSource    = DCom.GetData("SELECT * FROM users_types");
            CmbTypes.DisplayMember = "Type";
            CmbTypes.ValueMember   = "Type";
            CmbTypes.Text          = (string)GetUserType.Rows[0]["Type"];
        }
Exemplo n.º 4
0
 /// <summary>
 /// In forms constractor the Combobox for User Types(CmbTypes) fills up from the table users_types
 /// that contains all the types. The diplay member is the name of the type(Row Type)
 /// and the value member is the same.
 /// </summary>
 public AddLocation()
 {
     InitializeComponent();
     CmbMunicipality.DataSource    = DCom.GetData("SELECT Municipality_Name FROM municipality");
     CmbMunicipality.DisplayMember = "Municipality_Name";
     CmbMunicipality.ValueMember   = "Municipality_Name";
 }
Exemplo n.º 5
0
 /// <summary>
 /// In the constructor the from is created.
 /// Then the combobox of the form is fill with the ID
 /// of the work hours
 /// </summary>
 public DeleteWorkHours()
 {
     InitializeComponent();
     CmbWorkHours.DataSource    = DCom.GetData("SELECT * FROM work_hours");
     CmbWorkHours.DisplayMember = "ID";
     CmbWorkHours.ValueMember   = "ID";
 }
Exemplo n.º 6
0
 /// <summary>
 /// In forms constractor the Combobox for Usernames(CmbUsername) fills up from the table users
 /// that contains all the users. The diplay member is the usenrame of the user(Row Username)
 /// and the value member is the same.
 /// </summary>
 public AddLogin()
 {
     InitializeComponent();
     CmbUsername.DataSource    = DCom.GetData("SELECT users.Username FROM users WHERE users.Username NOT IN (SELECT login.Username FROM login)");
     CmbUsername.DisplayMember = "Username";
     CmbUsername.ValueMember   = "Username";
 }
Exemplo n.º 7
0
 /// <summary>
 /// In forms constractor the Combobox for User Types(CmbMunicipality) fills up from the table users_types
 /// that contains all the types. The diplay member is the name of the type(Row Type)
 /// and the value member is the same.
 /// </summary>
 public AddMunicipality()
 {
     InitializeComponent();
     CmbMunicipality.DataSource    = DCom.GetData("SELECT * FROM province");
     CmbMunicipality.DisplayMember = "Name";
     CmbMunicipality.ValueMember   = "Name";
 }
Exemplo n.º 8
0
        /// <summary>
        /// When the client select the rating that wants to edit the not necessarily labels, tetxboxes and comboboxes are hiding
        /// from the form and then the neccesarily labels, tetxboxes and comboboxes are pop up. Then fills all the fields with
        /// the data of the selected rating.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSelect_Click(object sender, EventArgs e)
        {
            LblBusiness.Show();
            LblDate.Show();
            LblPerson.Show();
            LblUsername.Show();
            CmbBusiness.Show();
            CmbUsername.Show();
            BtnEdit.Show();
            TbxPerson.Show();
            DtpDate.Show();

            LblSelect.Hide();
            CmbSelect.Hide();
            BtnSelect.Hide();

            SelectedData   = DCom.GetData(String.Format(SqlExec, CmbSelect.SelectedValue));
            TbxPerson.Text = SelectedData.Rows[0]["Persons"].ToString();

            CmbBusiness.DataSource    = DCom.GetData("SELECT businesses.ID, CONCAT(businesses.Business_Name, ', ', location.Address_Name, ', ', location.Municipality) AS NAME FROM businesses, location WHERE businesses.Location_ID = location.ID");
            CmbBusiness.DisplayMember = "NAME";
            CmbBusiness.ValueMember   = "ID";

            CmbUsername.DataSource    = DCom.GetData("SELECT * FROM users");
            CmbUsername.DisplayMember = "Username";
            CmbUsername.ValueMember   = "Username";

            CmbUsername.Text = SelectedData.Rows[0]["User"].ToString();
            CmbBusiness.Text = SelectedData.Rows[0]["BusinessID"].ToString();
        }
Exemplo n.º 9
0
 /// In forms constractor the Combobox for Days(CmbDays) fills up from the table days
 /// that contains all the days. The diplay member is the name of the day(Row Name)
 /// and the value member is the same.
 public AddWorkHours()
 {
     InitializeComponent();
     CmbDays.DataSource    = DCom.GetData("SELECT * FROM days");
     CmbDays.DisplayMember = "Name";
     CmbDays.ValueMember   = "Name";
 }
Exemplo n.º 10
0
 /// <summary>
 /// In the constructor the from is created.
 /// Then the combobox of the form is fill with the Usernames
 /// and NAMES of users.
 /// </summary>
 public DeleteLocation()
 {
     InitializeComponent();
     CmbLocation.DataSource    = DCom.GetData("SELECT Username,CONCAT(Last_name,' ' , First_Name) AS NAME FROM users");
     CmbLocation.DisplayMember = "Location";
     CmbLocation.ValueMember   = "Location";
 }
Exemplo n.º 11
0
 /// <summary>
 /// This state is when the client press the button to add a record.
 /// Before it goes to add the record it checks if all the fields are completed.
 /// Then add the record in database.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Addbtn_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(TbxBusinessName.Text) || string.IsNullOrWhiteSpace(TbxCategory.Text) || string.IsNullOrWhiteSpace(TbxDescription.Text) ||
         string.IsNullOrWhiteSpace(TbxPrice.Text) || string.IsNullOrWhiteSpace(TbxWebsite.Text) || string.IsNullOrWhiteSpace(CmbLocation.Text) ||
         string.IsNullOrWhiteSpace(CmbTypes.Text) || string.IsNullOrWhiteSpace(CmbUser.Text) || string.IsNullOrWhiteSpace(CmbWorkHours.Text))
     {
         MessageBox.Show("PLEASE ADD ALL THE DATA", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (ChbReservation.Checked)
         {
             DCom.Exec(String.Format(SqlExec, TbxBusinessName.Text, CmbTypes.SelectedValue, TbxCategory.Text, CmbLocation.SelectedValue, TbxTelephone.Text,
                                     TbxWebsite.Text, TbxDescription.Text, CmbWorkHours.SelectedValue, CmbUser.SelectedValue, TbxRating.Text, TbxPrice.Text, '1'));
             MessageBox.Show("ADD COMPLETE");
             Close();
         }
         else
         {
             DCom.Exec(String.Format(SqlExec, TbxBusinessName.Text, CmbTypes.SelectedValue, TbxCategory.Text, CmbLocation.SelectedValue, TbxTelephone.Text,
                                     TbxWebsite.Text, TbxDescription.Text, CmbWorkHours.SelectedValue, CmbUser.SelectedValue, TbxRating.Text, TbxPrice.Text, '0'));
             MessageBox.Show("ADD COMPLETE");
             Close();
         }
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// In the constructor the from is created.
 /// Then the combobox of the form is filled with the days
 /// </summary>
 public DeleteDays()
 {
     InitializeComponent();
     CmbDay.DataSource    = DCom.GetData("SELECT * FROM days");
     CmbDay.DisplayMember = "Name";
     CmbDay.ValueMember   = "Name";
 }
Exemplo n.º 13
0
        private void BtnSelect_Click(object sender, EventArgs e)
        {
            LblBusinessDescription.Show();
            LblBusinessName.Show();
            LblCategory.Show();
            LblPrice.Show();
            LblRating.Show();
            LblTelephone.Show();
            LblUser.Show();
            LblWebsite.Show();
            LblWorkHours.Show();
            LblBusinessType.Show();
            LblLocation.Show();

            TbxBusinessName.Show();
            TbxCategory.Show();
            TbxDescription.Show();
            TbxPrice.Show();
            TbxRating.Show();
            TbxTelephone.Show();
            TbxWebsite.Show();

            CmbLocation.Show();
            CmbTypes.Show();
            CmbUser.Show();
            CmbWorkHours.Show();

            ChbReservation.Show();

            BtnEdit.Show();

            LblSelect.Hide();
            CmbBusinesses.Hide();
            BtnSelect.Hide();

            SelectedData         = DCom.GetData(String.Format(SqlExec, CmbBusinesses.SelectedValue));
            TbxBusinessName.Text = (string)SelectedData.Rows[0]["Business_Name"];
            TbxCategory.Text     = (string)SelectedData.Rows[0]["Category"];
            TbxDescription.Text  = (string)SelectedData.Rows[0]["Description"];
            TbxPrice.Text        = SelectedData.Rows[0]["Price_Range"].ToString();
            TbxRating.Text       = (string)SelectedData.Rows[0]["Rating"].ToString();
            TbxTelephone.Text    = (string)SelectedData.Rows[0]["Telephone"];
            TbxWebsite.Text      = (string)SelectedData.Rows[0]["Website"];

            CmbLocation.DataSource    = DCom.GetData("SELECT ID,CONCAT(Address_Name, ', ', Address_Number) AS NAME FROM location");
            CmbLocation.DisplayMember = "NAME";
            CmbLocation.ValueMember   = "ID";

            CmbTypes.DataSource    = DCom.GetData("SELECT * FROM businesses_types");
            CmbTypes.DisplayMember = "Type";
            CmbTypes.ValueMember   = "Type";

            CmbUser.DataSource    = DCom.GetData("SELECT * FROM users");
            CmbUser.DisplayMember = "Username";
            CmbUser.ValueMember   = "Username";

            CmbWorkHours.DataSource    = DCom.GetData("SELECT * FROM work_hours");
            CmbWorkHours.DisplayMember = "ID";
            CmbWorkHours.ValueMember   = "ID";
        }
Exemplo n.º 14
0
        /// <summary>
        /// When the client select the user that wants to edit the not necessarily labels, tetxboxes and comboboxes are hiding
        /// from the form and then the neccesarily labels, tetxboxes and comboboxes are pop up. Then fills all the fields with
        /// the data of the selected user.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSelect_Click(object sender, EventArgs e)
        {
            label2.Show();
            label3.Show();
            label4.Show();
            label5.Show();
            label6.Show();
            label7.Show();
            TbxAddressNumber.Show();
            TbxAdressName.Show();
            TbxLat.Show();
            TbxLong.Show();
            TbxPostalCode.Show();
            CmbMunicipality.Show();
            BtnEdit.Show();

            label1.Hide();
            CmbLocation.Hide();
            BtnSelect.Hide();

            SelectedData          = DCom.GetData(String.Format(SqlExec, CmbLocation.SelectedValue));
            TbxAdressName.Text    = SelectedData.Rows[0]["Address_Name"].ToString();
            TbxAddressNumber.Text = SelectedData.Rows[0]["Address_Number"].ToString();
            TbxLat.Text           = SelectedData.Rows[0]["Lat"].ToString();
            TbxLong.Text          = SelectedData.Rows[0]["Long"].ToString();
            TbxPostalCode.Text    = SelectedData.Rows[0]["Postal_Code"].ToString();

            CmbMunicipality.DataSource    = DCom.GetData("SELECT * FROM municipality");
            CmbMunicipality.DisplayMember = "Municipality_Name";
            CmbMunicipality.ValueMember   = "Municipality_Name";
            CmbMunicipality.Text          = SelectedData.Rows[0]["Municipality"].ToString();
        }
Exemplo n.º 15
0
 /// <summary>
 /// In the constructor the from is created.
 /// Then the combobox of the form is fill with the Usernames
 /// and NAMES of users.
 /// </summary>
 public DeleteMunicipality()
 {
     InitializeComponent();
     CmbMunicipality.DataSource    = DCom.GetData("SELECT * FROM municipality");
     CmbMunicipality.DisplayMember = "NAME";
     CmbMunicipality.ValueMember   = "Municipality_Name";
 }
Exemplo n.º 16
0
 /// <summary>
 /// In the constructor the from is created.
 /// Then the combobox of the form is fill with the Usernames
 /// and NAMES of users.
 /// </summary>
 public DeleteUser()
 {
     InitializeComponent();
     CmbUsers.DataSource    = DCom.GetData("SELECT Username,CONCAT(Last_name,' ' , First_Name) AS NAME FROM users");
     CmbUsers.DisplayMember = "NAME";
     CmbUsers.ValueMember   = "Username";
 }
Exemplo n.º 17
0
 /// <summary>
 /// In the constructor the from is created.
 /// Then the combobox of the form is fill with the Usernames
 ///  of the table login.
 /// </summary>
 public DeleteLogin()
 {
     InitializeComponent();
     CmbUsername.DataSource    = DCom.GetData("SELECT * FROM login");
     CmbUsername.DisplayMember = "Username";
     CmbUsername.ValueMember   = "Username";
 }
Exemplo n.º 18
0
        /// <summary>
        /// In forms constractor the Combobox for Username(CmbUsername) fills up from the table users
        /// that contains all the users. The diplay member is the name of the Username(Row Username)
        /// and the value member is the same.
        /// </summary>
        public AddRatingsForm()
        {
            InitializeComponent();

            CmbUsername.DataSource    = DCom.GetData("SELECT Username FROM users");
            CmbUsername.DisplayMember = "Username";
            CmbUsername.ValueMember   = "Username";
        }
Exemplo n.º 19
0
        /// <summary>
        /// In the constructor the from is created.
        /// Then the combobox of the form is fill with the province names of thre provinces.
        /// </summary>
        public DeleteProvince()
        {
            InitializeComponent();

            CmbUsers.DataSource    = DCom.GetData("SELECT * FROM province");
            CmbUsers.DisplayMember = "Province_Name";
            CmbUsers.ValueMember   = "Province_Name";
        }
Exemplo n.º 20
0
        public DeleteBusinessForm()
        {
            InitializeComponent();

            CmbBusiness.DataSource    = DCom.GetData("SELECT businesses.ID, CONCAT(businesses.Business_Name, ', ', location.Address_Name, ', ', location.Municipality) AS NAME FROM businesses, location WHERE businesses.Location_ID = location.ID");
            CmbBusiness.DisplayMember = "NAME";
            CmbBusiness.ValueMember   = "ID";
        }
Exemplo n.º 21
0
        /// <summary>
        /// This is forms constructor.
        /// In this constructor the combobox for user types(CmbBusinessesTypes) is
        /// filling from the user types table(businesses_types).
        /// </summary>
        public DeleteBusinessesTypes()
        {
            InitializeComponent();

            CmbBusinessesTypes.DataSource    = DCom.GetData("SELECT * FROM businesses_types");
            CmbBusinessesTypes.DisplayMember = "Type";
            CmbBusinessesTypes.ValueMember   = "Type";
        }
Exemplo n.º 22
0
        /// <summary>
        /// In the constructor the from is created.
        /// Then the combobox of the form is fill with the ID and NAME
        /// from reservation.
        /// </summary>
        public DeleteReservationForm()
        {
            InitializeComponent();

            CmbReservations.DataSource    = DCom.GetData("SELECT ID, CONCAT(ID, ', ', User, ', ', BusinessID) AS NAME FROM reservation");
            CmbReservations.DisplayMember = "NAME";
            CmbReservations.ValueMember   = "ID";
        }
Exemplo n.º 23
0
        /// <summary>
        /// In the constructor the from is created.
        /// Then the combobox of the form is fill with the Usernames
        /// </summary>
        public DeleteRatingsForm()
        {
            InitializeComponent();

            CmbRatings.DataSource    = DCom.GetData("SELECT *, CONCAT(Username, ', ', Rating_Value) AS NAME FROM ratings");
            CmbRatings.DisplayMember = "NAME";
            CmbRatings.ValueMember   = "ID";
        }
Exemplo n.º 24
0
        /// <summary>
        /// In forms constructor the not necessarily labels, tetxboxes and comboboxes are hiding
        /// from the form. Then the combobox for users(CmbDays) is filling with the usernames and NAMES
        /// from table users.
        /// </summary>
        public EditDays()
        {
            InitializeComponent();
            label2.Hide();
            TbxDays.Hide();

            CmbDays.DataSource    = DCom.GetData("SELECT * FROM days");
            CmbDays.DisplayMember = "Name";
            CmbDays.ValueMember   = "Name";
        }
Exemplo n.º 25
0
        /// <summary>
        /// In forms constructor the not necessarily labels and tetxboxes are hiding
        /// from the form. Then the combobox for businesses types(CmbBusinessesTypes) is filling
        /// from the businesses types(businesses_types) table.
        /// /// </summary>
        public EditBusinessesTypes()
        {
            InitializeComponent();
            BtnEdit.Hide();
            LblGuide1.Hide();
            TbxEditiBusinessesTypes.Hide();

            CmbBusinessesTypes.DataSource    = DCom.GetData("SELECT * FROM businesses_types");
            CmbBusinessesTypes.DisplayMember = "Type";
            CmbBusinessesTypes.ValueMember   = "Type";
        }
Exemplo n.º 26
0
        /// <summary>
        /// In forms constructor the not necessarily labels, tetxboxes and comboboxes are hiding
        /// from the form. Then the combobox for province(comboBoxptovince) is filling with the data from table province.
        /// </summary>
        public EditProvince()
        {
            InitializeComponent();

            TbxProvinceName.Hide();
            labelpro.Hide();
            BtnEdit.Hide();

            comboBoxptovince.DataSource    = DCom.GetData("SELECT * FROM province");
            comboBoxptovince.DisplayMember = "Province_Name";
            comboBoxptovince.ValueMember   = "Province_Name";
        }
Exemplo n.º 27
0
        /// <summary>
        /// In forms constructor the not necessarily labels and tetxboxes are hiding
        /// from the form. Then the combobox for login(CmbUsername) is filling
        /// from the user types(users_types) table.
        /// /// </summary>
        public EditMunicipality()
        {
            InitializeComponent();
            guidelbl.Hide();
            label2.Hide();
            TbxName.Hide();
            CmbProvince.Hide();

            CmbMunicipality_Name.DataSource    = DCom.GetData("SELECT * FROM municipality WHERE Municipality_Name = '{0}'");
            CmbMunicipality_Name.DisplayMember = "NAME";
            CmbMunicipality_Name.ValueMember   = "NAME";
        }
Exemplo n.º 28
0
        private void BtnSelect_Click(object sender, EventArgs e)
        {
            TbxDays.Show();
            BtnEdit.Show();
            label2.Show();
            label3.Hide();
            CmbDays.Hide();
            BtnSelect.Hide();

            SelectedData = DCom.GetData(String.Format(SqlExec, CmbDays.SelectedValue));
            TbxDays.Text = (string)SelectedData.Rows[0]["Name"];
        }
Exemplo n.º 29
0
        /// <summary>
        /// When the client select the user type that wants to edit the not necessarily labels and comboboxes are hiding
        /// from the form and then the neccesarily labels and tetxboxes are pop up. Then fills all the fields with
        /// the data of the selected user type.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSelect_Click(object sender, EventArgs e)
        {
            BtnEdit.Show();
            LblGuide1.Show();
            TbxEditiBusinessesTypes.Show();
            BtnSelect.Hide();
            CmbBusinessesTypes.Hide();
            LblGuide.Hide();

            SelectedData = DCom.GetData(String.Format(SqlExec, CmbBusinessesTypes.SelectedValue));
            TbxEditiBusinessesTypes.Text = (string)SelectedData.Rows[0]["Type"];
        }
Exemplo n.º 30
0
        /// <summary>
        /// When the client select the privince that wants to edit the not necessarily labels, tetxboxes and comboboxes are hiding
        /// from the form and then the neccesarily labels, tetxboxes and comboboxes are pop up. Then fills all the fields with
        /// the data of the selected province.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnselect_Click(object sender, EventArgs e)
        {
            label2.Hide();
            comboBoxptovince.Hide();
            TbxProvinceName.Hide();
            btnselect.Hide();
            labelpro.Show();
            TbxProvinceName.Show();
            BtnEdit.Show();

            SelectedData         = DCom.GetData(String.Format(SqlExec, comboBoxptovince.SelectedValue));
            TbxProvinceName.Text = (string)SelectedData.Rows[0]["Province_Name"];
        }