예제 #1
0
        private void ParkingSlotButton_Click(object sender, EventArgs e)
        {
            PakingSlot c = new PakingSlot();

            if (!Window.Controls.Contains(c))
            {
                Window.Controls.Add(c);
                c.Dock = DockStyle.Fill;
                c.BringToFront();
            }
            else
            {
                c.BringToFront();
            }

            /* if (!Window.Controls.Contains(PakingSlot.Instance))
             * {
             *   Window.Controls.Add(PakingSlot.Instance);
             *   PakingSlot.Instance.Dock = DockStyle.Fill;
             *   PakingSlot.Instance.BringToFront();
             * }
             * else
             * {
             *   PakingSlot.Instance.BringToFront();
             * }*/
        }
예제 #2
0
        public AdminSystemView(string name, string id, string username, string email, string address, string password)
        {
            InitializeComponent();
            Scan();
            timer2.Start();
            //timer1.Start();

            NAME     = name;
            USERID   = id;
            USERNAME = username;
            EMAIL    = email;
            ADDRESS  = address;
            PASSWORD = password;



            PakingSlot p = new PakingSlot();



            textbox.Add(p.S1); textbox.Add(p.S2); textbox.Add(p.S3); textbox.Add(p.S4); textbox.Add(p.S5); textbox.Add(p.S6); textbox.Add(p.S7);
            textbox.Add(p.S8); textbox.Add(p.S9); textbox.Add(p.S10); textbox.Add(p.S11); textbox.Add(p.S12); textbox.Add(p.S13); textbox.Add(p.S14);
            textbox.Add(p.S15); textbox.Add(p.S16); textbox.Add(p.S17); textbox.Add(p.S18); textbox.Add(p.S19); textbox.Add(p.S20); textbox.Add(p.S21);
            textbox.Add(p.S22); textbox.Add(p.S23); textbox.Add(p.S24); textbox.Add(p.S25); textbox.Add(p.S26); textbox.Add(p.S27); textbox.Add(p.S28);
            textbox.Add(p.S29); textbox.Add(p.S30); textbox.Add(p.S31); textbox.Add(p.S32); textbox.Add(p.S33); textbox.Add(p.S34); textbox.Add(p.S35);
            textbox.Add(p.S36); textbox.Add(p.S37); textbox.Add(p.S38); textbox.Add(p.S39); textbox.Add(p.S40); textbox.Add(p.S41); textbox.Add(p.S42);
            textbox.Add(p.S43); textbox.Add(p.S44); textbox.Add(p.S45); textbox.Add(p.S46); textbox.Add(p.S47); textbox.Add(p.S48); textbox.Add(p.S49);
            textbox.Add(p.S50); textbox.Add(p.S51); textbox.Add(p.S52); textbox.Add(p.S53); textbox.Add(p.S54); textbox.Add(p.S55); textbox.Add(p.S56);
            textbox.Add(p.S57); textbox.Add(p.S58); textbox.Add(p.S59); textbox.Add(p.S60); textbox.Add(p.S61); textbox.Add(p.S62); textbox.Add(p.S63);
            textbox.Add(p.S64); textbox.Add(p.S65); textbox.Add(p.S66); textbox.Add(p.S67); textbox.Add(p.S68); textbox.Add(p.S69); textbox.Add(p.S70);
            textbox.Add(p.S71); textbox.Add(p.S72); textbox.Add(p.S73); textbox.Add(p.S74); textbox.Add(p.S75); textbox.Add(p.S76); textbox.Add(p.S77);
            textbox.Add(p.S78); textbox.Add(p.S79); textbox.Add(p.S80); textbox.Add(p.S81); textbox.Add(p.S82); textbox.Add(p.S83); textbox.Add(p.S84);
            textbox.Add(p.S85); textbox.Add(p.S86); textbox.Add(p.S87); textbox.Add(p.S88); textbox.Add(p.S89); textbox.Add(p.S90); textbox.Add(p.S91);
            textbox.Add(p.S92); textbox.Add(p.S93); textbox.Add(p.S94); textbox.Add(p.S95); textbox.Add(p.S96); textbox.Add(p.S97); textbox.Add(p.S98);
            textbox.Add(p.S99); textbox.Add(p.S100); textbox.Add(p.S101); textbox.Add(p.S102); textbox.Add(p.S103); textbox.Add(p.S104); textbox.Add(p.S105);
            textbox.Add(p.S106); textbox.Add(p.S107); textbox.Add(p.S108); textbox.Add(p.S109); textbox.Add(p.S110); textbox.Add(p.S111); textbox.Add(p.S112);
            textbox.Add(p.S113); textbox.Add(p.S114); textbox.Add(p.S115); textbox.Add(p.S116); textbox.Add(p.S117); textbox.Add(p.S118); textbox.Add(p.S119);
            textbox.Add(p.S120); textbox.Add(p.S121); textbox.Add(p.S122); textbox.Add(p.S123); textbox.Add(p.S124); textbox.Add(p.S125); textbox.Add(p.S126);
            textbox.Add(p.S127); textbox.Add(p.S128); textbox.Add(p.S129); textbox.Add(p.S130); textbox.Add(p.S131); textbox.Add(p.S132); textbox.Add(p.S133);
            textbox.Add(p.S134); textbox.Add(p.S135); textbox.Add(p.S136); textbox.Add(p.S137); textbox.Add(p.S138); textbox.Add(p.S139); textbox.Add(p.S140);
            textbox.Add(p.S141); textbox.Add(p.S142); textbox.Add(p.S143); textbox.Add(p.S144); textbox.Add(p.S145); textbox.Add(p.S146); textbox.Add(p.S147);
            textbox.Add(p.S148); textbox.Add(p.S149); textbox.Add(p.S150); textbox.Add(p.S151); textbox.Add(p.S152); textbox.Add(p.S153); textbox.Add(p.S154);
        }
예제 #3
0
        public AdminSystemView()
        {
            InitializeComponent();
            Scan();
            timer2.Start();
            //timer1.Start();



            PakingSlot p = new PakingSlot();



            textbox.Add(p.S1); textbox.Add(p.S2); textbox.Add(p.S3); textbox.Add(p.S4); textbox.Add(p.S5); textbox.Add(p.S6); textbox.Add(p.S7);
            textbox.Add(p.S8); textbox.Add(p.S9); textbox.Add(p.S10); textbox.Add(p.S11); textbox.Add(p.S12); textbox.Add(p.S13); textbox.Add(p.S14);
            textbox.Add(p.S15); textbox.Add(p.S16); textbox.Add(p.S17); textbox.Add(p.S18); textbox.Add(p.S19); textbox.Add(p.S20); textbox.Add(p.S21);
            textbox.Add(p.S22); textbox.Add(p.S23); textbox.Add(p.S24); textbox.Add(p.S25); textbox.Add(p.S26); textbox.Add(p.S27); textbox.Add(p.S28);
            textbox.Add(p.S29); textbox.Add(p.S30); textbox.Add(p.S31); textbox.Add(p.S32); textbox.Add(p.S33); textbox.Add(p.S34); textbox.Add(p.S35);
            textbox.Add(p.S36); textbox.Add(p.S37); textbox.Add(p.S38); textbox.Add(p.S39); textbox.Add(p.S40); textbox.Add(p.S41); textbox.Add(p.S42);
            textbox.Add(p.S43); textbox.Add(p.S44); textbox.Add(p.S45); textbox.Add(p.S46); textbox.Add(p.S47); textbox.Add(p.S48); textbox.Add(p.S49);
            textbox.Add(p.S50); textbox.Add(p.S51); textbox.Add(p.S52); textbox.Add(p.S53); textbox.Add(p.S54); textbox.Add(p.S55); textbox.Add(p.S56);
            textbox.Add(p.S57); textbox.Add(p.S58); textbox.Add(p.S59); textbox.Add(p.S60); textbox.Add(p.S61); textbox.Add(p.S62); textbox.Add(p.S63);
            textbox.Add(p.S64); textbox.Add(p.S65); textbox.Add(p.S66); textbox.Add(p.S67); textbox.Add(p.S68); textbox.Add(p.S69); textbox.Add(p.S70);
            textbox.Add(p.S71); textbox.Add(p.S72); textbox.Add(p.S73); textbox.Add(p.S74); textbox.Add(p.S75); textbox.Add(p.S76); textbox.Add(p.S77);
            textbox.Add(p.S78); textbox.Add(p.S79); textbox.Add(p.S80); textbox.Add(p.S81); textbox.Add(p.S82); textbox.Add(p.S83); textbox.Add(p.S84);
            textbox.Add(p.S85); textbox.Add(p.S86); textbox.Add(p.S87); textbox.Add(p.S88); textbox.Add(p.S89); textbox.Add(p.S90); textbox.Add(p.S91);
            textbox.Add(p.S92); textbox.Add(p.S93); textbox.Add(p.S94); textbox.Add(p.S95); textbox.Add(p.S96); textbox.Add(p.S97); textbox.Add(p.S98);
            textbox.Add(p.S99); textbox.Add(p.S100); textbox.Add(p.S101); textbox.Add(p.S102); textbox.Add(p.S103); textbox.Add(p.S104); textbox.Add(p.S105);
            textbox.Add(p.S106); textbox.Add(p.S107); textbox.Add(p.S108); textbox.Add(p.S109); textbox.Add(p.S110); textbox.Add(p.S111); textbox.Add(p.S112);
            textbox.Add(p.S113); textbox.Add(p.S114); textbox.Add(p.S115); textbox.Add(p.S116); textbox.Add(p.S117); textbox.Add(p.S118); textbox.Add(p.S119);
            textbox.Add(p.S120); textbox.Add(p.S121); textbox.Add(p.S122); textbox.Add(p.S123); textbox.Add(p.S124); textbox.Add(p.S125); textbox.Add(p.S126);
            textbox.Add(p.S127); textbox.Add(p.S128); textbox.Add(p.S129); textbox.Add(p.S130); textbox.Add(p.S131); textbox.Add(p.S132); textbox.Add(p.S133);
            textbox.Add(p.S134); textbox.Add(p.S135); textbox.Add(p.S136); textbox.Add(p.S137); textbox.Add(p.S138); textbox.Add(p.S139); textbox.Add(p.S140);
            textbox.Add(p.S141); textbox.Add(p.S142); textbox.Add(p.S143); textbox.Add(p.S144); textbox.Add(p.S145); textbox.Add(p.S146); textbox.Add(p.S147);
            textbox.Add(p.S148); textbox.Add(p.S149); textbox.Add(p.S150); textbox.Add(p.S151); textbox.Add(p.S152); textbox.Add(p.S153); textbox.Add(p.S154);
        }
예제 #4
0
        public void BookSlotByScanning(string id)
        {
            // MessageBox.Show("Welcome");
            UserIDFromScan.Text = "";
            string userid = id;

            //MessageBox.Show(userid);
            for (int i = 0; i < textbox.Count; i++)
            {
                if (textbox[i].BackColor == Color.FromArgb(128, 255, 128))
                {
                    slot = textbox[i].Text;
                    break;
                }
            }
            string    time       = Clock.Text;
            Boolean   flag       = false;
            Boolean   flag2      = false;
            ArrayList carlist    = new ArrayList();
            ArrayList carhistory = new ArrayList();

            String query1 = "select *  from carlist where ID = '" + userid + "';";

            Connection.Open();
            Command1 = new SqlCommand(query1, Connection);
            SqlDataReader result1 = Command1.ExecuteReader();

            try
            {
                while (result1.Read())
                {
                    string idd = result1["ID"].ToString();
                    flag = true;
                }
                Connection.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex);
            }



            String query2 = "select * from member where ID ='" + userid + "';";

            Connection.Open();
            Command2 = new SqlCommand(query2, Connection);
            SqlDataReader result2 = Command2.ExecuteReader();



            Boolean empty = string.IsNullOrEmpty(userid);

            if (empty)
            {
                var w = new Form()
                {
                    Size = new Size(0, 0)
                };
                Task.Delay(TimeSpan.FromSeconds(2))
                .ContinueWith((t) => w.Close(), TaskScheduler.FromCurrentSynchronizationContext());
                MessageBox.Show(w, "No such type User is available");
            }
            else
            {
                try
                {
                    while (result2.Read())
                    {
                        Name     = result2["Name"].ToString();
                        ID       = result2["ID"].ToString();
                        Email    = result2["EmailAddress"].ToString();
                        CarID    = result2["CarID"].ToString();
                        CarName  = result2["CarName"].ToString();
                        CarModel = result2["CarModel"].ToString();
                        CarColor = result2["CarColor"].ToString();

                        flag2 = true;

                        carlist.Add(slot);
                        carlist.Add(Name);
                        carlist.Add(ID);
                        carlist.Add(CarID);
                        carlist.Add(CarName);
                        carlist.Add(CarModel);
                        carlist.Add(CarColor);
                        carlist.Add(time);

                        carhistory.Add(slot);
                        carhistory.Add(Name);
                        carhistory.Add(ID);
                        carhistory.Add(Email);
                        carhistory.Add(CarID);
                        carhistory.Add(CarName);
                        carhistory.Add(CarModel);
                        carhistory.Add(CarColor);
                        carhistory.Add(time);

                        /*for (int i = 0; i < textbox.Count; i++)
                         * {
                         *  if (textbox[i].Text == slot)
                         *  {
                         *      textbox[i].BackColor = Color.FromArgb(231, 76, 6);
                         *      break;
                         *  }
                         * }*/
                    }
                    Connection.Close();
                }
                catch (Exception exx)
                {
                    MessageBox.Show("Adding Error" + exx);
                }

                if (flag)
                {
                    string query3 = "delete from carlist where ID = '" + userid + "'; ";

                    try
                    {
                        Connection.Open();
                        Command3 = new SqlCommand(query3, Connection);
                        Command3.ExecuteNonQuery();



                        //ParkingSlotButton.Select();

                        PakingSlot c = new PakingSlot();
                        if (!Window.Controls.Contains(c))
                        {
                            Window.Controls.Add(c);
                            c.Dock = DockStyle.Fill;
                            c.BringToFront();
                        }
                        else
                        {
                            //Window.Controls.Add(c);
                            //c.Dock = DockStyle.Fill;
                            c.BringToFront();
                        }
                        var w = new Form()
                        {
                            Size = new Size(0, 0)
                        };
                        Task.Delay(TimeSpan.FromSeconds(1))
                        .ContinueWith((t) => w.Close(), TaskScheduler.FromCurrentSynchronizationContext());
                        for (int i = 0; i < 153; i++)
                        {
                            if (textbox[i].Text == slot)
                            {
                                textbox[i].BackColor = Color.FromArgb(128, 255, 128);
                                break;
                            }
                        }
                        MessageBox.Show(w, "Vehicle Removed");
                        Connection.Close();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Removing Error: " + ex);
                        Console.WriteLine("Error: " + ex);
                    }
                }
                else if (!flag2)
                {
                    var w = new Form()
                    {
                        Size = new Size(0, 0)
                    };
                    Task.Delay(TimeSpan.FromSeconds(2))
                    .ContinueWith((t) => w.Close(), TaskScheduler.FromCurrentSynchronizationContext());
                    MessageBox.Show(w, "No such type member  available");
                    //Connection.Close();
                }
                else
                {
                    database.InsertCarIntoPark(carlist);

                    database.CarEnterHistory(carhistory);
                    for (int i = 0; i < textbox.Count; i++)
                    {
                        if (textbox[i].Text == slot)
                        {
                            textbox[i].BackColor = Color.FromArgb(231, 76, 6);
                            break;
                        }
                    }
                    var w = new Form()
                    {
                        Size = new Size(0, 0)
                    };
                    Task.Delay(TimeSpan.FromSeconds(1))
                    .ContinueWith((t) => w.Close(), TaskScheduler.FromCurrentSynchronizationContext());
                    MessageBox.Show(w, "Vehicle Added to slot");
                    ParkingDetailsWindow pw = new ParkingDetailsWindow(CarID, CarName, CarModel, CarColor, slot);
                    pw.Show();

                    PakingSlot c = new PakingSlot();


                    if (!Window.Controls.Contains(c))
                    {
                        Window.Controls.Add(c);
                        c.Dock = DockStyle.Fill;
                        c.BringToFront();
                    }
                    else
                    {
                        c.BringToFront();
                    }
                }
            }
        }