Ejemplo n.º 1
0
        private void BT_MCash_Click(object sender, EventArgs e)
        {
            MCash f3 = new MCash(a, b, Phone_Login);

            f3.Show();
            this.Hide();
        }
Ejemplo n.º 2
0
        private void BT_MCash_Click(object sender, EventArgs e)
        {
            MCash f1 = new MCash(Substraction_, Pass_Substraction, Phone_Login);

            f1.Show();
            this.Hide();
        }
Ejemplo n.º 3
0
 private void BT_LogIn_Click(object sender, EventArgs e)
 {
     Real_Ph    = TB_Phone_LogIn.Text;
     Real_Pass  = TB_Password_LogIn.Text;
     Phone_Temp = Real_Ph;
     try
     {
         FileStream   fs = new FileStream(TB_Phone_LogIn.Text + "_profile.txt", FileMode.Open, FileAccess.Read);
         StreamReader sr = new StreamReader(fs);
         Read_All     = sr.ReadToEnd();
         Read_All_Arr = Read_All.Split(Delimiter_Line);
         sr.Close();
         fs.Close();
         Pass_Phone       = Read_All_Arr[3];
         Pass_Password    = Read_All_Arr[8];
         Confirm_Password = TB_Password_LogIn.Text;
         Confirm_Phone    = TB_Phone_LogIn.Text;
         //label12.Text = Pass_Phone;
         //label13.Text = Pass_Password;
         //TB_Phone_LogIn.Text = Pass_Phone;
         //TB_Password_LogIn.Text = Pass_Password;
         //MessageBox.Show("sek", "sek", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         if ((TB_Phone_LogIn.Text.ToLower().Trim() == Pass_Phone.ToString().ToLower().Trim()) && (TB_Password_LogIn.Text.ToLower().Trim() == Pass_Password.ToString().ToLower().Trim()))
         {
             MessageBoxButtons a       = MessageBoxButtons.OK;
             DialogResult      result3 = MessageBox.Show("Logging in account successfully !", "Information Center", a, MessageBoxIcon.Information);
             if (result3 == DialogResult.OK)
             {
                 Form1   f1_ = new Form1(TB_Phone_LogIn.Text.ToLower().Trim());
                 MCash   f2_ = new MCash(a_, b_, TB_Phone_LogIn.Text.ToLower().Trim());
                 History f3_ = new History(TB_Phone_LogIn.Text.ToLower().Trim());
                 f1_.Show();
                 this.Hide();
             }
         }
         else
         {
             MessageBoxButtons a       = MessageBoxButtons.OK;
             DialogResult      result4 = MessageBox.Show("The account is found, but the password is incorrect. Please fill your password properly", "Information Center", a, MessageBoxIcon.Information);
             if (result4 == DialogResult.OK)
             {
                 TB_Phone_LogIn.Clear();
                 TB_Password_LogIn.Clear();
                 TB_Phone_LogIn.Text = Phone_Temp;
             }
         }
     }
     catch (FileNotFoundException ex)
     {
         MessageBoxButtons a       = MessageBoxButtons.OK;
         DialogResult      result5 = MessageBox.Show("Account either not found or not registered yet. Please sign up your account first in order to use the application", "Information Center", a, MessageBoxIcon.Information);
         //label12.Text = ex.ToString();
     }
 }
