예제 #1
0
        /// <summary>
        /// method to check if the user put correct input in the employee fields
        /// </summary>
        /// <returns>
        /// res = true - all inputs correct
        /// res = false - one or more from the inputs is incorrect
        /// </returns>
        public bool inputChecks()
        {
            bool res = true;

            if (Checks.IsEmptyString(txtEmployeeLname.Text) || Checks.IsEmptyString(txtEmployeeName.Text))
            {
                res = false;
                MessageBox.Show("אחד או יותר מהשדות ריקים!", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (!Checks.IsStringIsContainLettersOrNumbers(txtEmployeeName.Text))
            {
                res = false;
                MessageBox.Show("שם פרטי יכול להכיל רק אותיות בעברית!", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(res);
        }
예제 #2
0
 /// <summary>
 /// method wich works when the user press on "update password"
 /// the method check if the passwords fields not empty and match and if all ok update to the new password
 /// </summary>
 private void btnUpdatePassword_Click(object sender, EventArgs e)
 {
     if (Checks.IsEmptyString(txtPassword.Text) || Checks.IsEmptyString(txtConfirmPassword.Text))
     {
         MessageBox.Show("אחד או יותר משדות הסיסמא ריקים ", "הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (txtPassword.Text != txtConfirmPassword.Text)
     {
         MessageBox.Show("השדות סיסמא ואימות סיסמא לא תואמים", "הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         tmpUser.Password = Eramake.eCryptography.Encrypt(txtPassword.Text);//Encrypt password
         db.UpdateUserPassword(tmpUser);
         MessageBox.Show("המשתמש עודכן בהצלחה", "הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
 }
예제 #3
0
        /// <summary>
        /// method wich works when the uset chose customer from the list
        /// the method will set the selected customer properrty to the chosen one and close the form
        /// </summary>
        private void lstCustomers_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Checks.IsItemSelected(lstCustomers))
            {
                string[] words            = lstCustomers.SelectedItem.ToString().Split('|');
                int      chosenCustomerId = int.Parse(words[0]);
                bool     flag             = true;

                for (int i = 0; i < customers.Length && flag; i++)
                {
                    if (customers[i].CustomerId == chosenCustomerId)
                    {
                        selctedCustomer = customers[i];
                        flag            = false;
                    }
                }
                this.Close();
            }
        }
예제 #4
0
 /// <summary>
 /// Method to remove ingredient from the database
 /// </summary>
 private void btnRemoveIngredient_Click(object sender, EventArgs e)
 {
     if (Checks.IsItemSelected(lstIngredients))
     {
         if (db.IsIngredientPartOfDish(GetIngredientIdByName(txtIngredientName.Text)))
         {
             MessageBox.Show("המרכיב שנבחר הוא חלק ממנה, לא ניתן להסיר אותו!");
         }
         else
         {
             db.RemoveIngredientByName(chosenIngredientName);
             MessageBox.Show("המרכיב נמחק בהצלחה!");
             FillIngredientsList();
         }
     }
     else
     {
         MessageBox.Show("בחר מרכיב מהרשימה ואז לחץ על הסר מרכיב");
     }
 }
예제 #5
0
 /// <summary>
 /// method wich works when the user press on "add product" button
 /// the method will check the inputs and insert the new product to data base
 /// </summary>
 private void btnAddProduct_Click(object sender, EventArgs e)
 {
     if (Checks.IsEmptyString(txtProductName.Text) || Checks.IsNumberPositive(int.Parse(nudProductPrice.Value.ToString())))
     {
         MessageBox.Show("אחד מהשדות לא מלא !! ", "הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (db.IsProductNameAlreadyExists(txtProductName.Text))
         {
             MessageBox.Show("המוצר כבר קיים במלאי  !! ", "הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             InsertNewProduct();
             MessageBox.Show(txtProductName.Text + " נוסף בהצלחה לתפריט ! ", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Information);
             CleanFields();
         }
     }
 }
예제 #6
0
 /// <summary>
 /// method wich works when the user press on "add wine" button
 /// the method will check the inputs and insert the new wine to data base
 /// </summary>
 private void btnAddWine_Click(object sender, EventArgs e)
 {
     if (Checks.IsEmptyString(txtWineName.Text))
     {
         MessageBox.Show("הכנס את השם של היין בבקשה ", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (db.IsWineNameAndYearAlreadyExists(txtWineName.Text, dtpWineYear.Text))
         {
             MessageBox.Show("היין כבר קיים במערכת !! בדוק בבקשה את הפרטים שוב  ", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             InsertNewWine();
             MessageBox.Show(txtWineName.Text + " נוסף בהצלחה לתפריט ! ", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Information);
             CleanFields();
         }
     }
 }
예제 #7
0
 /// <summary>
 /// method wich works when the user press on "cancle product" button
 /// the method will save the cancle details (rason and if provided)
 /// and bring back the information to the order object
 /// </summary>
 private void btnCancelProduct_Click(object sender, EventArgs e)
 {
     if (Checks.IsEmptyString(rtbReasonForCancellation.Text))
     {
         MessageBox.Show("לא נרשמה סיבת הביטול!!");
     }
     if (rbProvided.Checked == false && rbNotProvided.Checked == false)
     {
         MessageBox.Show("יש לבחור המוצר סופק או המוצר לא סופק");
     }
     else
     {
         btnCancelProduct.DialogResult = DialogResult.OK;
         btnCancelProduct.Enabled = true;
         if (rbProvided.Checked == true)
             CancellationReason = rtbReasonForCancellation.Text + " " + rbProvided.Text;
         else
             CancellationReason = rtbReasonForCancellation.Text + " " + rbNotProvided.Text;
     }
 }
예제 #8
0
        /// <summary>
        /// method to check if the user put correct input in the event fields
        /// </summary>
        /// <returns>
        /// res = true - all inputs correct
        /// res = false - one or more from the inputs is incorrect
        /// </returns>
        public bool inputChecks()
        {
            bool res = true;

            if (Checks.IsEmptyString(txtOwnerFname.Text) || Checks.IsEmptyString(txtOwnerLname.Text) ||
                Checks.IsEmptyString(txtOwnerPhone.Text) || Checks.IsEmptyString(txtOwnerMail.Text) ||
                Checks.IsEmptyString(txtEventType.Text) || Checks.IsEmptyString(txtEventParticipants.Text))
            {
                MessageBox.Show("אחד או יותר מהשדות ריקים, אנא הכנס את כל השדות");
                res = false;
            }
            else
            {
                if (!Checks.IsValidEmail(txtOwnerMail.Text))
                {
                    MessageBox.Show("מייל לא תקין!");
                    res = false;
                }
                else if (!Checks.IsValidPhone(txtOwnerPhone.Text))
                {
                    MessageBox.Show("טלפון לא תקין!");
                    res = false;
                }
                else if (!Checks.IsValidPhone(txtEventParticipants.Text))
                {
                    MessageBox.Show("השדה מספר משתפפים יכול להכיל רק מספרים!");
                    res = false;
                }
                else if (int.Parse(txtEventParticipants.Text) < 1)
                {
                    MessageBox.Show("מספר המשתתפים חייב להיות גדול מ 0!");
                    res = false;
                }
                else if (dtpEventTime.Text == "00:00:00")
                {
                    MessageBox.Show("הכנס שעת האירוע!");
                    res = false;
                }
            }
            return(res);
        }
예제 #9
0
        /// <summary>
        /// method wich checks if one of the fields empty
        /// </summary>
        /// <returns>
        /// bool true - at least one is empty
        /// bool false - all fields ok
        /// </returns>
        private bool IsEmptyString()
        {
            bool res = false;

            if (Checks.IsEmptyString(txtUserName.Text) || Checks.IsEmptyString(txtPassword.Text) || Checks.IsEmptyString(txtConfirmPassword.Text))
            {
                res = true;
            }
            return(res);
        }