예제 #1
0
        public void UpdateManager(int id, string name, string pass, string email, string contNo, int sal, ManagerList MO)
        {
            MydbDataContext cntx = new MydbDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Oyan Computer\Desktop\Project\Project\Forms\Mydb.mdf;Integrated Security=True");
            var             str  = from a in cntx.Managers
                                   where a.Id == id
                                   select a;
            Manager M = str.First();

            M.Id        = id;
            M.UserName  = name;
            M.Password  = pass;
            M.Email     = email;
            M.ContactNo = contNo;
            //  M.Salary = sal;
            M.Salary = sal;

            cntx.SubmitChanges();

            name   = M.UserName;
            pass   = M.Password;
            email  = M.Email;
            contNo = M.ContactNo;
            sal    = Convert.ToInt32(M.Salary);

            cntx.SubmitChanges();
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Flight F = new Flight();

            F.Flight_Name    = textBox1.Text;
            F.Departure_Time = textBox2.Text;
            F.Departure_Date = dateTimePicker1.Value.ToShortDateString().ToString();
            F.From           = textBox4.Text;
            F.To             = textBox5.Text;
            F.FlighCost      = textBox6.Text.ToString();
            F.TotalSeatLeft  = int.Parse(textBox3.Text);



            cnt.Flights.InsertOnSubmit(F);

            cnt.SubmitChanges();
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";
            textBox6.Text = "";
            textBox7.Text = "";

            FLGetData();
        }
예제 #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            /* AdminOperation a = new AdminOperation();
             * a.SearchMan(Convert.ToInt32(textBox1.Text), this);
             * // MessageBox.Show();*/


            var str = from a in cnt.Managers

                      where a.Id == int.Parse(textBox1.Text)
                      select a;

            Manager M = str.First();

            if (M != null)
            {
                textBox2.Text = M.UserName;
                textBox3.Text = M.Password;
                textBox4.Text = M.Email;
                textBox5.Text = M.ContactNo;
                textBox6.Text = M.Salary.ToString();
                cnt.SubmitChanges();
            }
            else
            {
                MessageBox.Show("Data not found");
            }
            //     Person p = str.Where(obj=>obj.Id==int.Parse(textBox1.Text)).First();



            //  dataGridView1.DataSource = str.Where(obj=>obj.Id==int.Parse(textBox1.Text));
            dataGridView1.DataSource = str;
        }
예제 #4
0
        private void Orderbutton_Click(object sender, EventArgs e)
        {
            if (Lfrom.Equals(Lto)) {
                MessageBox.Show("From and to can not be same");
            }

            int s =int.Parse( SeatBox.Text);
            
            

            var str = from a in cnt.Flights

                      where a.Flight_Name == fl
                      select a;
            Flight F = str.First();

            string fo=F.TotalSeatLeft.ToString();

            string DD = F.Departure_Date.ToString();
            string TT = F.Departure_Time.ToString();

            int t =int.Parse( F.FlighCost.ToString());
            
            Booking_History B = new Booking_History();
            if (F != null)
            {

                B.CustomerName = ps;
                B.FlightName = fl;
                B.No_Of_Orders = s;
                B.Cost_Per_Order_ = t;
                B.Total_Cost = s*t;


                F.TotalSeatLeft = (int.Parse(fo)) - s;
                if (F.TotalSeatLeft < 0) {
                    MessageBox.Show("Invalid input");
                
                }
                
             //   B.De
                {     cnt.Booking_Histories.InsertOnSubmit(B);
                cnt.SubmitChanges();

                fo = F.TotalSeatLeft.ToString();
                cnt.SubmitChanges();

                MessageBox.Show("Successfully inserted");
            }
            else
            {
                MessageBox.Show("Data not found");

            }
            manage_grid2();
         //   dataGridView2.DataSource = str;
        }
예제 #5
0
        private void button3_Click(object sender, EventArgs e)
        {
            string Birth = dateTimePicker1.Value.ToShortDateString();
            var    str   = from a in cnt.Persons

                           where a.UserName == ps
                           select a;

            Person p = new Person();

            if (p != null)
            {
                p.FirstName = textBox1.Text;

                p.MiddleName = textBox2.Text;
                p.LastName   = textBox3.Text;
                p.UserName   = textBox4.Text;
                p.Email      = textBox5.Text;
                p.Gender     = textBox6.Text;

                p.Address   = textBox7.Text;
                p.BirthDate = Birth;

                MessageBox.Show("Data updated");

                cnt.SubmitChanges();
            }
            else
            {
                MessageBox.Show("No data found");
            }
        }
예제 #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            MydbDataContext cntx = new MydbDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Oyan Computer\Desktop\Project\Project\Forms\Mydb.mdf;Integrated Security=True");
            var             str  = from a in cntx.Booking_Histories

                                   where a.No == int.Parse(textBox1.Text)
                                   select a;
            // Person p = new Person();
            Booking_History B = str.First();

            if (B != null)
            {
                cntx.Booking_Histories.DeleteOnSubmit(B);
                MessageBox.Show("Data Deleted");
                cntx.SubmitChanges();
            }
            else
            {
                MessageBox.Show("Data not found");
            }



            BookingGetData(ps);
        }
