private void button1_Click(object sender, EventArgs e) { if (CharsChecker(InFName.Text) && CharsChecker(InLName.Text) && NumsChecker(InCard.Text) && NumsChecker(InPhone.Text) && InEmail.Text.Length > 0 && InPass.Text.Length > 0 && InAge.SelectedIndex != -1 && InAge.SelectedIndex != -1) { if (ClientsData.IsRegistered(InEmail.Text.ToLower())) { Client newUser = new Client(InEmail.Text, InPass.Text, InFName.Text, InLName.Text, InCountry.Text, InAge.Text, InCard.Text, InPhone.Text); ClientsData.AddUser(newUser); MessageBox.Show("You Have Been Registered Successfully You Can Login Now!", "Congratulations"); this.Close(); } else { MessageBox.Show("You Have Already Registered An Account!", "Error"); } } else { MessageBox.Show("Please Correct Your Info And Try Again!", "Error"); } }
private void Del_Click(object sender, EventArgs e) { if (MessageBox.Show("Are You Sure You Want To Delete Your Account ?!", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ClientsData.DeleteAccount(); this.Close(); } }
private void Payment_Click(object sender, EventArgs e) { (new PaymentService()).ShowDialog(); string Temp = (ClientsData.Current.AmountI).ToString() + "$"; if (Temp != Amount.Text) { dataGridView1.Rows.Add("Payment For " + PayMent.Pay + " : ", PayMent.Value.ToString() + "$"); ClientsLogs.AddLog("Payment For " + PayMent.Pay + " : ", PayMent.Value.ToString() + "$"); Amount.Text = Temp; ClientsData.UpdateAccount(); } }
private void Withdrawal_Click(object sender, EventArgs e) { (new PayMent("Withdrawal")).ShowDialog(); string Temp = (ClientsData.Current.AmountI).ToString() + "$"; if (Temp != Amount.Text) { dataGridView1.Rows.Add("Withdrawal From The Account : ", PayMent.Value.ToString() + "$"); ClientsLogs.AddLog("Withdrawal From The Account : ", PayMent.Value.ToString() + "$"); Amount.Text = Temp; ClientsData.UpdateAccount(); } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (MessageBox.Show("Are You Sure To Exit?!", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { e.Cancel = true; } else { if (!ClientsData.CloseStreams() || !ClientsLogs.CloseStreams()) { MessageBox.Show("Data File Can't Be Closed Correctly!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public Form1() { InitializeComponent(); string Replay = ClientsData.OpenStreams(); if (Replay != "Opened") { MessageBox.Show(Replay, "Can't Open Data File", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Dispose(); } Replay = ClientsLogs.OpenStreams(); if (Replay != "Opened") { MessageBox.Show(Replay, "Can't Open Data File", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Dispose(); } }
private void button1_Click(object sender, EventArgs e) { if (EmLog.Text.Length < 1 || PassLog.Text.Length < 1) { MessageBox.Show("Please Enter Your Email & Password And Try Again!", "Error"); } else { if (ClientsData.LogInChecker(EmLog.Text.ToLower(), PassLog.Text)) { this.Hide(); (new MyAccount()).ShowDialog(); this.Show(); } else { MessageBox.Show("Please Correct Your Email & Password And Try Again!", "Error"); } } }