Ejemplo n.º 4
0
        private void BT_Book_Click(object sender, EventArgs e)
        {
            //
            MessageBoxButtons a       = MessageBoxButtons.YesNo;
            DialogResult      result3 = MessageBox.Show("You are about to book the ticket(s). Once it's booked, it can't be refund at any forms. Proceed to booking ?", "Information Center", a, MessageBoxIcon.Information);

            if (result3 == DialogResult.Yes)
            {
                increment++;
                increment_c++;
                inc_++;
                if (Pass_Substraction > Tot_Pricing)
                {
                    Substraction_     = Tot_Pricing;
                    Pass_Substraction = Pass_Substraction - Tot_Pricing;
                    MCash f2 = new MCash(Substraction_, Pass_Substraction, Phone_Login);
                    label20.Text = Convert.ToString(Pass_Substraction);
                    File.WriteAllText(Phone_Login + "_cash.txt", String.Empty);
                    File.WriteAllText(Phone_Login + "_counter.txt", String.Empty);

                    FileStream   fs = new FileStream(Phone_Login + "_cash.txt", FileMode.Append, FileAccess.Write);
                    StreamWriter sr = new StreamWriter(fs);
                    sr.WriteLine(Pass_Substraction);
                    sr.Flush();
                    sr.Close();
                    fs.Close();

                    var unique = Guid.NewGuid().ToString();
                    Code       = unique.Split(Deli_Strip);
                    Coded      = Code[0].ToUpper();
                    Valid2_Now = date.ToString("HH:mm:ss ( " + DateTime.Today.ToShortDateString() + " ) ");
                    date2      = date2.AddDays(7);
                    Valid2_End = date.ToString("HH:mm:ss ( " + DateTime.Today.AddDays(7).ToShortDateString() + " ) ");

                    Pop_up f4 = new Pop_up(Coded, Valid2_Now, Valid2_End);
                    f4.Show();
                    FileStream   fs5 = new FileStream(Phone_Login + "_booking.txt", FileMode.Append, FileAccess.Write);
                    StreamWriter sr5 = new StreamWriter(fs5);
                    sr5.WriteLine(increment + "#" + Coded + "#" + Valid2_Now + "#" + Valid2_End + "#" + TB_Origin_Check.Text + "#" + TB_Destination_Check.Text + "#" + TB_Passenger_Check.Text + "#" + TB_Time_Check.Text + "#" + TB_Distances_Check.Text + "#" + TB_TotPrice_Check.Text + "#" + TB_Price_Check.Text + "#");
                    sr5.Flush();
                    sr5.Close();
                    fs5.Close();

                    FileStream   fs6 = new FileStream(Phone_Login + "_counter.txt", FileMode.Append, FileAccess.Write);
                    StreamWriter sr6 = new StreamWriter(fs6);
                    sr6.WriteLine(inc_);
                    sr6.Flush();
                    sr6.Close();
                    fs6.Close();

                    File.WriteAllText("global_counter.txt", String.Empty);
                    FileStream   fs9 = new FileStream("global_counter.txt", FileMode.Append, FileAccess.Write);
                    StreamWriter sr9 = new StreamWriter(fs9);
                    sr9.WriteLine(increment_c);
                    sr9.Flush();
                    sr9.Close();
                    fs9.Close();

                    File.WriteAllText(Phone_Login + "_checkHistory.txt", String.Empty);
                    FileStream   fp1 = new FileStream(Phone_Login + "_checkHistory.txt", FileMode.Append, FileAccess.Write);
                    StreamWriter sp1 = new StreamWriter(fp1);
                    sp1.WriteLine("1");
                    sp1.Flush();
                    sp1.Close();
                    fp1.Close();

                    MessageBoxButtons b       = MessageBoxButtons.OK;
                    DialogResult      result4 = MessageBox.Show("Booking process have been successfully made. See the booking details in the Histroy for more information about the booked ticket", "Information Center", a, MessageBoxIcon.Information);
                }
            }
        }
