Beispiel #1
0
 /// <summary>
 /// method wich works when the user press on "update product" button
 /// the method will check the inputs and update the spcific product details
 /// </summary>
 private void btnUpdateProduct_Click(object sender, EventArgs e)
 {
     if (Checks.IsEmptyString(txtProductName.Text))
     {
         MessageBox.Show("הכנס את השם של המוצר בבקשה ", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (productToUpdate.Name != txtProductName.Text)
         {
             if (db.IsProductNameAlreadyExists(txtProductName.Text))
             {
                 MessageBox.Show("המוצר כבר קיים במערכת !! בדוק בבקשה את הפרטים שוב  ", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             else
             {
                 FillDataToUpdateProduct();
                 db.UpdateProduct(productToUpdate);
                 MessageBox.Show(txtProductName.Text + " עודכן בהצלחה ! ", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 CleanFields();
             }
         }
         else
         {
             FillDataToUpdateProduct();
             db.UpdateProduct(productToUpdate);
             MessageBox.Show(txtProductName.Text + " עודכן בהצלחה ! ", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Information);
             CleanFields();
         }
     }
 }
Beispiel #2
0
 //method wich works when the user press on "הוסף מרכיב" button
 //the method will add new ingredient in to the data base and refresh the ingredient list
 private void btnAddIngredient_Click(object sender, EventArgs e)
 {
     if (Checks.IsEmptyString(txtIngredientName.Text))
     {
         MessageBox.Show("הכנס שם מרכיב להוספה");
     }
     else
     {
         if (Checks.IsStringContainNumbers(txtIngredientName.Text))
         {
             MessageBox.Show("שם מרכיב לא יכול להכיל מספרים");
         }
         else
         {
             if (db.IsIngredientShow(txtIngredientName.Text))
             {
                 MessageBox.Show("מרכיב עם השם הזה כבר קיים ברשימת המרכיבים!");
             }
             else
             {
                 db.InsertNewIngredient(txtIngredientName.Text);
                 FillIngredientsList();
                 MessageBox.Show("המרכיב התווסף בהצלחה!");
             }
         }
     }
 }
Beispiel #3
0
 /// <summary>
 /// method wich works when the user press on "update wine" button
 /// the method will check the inputs and update the spcific wine details
 /// </summary>
 private void btnUpdateWine_Click(object sender, EventArgs e)
 {
     if (Checks.IsEmptyString(txtWineName.Text))
     {
         MessageBox.Show("הכנס את השם של היין בבקשה ", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (wineToUpdate.Name != txtWineName.Text || wineToUpdate.Year != dtpWineYear.Text)
         {
             if (db.IsWineNameAndYearAlreadyExists(txtWineName.Text, dtpWineYear.Text))
             {
                 MessageBox.Show("היין כבר קיים במערכת !! בדוק בבקשה את הפרטים שוב  ", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             else
             {
                 db.UpdateWine(FiilDataToUpdateWine());
                 db.UpdateProduct(FillDateToUpdateProduct());
                 MessageBox.Show(txtWineName.Text + " עודכן בהצלחה ! ", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         else
         {
             db.UpdateWine(FiilDataToUpdateWine());
             db.UpdateProduct(FillDateToUpdateProduct());
             MessageBox.Show(txtWineName.Text + " עודען בהצלחה ! ", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     CleanFields();
 }
Beispiel #4
0
 /// <summary>
 /// method wich works when the user press on "update user"
 /// the method will check all the details in the fields
 /// and if all ok will update the spcific user details in the data base
 /// </summary>
 private void btnUpdateUser_Click(object sender, EventArgs e)
 {
     if (cboUsersNames.Text == "בחר משתמש")
     {
         MessageBox.Show("בחר משתמש מהרשימה לצורך עדכון", "הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (cboPermissionUpdate.Text == "בחר הרשאה")
     {
         MessageBox.Show("בחר הרשאת משתמש", "הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (Checks.IsEmptyString(txtPasswordUpdate.Text) || Checks.IsEmptyString(txtConfirmPasswordUpdate.Text))
     {
         MessageBox.Show("אחד או יותר משדות הסיסמא ריקים ", "הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (txtPasswordUpdate.Text != txtConfirmPasswordUpdate.Text)
     {
         MessageBox.Show("השדות: סיסמא ואימות סיסמא לא תואמים", "הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         userToUpdate.Password   = Eramake.eCryptography.Encrypt(txtPasswordUpdate.Text);//Encrypt password
         userToUpdate.Permission = cboPermissionUpdate.Text;
         db.UpdateUser(userToUpdate);
         MessageBox.Show("  המשתמש :  " + userToUpdate.UserName + "   עודכן בהצלחה    !  ", " הודעת מערכת", MessageBoxButtons.OK, MessageBoxIcon.Information);
         ClearingFields();
     }
 }
Beispiel #5
0
        /// <summary>
        /// method to check if the user put correct input in the customer 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(txtCustomerFname.Text) || Checks.IsEmptyString(txtCustomerLname.Text) ||
                Checks.IsEmptyString(txtCustomerPhone.Text) || Checks.IsEmptyString(txtCustomerEmail.Text))
            {
                res = false;
                MessageBox.Show("אחד או יותר מהשדות ריקים!");
            }
            else if (!Checks.IsStringIsContainLettersOrNumbers(txtCustomerFname.Text))
            {
                res = false;
                MessageBox.Show("שם פרטי יכול להכיל רק אותיות בעברית!");
            }
            else if (!Checks.IsStringIsContainLettersOrNumbers(txtCustomerLname.Text))
            {
                res = false;
                MessageBox.Show("שם משפחה יכול להכיל רק אותיות בעברית!");
            }
            else if (!Checks.IsValidEmail(txtCustomerEmail.Text))
            {
                res = false;
                MessageBox.Show("אימייל לא חוקי!");
            }
            else if (!Checks.IsValidPhone(txtCustomerPhone.Text))
            {
                res = false;
                MessageBox.Show("טלפון לא חוקי !");
            }
            return(res);
        }
Beispiel #6
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);
        }
Beispiel #7
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);
        }
 /// <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();
     }
 }
Beispiel #9
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();
         }
     }
 }
Beispiel #10
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();
         }
     }
 }
Beispiel #11
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;
     }
 }
Beispiel #12
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);
        }