Ejemplo n.º 1
0
        private void CustomerLookup_Load(object sender, EventArgs e)
        {
            DafestyEntities context = new DafestyEntities();

            CustGridView.DataSource = context.Customers.
                                      Select(x => new
            {
                x.CustomerID,
                x.CustomerName,
                x.MemberCategory
            }).ToList();
        }
Ejemplo n.º 2
0
        private void VideoLookup_Load(object sender, EventArgs e)
        {
            DafestyEntities context = new DafestyEntities();

            gridView_Video.DataSource = context.Movies.
                                        Select(x => new
            {
                x.VideoCode,
                x.MovieTitle,
                x.MovieType
            }).ToList();
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            DafestyEntities context = new DafestyEntities();
            IssueTran       i       = context.IssueTrans.
                                      Where(x => x.TransactionID.ToString() == tb_transactionID.Text).First();

            i.RentalStatus     = "in";
            i.DateActualReturn = DTP_DateReturn.Value;

            Movie m = context.Movies.
                      Where(x => x.VideoCode == i.VideoCode).First();

            m.NumberRented--;

            context.SaveChanges();
        }
Ejemplo n.º 4
0
        private void VideoCodeTextBox_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyData == Keys.Enter)
                {
                    DafestyEntities context = new DafestyEntities();

                    Movie m = context.Movies.
                              Where(x => x.VideoCode.ToString() == VideoCodeTextBox.Text).First();

                    MovieTitleTextBox.Text = m.MovieTitle;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Not Found");
                MovieTitleTextBox.Text = "";
            }
        }
Ejemplo n.º 5
0
        private void CIDTextBox_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyData == Keys.Enter)
                {
                    DafestyEntities context = new DafestyEntities();

                    Customer c = context.Customers.
                                 Where(x => x.CustomerID == CIDTextBox.Text).First();

                    CustNameTextBox.Text = c.CustomerName;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Not Found");
                CustNameTextBox.Text = "";
            }
        }
Ejemplo n.º 6
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            DafestyEntities context = new DafestyEntities();

            IssueTran i = new IssueTran();

            i.CustomerID   = CIDTextBox.Text;
            i.VideoCode    = Convert.ToInt16(VideoCodeTextBox.Text);
            i.DateIssue    = IssueDateDTP.Value;
            i.DateDue      = DueDateDTP.Value;
            i.RentalStatus = "out";
            i.Remarks      = RemarksTextBox.Text;

            context.IssueTrans.Add(i);

            Movie m = context.Movies.
                      Where(x => x.VideoCode.ToString() == VideoCodeTextBox.Text).First();

            m.NumberRented++;

            context.SaveChanges();
        }
Ejemplo n.º 7
0
        private void VideoLookupButton_Click(object sender, EventArgs e)
        {
            using (VideoLookup videoForm = new VideoLookup())
            {
                if (videoForm.ShowDialog() == DialogResult.OK)
                {
                    VideoCodeTextBox.Text = videoForm.TheValue;

                    try
                    {
                        DafestyEntities context = new DafestyEntities();

                        Movie m = context.Movies.
                                  Where(x => x.VideoCode.ToString() == VideoCodeTextBox.Text).First();

                        MovieTitleTextBox.Text = m.MovieTitle;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Not Found");
                    }
                }
            }
        }
Ejemplo n.º 8
0
        private void CustLookupButton_Click(object sender, EventArgs e)
        {
            using (CustomerLookup custForm = new CustomerLookup())
            {
                if (custForm.ShowDialog() == DialogResult.OK)
                {
                    CIDTextBox.Text = custForm.TheValue;

                    try
                    {
                        DafestyEntities context = new DafestyEntities();

                        Customer c = context.Customers.
                                     Where(x => x.CustomerID == CIDTextBox.Text).First();

                        CustNameTextBox.Text = c.CustomerName;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Not Found");
                    }
                }
            }
        }