Ejemplo n.º 5
0
        private void BT_SignUp_Click(object sender, EventArgs e)
        {
            validation();
            if (checking_all)
            {
                MessageBoxButtons b       = MessageBoxButtons.YesNo;
                DialogResult      result2 = MessageBox.Show("Have you fulfill the requirements properly ? It cannot be changed for futher operation. Proceed to register your Account ?", "Information Center", b, MessageBoxIcon.Question);
                if (result2 == DialogResult.Yes)
                {
                    try
                    {
                        string       Check;
                        FileStream   fs7 = new FileStream(TB_Phone_Reg.Text + "_profile.txt", FileMode.Open, FileAccess.Read);
                        StreamReader sr7 = new StreamReader(fs7);
                        Check = sr7.ReadToEnd();
                        sr7.Close();
                        fs7.Close();
                        MessageBoxButtons c       = MessageBoxButtons.YesNo;
                        DialogResult      result3 = MessageBox.Show("There is already an registered account with this number. Signing up may rewrite the account details. Proceed to register your Account ?", "Information Center", c, MessageBoxIcon.Information);
                        if (result3 == DialogResult.Yes)
                        {
                            Yass = MessageBox.Show("Creating account successfully !", "Information Center", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            if (Yass == DialogResult.OK)
                            {
                                File.WriteAllText(TB_Phone_Reg.Text + "_profile.txt", String.Empty);
                                File.WriteAllText(TB_Phone_Reg.Text + "_cash.txt", String.Empty);
                                File.WriteAllText(TB_Phone_Reg.Text + "_booking.txt", String.Empty);
                                File.WriteAllText(TB_Phone_Reg.Text + "_topup.txt", String.Empty);
                                File.WriteAllText(TB_Phone_Reg.Text + "_counter.txt", String.Empty);
                                File.WriteAllText(TB_Phone_Reg.Text + "_checkHistory.txt", String.Empty);
                                File.WriteAllText(TB_Phone_Reg.Text + "_checkTopup.txt", String.Empty);
                                File.WriteAllText(TB_Phone_Reg.Text + "_counterTopup.txt", String.Empty);

                                FileStream   fs = new FileStream(TB_Phone_Reg.Text + "_profile.txt", FileMode.Append, FileAccess.Write);
                                StreamWriter sw = new StreamWriter(fs);
                                sw.WriteLine(TB_Nama_Reg.Text);
                                sw.WriteLine(CB_Identity_Reg.Items[CB_Identity_Reg.SelectedIndex].ToString());
                                sw.WriteLine(TB_Identitiy_Reg.Text);
                                sw.WriteLine(TB_Phone_Reg.Text);
                                sw.WriteLine(CB_DD_Reg.Items[CB_DD_Reg.SelectedIndex].ToString());
                                sw.WriteLine(CB_MM_Reg.Items[CB_MM_Reg.SelectedIndex].ToString());
                                sw.WriteLine(CB_YY_Reg.Items[CB_YY_Reg.SelectedIndex].ToString());
                                sw.WriteLine(CB_Province_Reg.Items[CB_Province_Reg.SelectedIndex].ToString());
                                sw.WriteLine(TB_Password_Reg.Text);
                                sw.Flush();
                                sw.Close();
                                fs.Close();

                                FileStream   fs23 = new FileStream(TB_Phone_Reg.Text + "_cash.txt", FileMode.Append, FileAccess.Write);
                                StreamWriter sw23 = new StreamWriter(fs23);
                                sw23.WriteLine("0");
                                sw23.Flush();
                                sw23.Close();
                                fs23.Close();

                                FileStream   fs6 = new FileStream(TB_Phone_Reg.Text + "_counter.txt", FileMode.Append, FileAccess.Write);
                                StreamWriter sr6 = new StreamWriter(fs6);
                                sr6.WriteLine("0");
                                sr6.Flush();
                                sr6.Close();
                                fs6.Close();

                                FileStream   fs9 = new FileStream(TB_Phone_Reg.Text + "_booking.txt", FileMode.Append, FileAccess.Write);
                                StreamWriter sr9 = new StreamWriter(fs9);
                                sr9.WriteLine("0");
                                sr9.Flush();
                                sr9.Close();
                                fs9.Close();

                                //FileStream f11 = new FileStream("global_counter.txt", FileMode.Append, FileAccess.Write);
                                //StreamWriter sr11 = new StreamWriter(f11);
                                //sr11.WriteLine("0");
                                //sr11.Flush();
                                //sr11.Close();
                                //f11.Close();

                                FileStream   fp1 = new FileStream(TB_Phone_Reg.Text + "_checkHistory.txt", FileMode.Append, FileAccess.Write);
                                StreamWriter sp1 = new StreamWriter(fp1);
                                sp1.WriteLine("0");
                                sp1.Flush();
                                sp1.Close();
                                fp1.Close();

                                FileStream   fp99 = new FileStream(TB_Phone_Reg.Text + "_checkTopup.txt", FileMode.Append, FileAccess.Write);
                                StreamWriter sp99 = new StreamWriter(fp99);
                                sp99.WriteLine("0");
                                sp99.Flush();
                                sp99.Close();
                                fp99.Close();

                                FileStream   fs88 = new FileStream(TB_Phone_Reg.Text + "_counterTopup.txt", FileMode.Append, FileAccess.Write);
                                StreamWriter sr88 = new StreamWriter(fs88);
                                sr88.WriteLine("0");
                                sr88.Flush();
                                sr88.Close();
                                fs88.Close();

                                Form1   f1 = new Form1(TB_Phone_Reg.Text.ToLower().Trim());
                                MCash   f2 = new MCash(a_, b_, TB_Phone_Reg.Text.ToLower().Trim());
                                History f3 = new History(TB_Phone_Reg.Text.ToLower().Trim());
                                f1.Show();
                                this.Hide();
                            }
                            if (result3 == DialogResult.No)
                            {
                            }
                        }
                    }
                    catch (FileNotFoundException ex)
                    {
                        Nahh = MessageBox.Show("Creating account successfully !", "Information Center", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        if (Nahh == DialogResult.OK)
                        {
                            //
                            FileStream   fs = new FileStream(TB_Phone_Reg.Text + "_profile.txt", FileMode.Append, FileAccess.Write);
                            StreamWriter sw = new StreamWriter(fs);
                            sw.WriteLine(TB_Nama_Reg.Text);
                            sw.WriteLine(CB_Identity_Reg.Items[CB_Identity_Reg.SelectedIndex].ToString());
                            sw.WriteLine(TB_Identitiy_Reg.Text);
                            sw.WriteLine(TB_Phone_Reg.Text);
                            sw.WriteLine(CB_DD_Reg.Items[CB_DD_Reg.SelectedIndex].ToString());
                            sw.WriteLine(CB_MM_Reg.Items[CB_MM_Reg.SelectedIndex].ToString());
                            sw.WriteLine(CB_YY_Reg.Items[CB_YY_Reg.SelectedIndex].ToString());
                            sw.WriteLine(CB_Province_Reg.Items[CB_Province_Reg.SelectedIndex].ToString());
                            sw.WriteLine(TB_Password_Reg.Text);
                            sw.Flush();
                            sw.Close();
                            fs.Close();

                            FileStream   fs2 = new FileStream(TB_Phone_Reg.Text + "_cash.txt", FileMode.Append, FileAccess.Write);
                            StreamWriter sw2 = new StreamWriter(fs2);
                            sw2.WriteLine("0");
                            sw2.Flush();
                            sw2.Close();
                            fs2.Close();

                            FileStream   fs6 = new FileStream(TB_Phone_Reg.Text + "_counter.txt", FileMode.Append, FileAccess.Write);
                            StreamWriter sr6 = new StreamWriter(fs6);
                            sr6.WriteLine("0");
                            sr6.Flush();
                            sr6.Close();
                            fs6.Close();

                            FileStream   fs9 = new FileStream(TB_Phone_Reg.Text + "_booking.txt", FileMode.Append, FileAccess.Write);
                            StreamWriter sr9 = new StreamWriter(fs9);
                            sr9.WriteLine("0");
                            sr9.Flush();
                            sr9.Close();
                            fs9.Close();

                            //FileStream fs11 = new FileStream("global_counter.txt", FileMode.Append, FileAccess.Write);
                            //StreamWriter sr11 = new StreamWriter(fs11);
                            //sr11.WriteLine("0");
                            //sr11.Flush();
                            //sr11.Close();
                            //fs11.Close();

                            FileStream   fp1 = new FileStream(TB_Phone_Reg.Text + "_checkHistory.txt", FileMode.Append, FileAccess.Write);
                            StreamWriter sp1 = new StreamWriter(fp1);
                            sp1.WriteLine("0");
                            sp1.Flush();
                            sp1.Close();
                            fp1.Close();

                            FileStream   fp99 = new FileStream(TB_Phone_Reg.Text + "_checkTopup.txt", FileMode.Append, FileAccess.Write);
                            StreamWriter sp99 = new StreamWriter(fp99);
                            sp99.WriteLine("0");
                            sp99.Flush();
                            sp99.Close();
                            fp99.Close();

                            FileStream   fs88 = new FileStream(TB_Phone_Reg.Text + "_counterTopup.txt", FileMode.Append, FileAccess.Write);
                            StreamWriter sr88 = new StreamWriter(fs88);
                            sr88.WriteLine("0");
                            sr88.Flush();
                            sr88.Close();
                            fs88.Close();

                            Form1   f11 = new Form1(TB_Phone_Reg.Text.ToLower().Trim());
                            MCash   f22 = new MCash(a_, b_, TB_Phone_Reg.Text.ToLower().Trim());
                            History f33 = new History(TB_Phone_Reg.Text.ToLower().Trim());
                            f11.Show();
                            this.Hide();
                        }
                    }
                }
            }
            else
            {
                passed_check = 0;
            }
        }