public static bool LogInChecker(string Email, string Pass) { int Position = 100 * HashFunction(Email); FileStream.Seek(Position, SeekOrigin.Begin); while (BinaryReader.PeekChar() == 'T') { int Temp = Position; BinaryReader.ReadChar(); if (BinaryReader.ReadString().ToLower() == Email && BinaryReader.ReadString() == Pass) { try { Cur = new Client(Email, Pass, BinaryReader.ReadString(), BinaryReader.ReadString(), BinaryReader.ReadString(), BinaryReader.ReadString(), BinaryReader.ReadString(), BinaryReader.ReadString(), BinaryReader.ReadInt32()); } catch (Exception ex) { return(false); } CurPosition = Position; ClientsLogs.SetAdress(Temp); return(true); } Position += 100; FileStream.Seek(Position, SeekOrigin.Begin); } return(false); }
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(); } }
public void TableIntial() { ClientsLogs.GetLogs(dataGridView1); }