예제 #7
0
        public void SignUp(string fName, string mName, string lName, string uName, string pass, string aPass, string email, string gender, string address, string dOB, SignUp a)
        {
            MydbDataContext cntx = new MydbDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\USER\Desktop\Project\Project\Forms\Mydb.mdf;Integrated Security=True");
            Person          p    = new Person();
            People          po   = new People();

            cntx.Persons.InsertOnSubmit(p);
            cntx.Peoples.InsertOnSubmit(po);

            p.FirstName  = fName;
            p.MiddleName = mName;
            p.LastName   = lName;
            p.UserName   = uName;
            p.Password   = pass;
            p.Email      = email;

            p.Gender  = gender;
            p.Address = address;

            p.BirthDate = dOB;

            po.UserName = uName;
            po.password = pass;
            po.UserType = "Customer";
            cntx.SubmitChanges();


            //   cntx.SubmitChanges();



            cntx.Dispose();
            new SignUp().ErrorMassage("successfully signed up");
        }
예제 #8
0
        public void NewManager(string name, string pass, string email, string contNo, int sal, ManagerList M)
        {
            MydbDataContext cntx = new MydbDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\USER\Desktop\Project\Project\Forms\Mydb.mdf;Integrated Security=True");
            Manager         Man  = new Manager();
            People          P    = new People();


            cntx.Managers.InsertOnSubmit(Man);
            cntx.Peoples.InsertOnSubmit(P);

            Man.UserName  = name;
            Man.Password  = pass;
            Man.Email     = email;
            Man.ContactNo = contNo;
            Man.Salary    = sal;

            P.UserName = name;
            P.password = pass;
            P.UserType = "Manager";



            cntx.SubmitChanges();


            new ManagerList().ErrorMassage("Successfully added");

            cntx.Dispose();
        }
예제 #9
0
        /*  public void SearchManager(int ab,string name, string pass, string email, string contNo, int sal,AdminOperation A, ManagerList MO) {
         *
         *
         * /*    foreach (var x in list)
         *    {
         *        productName = x.Item_name;
         *        quantity = x.Quantity.ToString();
         *        categoryName = x.Category.Category_name;
         *        price = x.Unit_price.ToString();
         *        details = x.Item_description;
         *        sellerId = x.Seller_id.ToString();
         *        sellerName = x.Customer.Customer_name;
         *        phn = x.Customer.Phone_number;
         *        email = x.Customer.Email;
         *        country = x.Customer.Addresses.Country.Country_name;
         *
         *    }
         *
         *    //Manager mo = str.First();
         *    foreach (var a in str)
         *    {
         *      //  ab = a.Id;
         *        name = a.UserName;
         *        pass = a.Password;
         *        email = a.Email;
         *        contNo = a.ContactNo;
         *        sal = a.Salary;
         *
         *    }
         *
         *
         *
         *    cnt.SubmitChanges();
         *
         * }*/


        public void DeleteManager(int id, string name, string pass, string email, string contNo, float sal, ManagerList MO)
        {
            MydbDataContext cntx = new MydbDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Oyan Computer\Desktop\Project\Project\Forms\Mydb.mdf;Integrated Security=True");
            var             str  = from a in cntx.Managers
                                   where a.Id == id
                                   select a;
            Manager M = str.First();

            cntx.Managers.DeleteOnSubmit(M);
            cntx.SubmitChanges();
        }
