using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Tutor03
{
    /// <summary>
    /// Summary description for Form1.
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
        private C1.Win.C1TrueDBGrid.C1TrueDBGrid c1TrueDBGrid1;
        private C1.Win.C1TrueDBGrid.C1TrueDBGrid c1TrueDBGrid2;
        private System.Windows.Forms.Button button1;
        private C1.Data.C1DataSet c1DataSet1;
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;

        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
            this.c1TrueDBGrid1 = new C1.Win.C1TrueDBGrid.C1TrueDBGrid();
            this.c1DataSet1 = new C1.Data.C1DataSet();
            this.c1TrueDBGrid2 = new C1.Win.C1TrueDBGrid.C1TrueDBGrid();
            this.button1 = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.c1TrueDBGrid1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.c1DataSet1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.c1TrueDBGrid2)).BeginInit();
            this.SuspendLayout();
            // 
            // c1TrueDBGrid1
            // 
            this.c1TrueDBGrid1.AllowFilter = true;
            this.c1TrueDBGrid1.AllowRowSizing = C1.Win.C1TrueDBGrid.RowSizingEnum.AllRows;
            this.c1TrueDBGrid1.AllowSort = true;
            this.c1TrueDBGrid1.CaptionHeight = 17;
            this.c1TrueDBGrid1.CollapseColor = System.Drawing.Color.Black;
            this.c1TrueDBGrid1.DataChanged = false;
            this.c1TrueDBGrid1.DataMember = "CustOrdersDetails";
            this.c1TrueDBGrid1.DataSource = this.c1DataSet1;
            this.c1TrueDBGrid1.BackColor = System.Drawing.Color.Empty;
            this.c1TrueDBGrid1.ExpandColor = System.Drawing.Color.Black;
            this.c1TrueDBGrid1.Images.Add(((System.Drawing.Bitmap)(resources.GetObject("resource.Images"))));
            this.c1TrueDBGrid1.Location = new System.Drawing.Point(8, 8);
            this.c1TrueDBGrid1.MarqueeStyle = C1.Win.C1TrueDBGrid.MarqueeEnum.DottedCellBorder;
            this.c1TrueDBGrid1.Name = "c1TrueDBGrid1";
            this.c1TrueDBGrid1.PreviewInfo.Location = new System.Drawing.Point(0, 0);
            this.c1TrueDBGrid1.PreviewInfo.Size = new System.Drawing.Size(0, 0);
            this.c1TrueDBGrid1.PreviewInfo.ZoomFactor = 75;
            this.c1TrueDBGrid1.RecordSelectorWidth = 16;
            this.c1TrueDBGrid1.RowHeight = 15;
            this.c1TrueDBGrid1.RowSubDividerColor = System.Drawing.Color.DarkGray;
            this.c1TrueDBGrid1.ScrollTips = false;
            this.c1TrueDBGrid1.Size = new System.Drawing.Size(840, 208);
            this.c1TrueDBGrid1.TabIndex = 0;
            this.c1TrueDBGrid1.Text = "c1TrueDBGrid1";
            this.c1TrueDBGrid1.PropBag = ((string)(resources.GetObject("c1TrueDBGrid1.PropBag")));
            // 
            // c1DataSet1
            // 
            this.c1DataSet1.BindingContextCtrl = null;
            this.c1DataSet1.DataLibrary = "Northwind";
            this.c1DataSet1.DataLibraryUrl = "tcp://localhost:8000/ThreeTierServer.soap";
            this.c1DataSet1.DataSetDef = "ProductsOrders";
            this.c1DataSet1.Locale = new System.Globalization.CultureInfo("en-US");
            this.c1DataSet1.SchemaClassName = "Northwind.DataClass";
            this.c1DataSet1.SchemaDef = null;
            this.c1DataSet1.SuppressNotifications = false;
            this.c1DataSet1.BeforeFill += new C1.Data.FillEventHandler(this.c1DataSet1_BeforeFill);
            // 
            // c1TrueDBGrid2
            // 
            this.c1TrueDBGrid2.AllowFilter = true;
            this.c1TrueDBGrid2.AllowRowSizing = C1.Win.C1TrueDBGrid.RowSizingEnum.AllRows;
            this.c1TrueDBGrid2.AllowSort = true;
            this.c1TrueDBGrid2.CaptionHeight = 17;
            this.c1TrueDBGrid2.CollapseColor = System.Drawing.Color.Black;
            this.c1TrueDBGrid2.DataChanged = false;
            this.c1TrueDBGrid2.DataMember = "ProductsOrderDetailsCust";
            this.c1TrueDBGrid2.DataSource = this.c1DataSet1;
            this.c1TrueDBGrid2.BackColor = System.Drawing.Color.Empty;
            this.c1TrueDBGrid2.ExpandColor = System.Drawing.Color.Black;
            this.c1TrueDBGrid2.Images.Add(((System.Drawing.Bitmap)(resources.GetObject("resource.Images1"))));
            this.c1TrueDBGrid2.Location = new System.Drawing.Point(8, 224);
            this.c1TrueDBGrid2.MarqueeStyle = C1.Win.C1TrueDBGrid.MarqueeEnum.DottedCellBorder;
            this.c1TrueDBGrid2.Name = "c1TrueDBGrid2";
            this.c1TrueDBGrid2.PreviewInfo.Location = new System.Drawing.Point(0, 0);
            this.c1TrueDBGrid2.PreviewInfo.Size = new System.Drawing.Size(0, 0);
            this.c1TrueDBGrid2.PreviewInfo.ZoomFactor = 75;
            this.c1TrueDBGrid2.RecordSelectorWidth = 16;
            this.c1TrueDBGrid2.RowHeight = 15;
            this.c1TrueDBGrid2.RowSubDividerColor = System.Drawing.Color.DarkGray;
            this.c1TrueDBGrid2.ScrollTips = false;
            this.c1TrueDBGrid2.Size = new System.Drawing.Size(840, 184);
            this.c1TrueDBGrid2.TabIndex = 1;
            this.c1TrueDBGrid2.Text = "c1TrueDBGrid2";
            this.c1TrueDBGrid2.PropBag = ((string)(resources.GetObject("c1TrueDBGrid2.PropBag")));
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(360, 424);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(136, 32);
            this.button1.TabIndex = 2;
            this.button1.Text = "Commit changes";
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // Form1
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(856, 477);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.button1,
                                                                          this.c1TrueDBGrid2,
                                                                          this.c1TrueDBGrid1});
            this.Name = "Form1";
            this.Text = "Form1";
            ((System.ComponentModel.ISupportInitialize)(this.c1TrueDBGrid1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.c1DataSet1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.c1TrueDBGrid2)).EndInit();
            this.ResumeLayout(false);

        }
        #endregion

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }

        private void button1_Click(object sender, System.EventArgs e)
        {
            c1DataSet1.Update();
        }

        private void c1DataSet1_BeforeFill(object sender, C1.Data.FillEventArgs e)
        {
            C1.Data.SchemaObjects.DataSetDef dataSetDef = e.DataSet.Schema.DataSetDefs["ProductsOrders"];
            e.Filter.Add(new C1.Data.FilterCondition(dataSetDef.TableViews["ProductsOrderDetailsCust"], "[CategoryID] = 1"));
            e.Filter.Add(new C1.Data.FilterCondition(dataSetDef.TableViews["CustOrdersDetails"], "[CategoryID] = 1"));
        }
    }
}
