using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Data.Linq;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TaxiTelphoni
{
    public partial class frmRepCustomers : Form
    {
        public frmRepCustomers()
        {
            InitializeComponent();
        }
        private void UDF_Cmb_ShowCustomerByName()
        {
            LSC_TaxiTelfoniDataContext db = new LSC_TaxiTelfoniDataContext();
            var Query = from Row in db.Customers
                        select new
                        {
                            Row.CustomerID,
                            Row.CompanyName,
                        };
            Cmb_CustomerName.ValueMember = "CustomerID";
            Cmb_CustomerName.DisplayMember = "CompanyName";
            Cmb_CustomerName.DataSource = Query;
         }
        private void UDF_ShowCustomers()
        {
            LSC_TaxiTelfoniDataContext db = new LSC_TaxiTelfoniDataContext();
            var Query = from Row in db.Customers
                        select new
                        {
                            Row.CustomerID,
                            Row.CompanyName,
                            Row.DatOzviiat,
                            Row.MelliCode,
                            Row.PhoneNumber,
                            Row.FaxNumber,
                            Row.PostalCode,
                            Row.EmailAddress,
                            Row.PostalAddress,
                            Row.Notes
                        };
            reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
            reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent;
            reportViewer1.ZoomPercent = 25;

            CustomerBindingSource.DataSource = Query;
            reportViewer1.RefreshReport();
        }
        private void Btn_Show_Click(object sender, EventArgs e)
        {
            LSC_TaxiTelfoniDataContext db = new LSC_TaxiTelfoniDataContext();
            var Query = from Row in db.Customers
                        where Row.CustomerID == Cmb_CustomerName.SelectedValue.ToString()
                        select new
                        {
                            Row.CustomerID,
                            Row.CompanyName,
                            Row.DatOzviiat,
                            Row.MelliCode,
                            Row.PhoneNumber,
                            Row.FaxNumber,
                            Row.PostalCode,
                            Row.EmailAddress,
                            Row.PostalAddress,
                            Row.Notes
                        };

            reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
            reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent;
            reportViewer1.ZoomPercent = 25;

            CustomerBindingSource.DataSource = Query;
            reportViewer1.RefreshReport();
        }
        private void frmRepCustomers_Load(object sender, EventArgs e)
        {
            UDF_Cmb_ShowCustomerByName();
            UDF_ShowCustomers();
        }
    }
}