예제 #10
0
        private void button4_Click(object sender, EventArgs e)
        {
            /*   string gen;
             * if (radioButton1.Checked) { gen = "Male"; }
             * else { gen = "Female"; }
             */
            string Birth = Date.Value.ToShortDateString();

            var str = from a in cnt.Persons

                      where a.Id == int.Parse(textBox9.Text)
                      select a;

            Person p = new Person();


            if (p != null)
            {
                textBox1.Text = p.FirstName;

                textBox2.Text = p.MiddleName;
                textBox3.Text = p.LastName;
                textBox4.Text = p.UserName;
                textBox5.Text = p.Password;
                textBox6.Text = p.Email;
                //gen = p.Gender;
                textBox7.Text = p.Address;
                //Birth = p.BirthDate.ToString();

                cnt.Persons.InsertOnSubmit(p);

                cnt.SubmitChanges();
            }
            else
            {
                MessageBox.Show("Data not found");
            }
        }
예제 #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            Employee E = new Employee();

            E.Name        = textBox1.Text;
            E.Email       = textBox3.Text;
            E.Role        = textBox4.Text;
            E.Salary      = float.Parse(textBox5.Text);
            E.WorkingHour = int.Parse(textBox6.Text);
            E.OffDay      = textBox7.Text;

            cnt.Employees.InsertOnSubmit(E);

            cnt.SubmitChanges();
            textBox1.Text = "";

            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";
            textBox6.Text = "";
            textBox7.Text = "";
            textBox8.Text = "";
            EmpGetData();
        }
예제 #12
0
        public void DeleteFlight(int Fno, string flight, string dtime, string ddate, string route, FlightList F)
        {
            MydbDataContext cntx = new MydbDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Oyan Computer\Desktop\Project\Project\Forms\Mydb.mdf;Integrated Security=True");
            var             str  = from a in cntx.Flights
                                   where a.Flight_No == Fno
                                   select a;


            Flight fl = str.First();

            cntx.Flights.DeleteOnSubmit(fl);
            cntx.SubmitChanges();

            cntx.Dispose();
        }
예제 #13
0
        private void button4_Click(object sender, EventArgs e)
        {
            //   MydbDataContext cnt = new MydbDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\USER\Desktop\Project\Project\Forms\Mydb.mdf;Integrated Security=True");
            // MydbDataContext cnt = new MydbDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Oyan Computer\Desktop\Project\Project\Forms\Mydb.mdf;Integrated Security=True");
            var str = from a in cntx.Booking_Histories

                      where a.No == int.Parse(textBox1.Text)
                      select a;

            Booking_History B = str.First();

            if (B != null)
            {
                textBox2.Text = B.CustomerName;
                textBox3.Text = B.FlightName;
                textBox4.Text = B.No_Of_Orders.ToString();
                textBox5.Text = B.Cost_Per_Order_.ToString();
                textBox6.Text = B.Total_Cost.ToString();


                cntx.SubmitChanges();
            }
            else
            {
                MessageBox.Show("Data not found");
            }
            //     Person p = str.Where(obj=>obj.Id==int.Parse(textBox1.Text)).First();



            //  dataGridView1.DataSource = str.Where(obj=>obj.Id==int.Parse(textBox1.Text));
            dataGridView1.DataSource = str;
            textBox1.Text            = "";
            textBox2.Text            = "";
            textBox3.Text            = "";
            textBox4.Text            = "";
            textBox5.Text            = "";
            textBox6.Text            = "";
        }
예제 #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            MydbDataContext cntx = new MydbDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Oyan Computer\Desktop\Project\Project\Forms\Mydb.mdf;Integrated Security=True");



            var str = from a in cntx.Flights

                      where a.Flight_Name == textBox2.Text
                      select a;
            Flight F = str.First();

            var st = from b in cntx.Persons

                     where b.UserName == textBox3.Text
                     select b;
            Person          P = st.First();
            Booking_History B = new Booking_History();

            if (F != null && P != null)
            {
                B.CustomerName    = textBox2.Text;
                B.FlightName      = textBox3.Text;
                B.No_Of_Orders    = int.Parse(textBox4.Text);
                B.Cost_Per_Order_ = int.Parse(textBox5.Text);
                B.Total_Cost      = int.Parse(textBox6.Text);
                cntx.Booking_Histories.InsertOnSubmit(B);
                cntx.SubmitChanges();

                MessageBox.Show("Successfully inserted");
            }
            else
            {
                MessageBox.Show("Data not found");
            }
            BookingGetData(ps);
        }