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

namespace SQLbased
{
    /// <summary>
    /// Summary description for Form5.
    /// </summary>
    public class Form5 : System.Windows.Forms.Form
    {
        private System.Windows.Forms.Label label1;
        private C1.Win.C1TrueDBGrid.C1TrueDBGrid c1TrueDBGrid1;
        private System.Windows.Forms.Button btnClose;
        private System.Windows.Forms.Button btnCommit;
        private C1.Data.C1DataSet dataSet1;
        private System.Windows.Forms.Button btnRefresh;
        private System.Windows.Forms.Button btnShowSQL;
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;

        public Form5()
        {
            //
            // 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(Form5));
            this.label1 = new System.Windows.Forms.Label();
            this.c1TrueDBGrid1 = new C1.Win.C1TrueDBGrid.C1TrueDBGrid();
            this.dataSet1 = new C1.Data.C1DataSet();
            this.btnClose = new System.Windows.Forms.Button();
            this.btnCommit = new System.Windows.Forms.Button();
            this.btnRefresh = new System.Windows.Forms.Button();
            this.btnShowSQL = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.c1TrueDBGrid1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.label1.Location = new System.Drawing.Point(12, 12);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(212, 20);
            this.label1.TabIndex = 0;
            this.label1.Text = "Modifiable suppliers list:";
            // 
            // c1TrueDBGrid1
            // 
            this.c1TrueDBGrid1.AllowAddNew = true;
            this.c1TrueDBGrid1.AllowDelete = true;
            this.c1TrueDBGrid1.AllowFilter = true;
            this.c1TrueDBGrid1.AllowRowSizing = C1.Win.C1TrueDBGrid.RowSizingEnum.AllRows;
            this.c1TrueDBGrid1.AllowSort = true;
            this.c1TrueDBGrid1.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                | System.Windows.Forms.AnchorStyles.Left)
                | System.Windows.Forms.AnchorStyles.Right);
            this.c1TrueDBGrid1.CaptionHeight = 17;
            this.c1TrueDBGrid1.CollapseColor = System.Drawing.Color.Black;
            this.c1TrueDBGrid1.DataChanged = false;
            this.c1TrueDBGrid1.DataMember = "SQLSuppliers";
            this.c1TrueDBGrid1.DataSource = this.dataSet1;
            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(12, 36);
            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(444, 248);
            this.c1TrueDBGrid1.TabIndex = 1;
            this.c1TrueDBGrid1.Text = "c1TrueDBGrid1";
            this.c1TrueDBGrid1.PropBag = ((string)(resources.GetObject("c1TrueDBGrid1.PropBag")));
            // 
            // dataSet1
            // 
            this.dataSet1.BindingContextCtrl = null;
            this.dataSet1.DataLibrary = "DataLibrary";
            this.dataSet1.DataLibraryUrl = "";
            this.dataSet1.DataSetDef = "DataSet5";
            this.dataSet1.Locale = new System.Globalization.CultureInfo("en-US");
            this.dataSet1.SchemaClassName = "DataLibrary.DataClass";
            this.dataSet1.SchemaDef = null;
            this.dataSet1.SuppressNotifications = false;
            // 
            // btnClose
            // 
            this.btnClose.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
            this.btnClose.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.btnClose.Location = new System.Drawing.Point(380, 296);
            this.btnClose.Name = "btnClose";
            this.btnClose.TabIndex = 5;
            this.btnClose.Text = "Close";
            // 
            // btnCommit
            // 
            this.btnCommit.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left);
            this.btnCommit.Location = new System.Drawing.Point(108, 296);
            this.btnCommit.Name = "btnCommit";
            this.btnCommit.Size = new System.Drawing.Size(108, 23);
            this.btnCommit.TabIndex = 3;
            this.btnCommit.Text = "Commit changes";
            this.btnCommit.Click += new System.EventHandler(this.btnCommit_Click);
            // 
            // btnRefresh
            // 
            this.btnRefresh.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left);
            this.btnRefresh.Location = new System.Drawing.Point(224, 296);
            this.btnRefresh.Name = "btnRefresh";
            this.btnRefresh.Size = new System.Drawing.Size(84, 23);
            this.btnRefresh.TabIndex = 4;
            this.btnRefresh.Text = "Refresh";
            this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
            // 
            // btnShowSQL
            // 
            this.btnShowSQL.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left);
            this.btnShowSQL.Location = new System.Drawing.Point(12, 296);
            this.btnShowSQL.Name = "btnShowSQL";
            this.btnShowSQL.Size = new System.Drawing.Size(88, 23);
            this.btnShowSQL.TabIndex = 2;
            this.btnShowSQL.Text = "Show SQL";
            this.btnShowSQL.Click += new System.EventHandler(this.btnShowSQL_Click);
            // 
            // Form5
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
            this.ClientSize = new System.Drawing.Size(468, 329);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.btnShowSQL,
                                                                          this.btnRefresh,
                                                                          this.btnCommit,
                                                                          this.btnClose,
                                                                          this.c1TrueDBGrid1,
                                                                          this.label1});
            this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.Name = "Form5";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Modifiable SQL-based Table";
            ((System.ComponentModel.ISupportInitialize)(this.c1TrueDBGrid1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit();
            this.ResumeLayout(false);

        }
        #endregion


        private void btnCommit_Click(object sender, System.EventArgs e)
        {
            dataSet1.Update();
        }

        private void btnRefresh_Click(object sender, System.EventArgs e)
        {
            dataSet1.Fill();
        }

        private void btnShowSQL_Click(object sender, System.EventArgs e)
        {
            MessageBox.Show(
                "SELECT CompanyName, ContactName, City, Country, Phone, SupplierID\n" +
                "FROM Suppliers\n" +
                "ORDER BY CompanyName",
                "Query Statement");
        }
    }
}
