Example #1
0
        private void bntSave_Click(object sender, EventArgs e)
        {
            BL.CustomerClass obj = new BL.CustomerClass();

            try
            {
                if (state == "add")
                {
                    if (txtName.Text != string.Empty && txtPhone.Text != string.Empty &&
                        txtPhone.Text != "رقم الهاتف " && txtName.Text != "اسم الزبون ")
                    {
                        obj.InsertCus(txtName.Text, txtPhone.Text, txtNote.Text);
                        MessageBox.Show("تم الحفظ بنجاح", "عملية الحفظ",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                    else
                    {
                        MessageBox.Show("الرجاء ادخال المعلومات");
                    }
                }
                else
                {
                    if (txtName.Text != string.Empty && txtPhone.Text != string.Empty &&
                        txtPhone.Text != "رقم الهاتف " && txtName.Text != "اسم الزبون ")
                    {
                        obj.updateCus(txtName.Text, txtPhone.Text, UserID);
                        MessageBox.Show("تم الحفظ بنجاح", "عملية الحفظ",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                    else
                    {
                        MessageBox.Show("الرجاء ادخال المعلومات");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }