Example #1
0
        public void  sendbus_details(string path, busdetials bobj)
        {
            buslistobj.buslist.Add(bobj);
            DLL obj = new DLL();

            obj.Bus_Serialize(path, buslistobj);
        }
Example #2
0
        public bsl Bus_Deserialize(busdetials Obj, string filePath)
        {
            bsl           result;
            XmlSerializer serializer = new XmlSerializer(typeof(bsl));

            using (FileStream fileStream = new FileStream(filePath, FileMode.Open))
            {
                result = (bsl)serializer.Deserialize(fileStream);
            }


            return(result);
        }
        private void Searchbtn_Click(object sender, EventArgs e)
        {
            string chfrom = fromInput.Text;
            string chto   = ToInput.Text;

            if (fromInput.SelectedIndex < 0 || ToInput.SelectedIndex < 0)
            {
                MessageBox.Show("Field Can't Be Empty");
                return;
            }


            bookuser bookobj = new bookuser();
            tickets  tobj    = bookobj.get_details(Resources.Resource1.FilePathTickets, bookobj);



            dataGridView1.Visible = true;

            var dateAndTime = Date.Value;
            var date        = dateAndTime.Date;

            senddate = Convert.ToString(date.ToString("dd/MM/yyyy"));



            bookuser bobj = new bookuser();
            tickets  obj  = bobj.get_details(Resources.Resource1.FilePathTickets, bobj);

            DataTable dt = new DataTable();

            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("Departure", typeof(string));
            dt.Columns.Add("Fare", typeof(int));
            dt.Columns.Add("Seat", typeof(int));


            busdetials myobj   = new busdetials();
            bsl        tempobj = myobj.getbus_detials(Resources.Resource1.FilePathBus, myobj);

            for (var i = 0; i < tempobj.buslist.Count; i++)
            {
                if (tempobj.buslist[i].from == fromInput.Text && tempobj.buslist[i].to == ToInput.Text)
                {
                    int tempseat = 0;
                    if (obj != null)
                    {
                        for (int j = 0; j < obj.contactlist.Count; j++)
                        {
                            if (obj.contactlist[j].BusName == tempobj.buslist[i].busname && obj.contactlist[j].From == tempobj.buslist[i].from && obj.contactlist[j].to == tempobj.buslist[i].to && obj.contactlist[j].Date == senddate)
                            {
                                tempseat = obj.contactlist[j].seat;
                            }
                        }
                    }
                    DataRow dr = dt.NewRow();
                    dr["Name"]      = tempobj.buslist[i].busname;
                    dr["Departure"] = tempobj.buslist[i].departure;
                    dr["Fare"]      = tempobj.buslist[i].fare;
                    dr["Seat"]      = tempobj.buslist[i].seatcount - tempseat;
                    dt.Rows.Add(dr);
                }
            }



            dataGridView1.DataSource = dt;

            col.Visible = true;
            dataGridView1.Columns["Name"].DisplayIndex      = 0;
            dataGridView1.Columns["Departure"].DisplayIndex = 1;
            dataGridView1.Columns["Fare"].DisplayIndex      = 2;
            dataGridView1.Columns["Seat"].DisplayIndex      = 3;
            dataGridView1.Columns["Book"].DisplayIndex      = 4;
        }
Example #4
0
        public bsl getbus_detials(string path, busdetials Obj)
        {
            DLL obj = new DLL();

            return(obj.Bus_Deserialize(Obj, path));
        }