using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using JXC_MIS.MyClass;
using JXC_MIS.DataTier ;


namespace JXC_MIS.UserTier.ToolForm
{
	/// <summary>
	/// frmProcedureInf 的摘要说明。
	/// </summary>
	public class frmProcedureInf : System.Windows.Forms.Form
	{
		private ClsInitData InitData=new ClsInitData();
		private ClsDataBase newDb=new ClsDataBase();
		private ClsDataBaseAccess newADO=new ClsDataBaseAccess();
		private ClsQueryAttrib newQueryAttrib=new ClsQueryAttrib();

		private bool w_EidtFlag;
		private string w_keyId;

		private System.Windows.Forms.ListView lv_List;
		private System.Windows.Forms.ColumnHeader columnHeader5;
		private System.Windows.Forms.ColumnHeader columnHeader6;
		private System.Windows.Forms.ColumnHeader columnHeader7;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Button cmd_Save;
		private System.Windows.Forms.Button cmd_Refresh;
		private System.Windows.Forms.Button cmd_Modify;
		private System.Windows.Forms.Button cmd_Del;
		private System.Windows.Forms.Button cmd_Add;
		private System.Windows.Forms.Button cmd_Cancel;
		private System.Windows.Forms.Button cmd_Exit;
		private System.Windows.Forms.ComboBox cbo_Desc;
		private System.Windows.Forms.ComboBox cbo_Name;
		private System.Windows.Forms.TextBox txt_Parameter;
		private System.Windows.Forms.TextBox txt_ID;
		private System.Windows.Forms.TextBox txt_RefertoType;
		private System.Windows.Forms.TextBox txt_Rule;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.ComboBox cbo_InputCols;
		private System.Windows.Forms.ComboBox cbo_ReturnCols;
		private System.Windows.Forms.Label label15;
		private System.Windows.Forms.Label label14;
		private System.Windows.Forms.Button cmd_SQL;
		private System.Windows.Forms.ComboBox cbo_Default;
		private System.Windows.Forms.Label label13;
		private System.Windows.Forms.TextBox txt_RefertoDataSource;
		private System.Windows.Forms.ComboBox cbo_Save;
		private System.Windows.Forms.ComboBox cbo_Referto;
		private System.Windows.Forms.ComboBox cbo_ReadOnly;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label10;
		private System.Windows.Forms.Label label11;
		private System.Windows.Forms.Label lbl_Caption1;
		private System.Windows.Forms.Label label12;
		private System.Windows.Forms.Button cmd_Edit;
		private System.Windows.Forms.Button cmd_Clear;
		private System.Windows.Forms.ComboBox cbo_ConnectReceipt;
		private System.Windows.Forms.ComboBox cbo_FieldType;
		private System.Windows.Forms.ComboBox cbo_IndexSN;
		private System.Windows.Forms.ListBox lst_Text;
		private System.Windows.Forms.ComboBox cbo_Caption;
		private System.Windows.Forms.Button cmd_Insert;
		private System.Windows.Forms.ComboBox cbo_ConnectNext;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.ComboBox cbo_Parameter;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.ComboBox cbo_ColSum;

		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmProcedureInf()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.lv_List = new System.Windows.Forms.ListView();
			this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader6 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader7 = new System.Windows.Forms.ColumnHeader();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.label3 = new System.Windows.Forms.Label();
			this.cbo_Parameter = new System.Windows.Forms.ComboBox();
			this.cbo_Name = new System.Windows.Forms.ComboBox();
			this.lst_Text = new System.Windows.Forms.ListBox();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.cbo_Caption = new System.Windows.Forms.ComboBox();
			this.cbo_FieldType = new System.Windows.Forms.ComboBox();
			this.cbo_InputCols = new System.Windows.Forms.ComboBox();
			this.cbo_ReturnCols = new System.Windows.Forms.ComboBox();
			this.label15 = new System.Windows.Forms.Label();
			this.label14 = new System.Windows.Forms.Label();
			this.cmd_SQL = new System.Windows.Forms.Button();
			this.cbo_Default = new System.Windows.Forms.ComboBox();
			this.label13 = new System.Windows.Forms.Label();
			this.txt_RefertoDataSource = new System.Windows.Forms.TextBox();
			this.cbo_Save = new System.Windows.Forms.ComboBox();
			this.cbo_Referto = new System.Windows.Forms.ComboBox();
			this.cbo_ReadOnly = new System.Windows.Forms.ComboBox();
			this.cbo_IndexSN = new System.Windows.Forms.ComboBox();
			this.label6 = new System.Windows.Forms.Label();
			this.label5 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.label10 = new System.Windows.Forms.Label();
			this.label11 = new System.Windows.Forms.Label();
			this.lbl_Caption1 = new System.Windows.Forms.Label();
			this.label12 = new System.Windows.Forms.Label();
			this.cmd_Edit = new System.Windows.Forms.Button();
			this.cmd_Clear = new System.Windows.Forms.Button();
			this.cmd_Insert = new System.Windows.Forms.Button();
			this.txt_RefertoType = new System.Windows.Forms.TextBox();
			this.txt_Rule = new System.Windows.Forms.TextBox();
			this.cmd_Save = new System.Windows.Forms.Button();
			this.cmd_Refresh = new System.Windows.Forms.Button();
			this.cmd_Modify = new System.Windows.Forms.Button();
			this.cmd_Del = new System.Windows.Forms.Button();
			this.cmd_Add = new System.Windows.Forms.Button();
			this.cmd_Cancel = new System.Windows.Forms.Button();
			this.cmd_Exit = new System.Windows.Forms.Button();
			this.label2 = new System.Windows.Forms.Label();
			this.txt_Parameter = new System.Windows.Forms.TextBox();
			this.cbo_Desc = new System.Windows.Forms.ComboBox();
			this.label1 = new System.Windows.Forms.Label();
			this.txt_ID = new System.Windows.Forms.TextBox();
			this.cbo_ConnectReceipt = new System.Windows.Forms.ComboBox();
			this.cbo_ConnectNext = new System.Windows.Forms.ComboBox();
			this.label7 = new System.Windows.Forms.Label();
			this.label8 = new System.Windows.Forms.Label();
			this.label9 = new System.Windows.Forms.Label();
			this.cbo_ColSum = new System.Windows.Forms.ComboBox();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.SuspendLayout();
			// 
			// lv_List
			// 
			this.lv_List.AllowColumnReorder = true;
			this.lv_List.AutoArrange = false;
			this.lv_List.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.lv_List.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
																					  this.columnHeader5,
																					  this.columnHeader6,
																					  this.columnHeader7});
			this.lv_List.Dock = System.Windows.Forms.DockStyle.Fill;
			this.lv_List.FullRowSelect = true;
			this.lv_List.GridLines = true;
			this.lv_List.HoverSelection = true;
			this.lv_List.Location = new System.Drawing.Point(0, 326);
			this.lv_List.Name = "lv_List";
			this.lv_List.Size = new System.Drawing.Size(706, 221);
			this.lv_List.TabIndex = 6;
			this.lv_List.View = System.Windows.Forms.View.Details;
			this.lv_List.DoubleClick += new System.EventHandler(this.lv_List_DoubleClick);
			// 
			// columnHeader5
			// 
			this.columnHeader5.Text = "列1";
			// 
			// columnHeader6
			// 
			this.columnHeader6.Text = "列2";
			this.columnHeader6.Width = 92;
			// 
			// columnHeader7
			// 
			this.columnHeader7.Text = "列3";
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.cbo_ColSum);
			this.groupBox1.Controls.Add(this.label9);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.cbo_Parameter);
			this.groupBox1.Controls.Add(this.cbo_Name);
			this.groupBox1.Controls.Add(this.lst_Text);
			this.groupBox1.Controls.Add(this.groupBox2);
			this.groupBox1.Controls.Add(this.txt_RefertoType);
			this.groupBox1.Controls.Add(this.txt_Rule);
			this.groupBox1.Controls.Add(this.cmd_Save);
			this.groupBox1.Controls.Add(this.cmd_Refresh);
			this.groupBox1.Controls.Add(this.cmd_Modify);
			this.groupBox1.Controls.Add(this.cmd_Del);
			this.groupBox1.Controls.Add(this.cmd_Add);
			this.groupBox1.Controls.Add(this.cmd_Cancel);
			this.groupBox1.Controls.Add(this.cmd_Exit);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.txt_Parameter);
			this.groupBox1.Controls.Add(this.cbo_Desc);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Controls.Add(this.txt_ID);
			this.groupBox1.Controls.Add(this.cbo_ConnectReceipt);
			this.groupBox1.Controls.Add(this.cbo_ConnectNext);
			this.groupBox1.Controls.Add(this.label7);
			this.groupBox1.Controls.Add(this.label8);
			this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
			this.groupBox1.Location = new System.Drawing.Point(0, 0);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(706, 326);
			this.groupBox1.TabIndex = 7;
			this.groupBox1.TabStop = false;
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(8, 58);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(68, 14);
			this.label3.TabIndex = 79;
			this.label3.Text = "存储参数：";
			// 
			// cbo_Parameter
			// 
			this.cbo_Parameter.Location = new System.Drawing.Point(76, 56);
			this.cbo_Parameter.Name = "cbo_Parameter";
			this.cbo_Parameter.Size = new System.Drawing.Size(240, 20);
			this.cbo_Parameter.TabIndex = 78;
			// 
			// cbo_Name
			// 
			this.cbo_Name.Location = new System.Drawing.Point(76, 34);
			this.cbo_Name.Name = "cbo_Name";
			this.cbo_Name.Size = new System.Drawing.Size(240, 20);
			this.cbo_Name.TabIndex = 1;
			this.cbo_Name.SelectedIndexChanged += new System.EventHandler(this.cbo_Name_SelectedIndexChanged);
			// 
			// lst_Text
			// 
			this.lst_Text.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.lst_Text.ItemHeight = 12;
			this.lst_Text.Items.AddRange(new object[] {
														  "1.参数列表",
														  "2.参数列表",
														  "3.参数列表",
														  "4.参数列表",
														  "5.参数列表",
														  "6.参数列表",
														  "7.参数列表",
														  "8.参数列表",
														  "9.参数列表"});
			this.lst_Text.Location = new System.Drawing.Point(8, 156);
			this.lst_Text.Name = "lst_Text";
			this.lst_Text.Size = new System.Drawing.Size(310, 112);
			this.lst_Text.TabIndex = 77;
			this.lst_Text.DoubleClick += new System.EventHandler(this.lst_Text_DoubleClick);
			this.lst_Text.SelectedIndexChanged += new System.EventHandler(this.lst_Text_SelectedIndexChanged);
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.cbo_Caption);
			this.groupBox2.Controls.Add(this.cbo_FieldType);
			this.groupBox2.Controls.Add(this.cbo_InputCols);
			this.groupBox2.Controls.Add(this.cbo_ReturnCols);
			this.groupBox2.Controls.Add(this.label15);
			this.groupBox2.Controls.Add(this.label14);
			this.groupBox2.Controls.Add(this.cmd_SQL);
			this.groupBox2.Controls.Add(this.cbo_Default);
			this.groupBox2.Controls.Add(this.label13);
			this.groupBox2.Controls.Add(this.txt_RefertoDataSource);
			this.groupBox2.Controls.Add(this.cbo_Save);
			this.groupBox2.Controls.Add(this.cbo_Referto);
			this.groupBox2.Controls.Add(this.cbo_ReadOnly);
			this.groupBox2.Controls.Add(this.cbo_IndexSN);
			this.groupBox2.Controls.Add(this.label6);
			this.groupBox2.Controls.Add(this.label5);
			this.groupBox2.Controls.Add(this.label4);
			this.groupBox2.Controls.Add(this.label10);
			this.groupBox2.Controls.Add(this.label11);
			this.groupBox2.Controls.Add(this.lbl_Caption1);
			this.groupBox2.Controls.Add(this.label12);
			this.groupBox2.Controls.Add(this.cmd_Edit);
			this.groupBox2.Controls.Add(this.cmd_Clear);
			this.groupBox2.Controls.Add(this.cmd_Insert);
			this.groupBox2.Location = new System.Drawing.Point(324, 74);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(378, 246);
			this.groupBox2.TabIndex = 76;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "[属性]";
			// 
			// cbo_Caption
			// 
			this.cbo_Caption.Items.AddRange(new object[] {
															 "开始日期",
															 "终止日期",
															 "品牌型号",
															 "品牌名称",
															 "国标型号",
															 "客户名称",
															 "业  务  员",
															 "联  系  人",
															 "部        门",
															 "发票类型",
															 "开票单位"});
			this.cbo_Caption.Location = new System.Drawing.Point(124, 42);
			this.cbo_Caption.Name = "cbo_Caption";
			this.cbo_Caption.Size = new System.Drawing.Size(242, 20);
			this.cbo_Caption.TabIndex = 76;
			// 
			// cbo_FieldType
			// 
			this.cbo_FieldType.Items.AddRange(new object[] {
															   "D",
															   "C",
															   "N",
															   "B"});
			this.cbo_FieldType.Location = new System.Drawing.Point(124, 88);
			this.cbo_FieldType.Name = "cbo_FieldType";
			this.cbo_FieldType.Size = new System.Drawing.Size(242, 20);
			this.cbo_FieldType.TabIndex = 40;
			// 
			// cbo_InputCols
			// 
			this.cbo_InputCols.Items.AddRange(new object[] {
															   "1:2:3:4:5:6:7:8",
															   ": : : : : : : : : : : :"});
			this.cbo_InputCols.Location = new System.Drawing.Point(118, 366);
			this.cbo_InputCols.Name = "cbo_InputCols";
			this.cbo_InputCols.Size = new System.Drawing.Size(242, 20);
			this.cbo_InputCols.TabIndex = 36;
			// 
			// cbo_ReturnCols
			// 
			this.cbo_ReturnCols.Items.AddRange(new object[] {
																"1:2:3:4:5:6:7:8"});
			this.cbo_ReturnCols.Location = new System.Drawing.Point(118, 344);
			this.cbo_ReturnCols.Name = "cbo_ReturnCols";
			this.cbo_ReturnCols.Size = new System.Drawing.Size(242, 20);
			this.cbo_ReturnCols.TabIndex = 35;
			// 
			// label15
			// 
			this.label15.Location = new System.Drawing.Point(16, 372);
			this.label15.Name = "label15";
			this.label15.Size = new System.Drawing.Size(102, 16);
			this.label15.TabIndex = 38;
			this.label15.Text = "B.目标对应列：";
			// 
			// label14
			// 
			this.label14.Location = new System.Drawing.Point(16, 348);
			this.label14.Name = "label14";
			this.label14.Size = new System.Drawing.Size(104, 14);
			this.label14.TabIndex = 37;
			this.label14.Text = "A.参照返回列：";
			// 
			// cmd_SQL
			// 
			this.cmd_SQL.Location = new System.Drawing.Point(24, 152);
			this.cmd_SQL.Name = "cmd_SQL";
			this.cmd_SQL.Size = new System.Drawing.Size(88, 22);
			this.cmd_SQL.TabIndex = 34;
			this.cmd_SQL.Text = "SQL生成器...";
			this.cmd_SQL.Click += new System.EventHandler(this.cmd_SQL_Click);
			// 
			// cbo_Default
			// 
			this.cbo_Default.Items.AddRange(new object[] {
															 "@Type=单据类型(例如 销售收款、销售预收款)",
															 "@Operator=操作员",
															 "@SysDate=系统日期",
															 "@GUID=唯一标识符",
															 "@ReceiptNo=单据编号(普通年月日编号)",
															 "@GuidReceptNo=单据编号(唯一标识符)",
															 "@KeyID=主键(唯一标识)"});
			this.cbo_Default.Location = new System.Drawing.Point(124, 64);
			this.cbo_Default.Name = "cbo_Default";
			this.cbo_Default.Size = new System.Drawing.Size(242, 20);
			this.cbo_Default.TabIndex = 33;
			// 
			// label13
			// 
			this.label13.Location = new System.Drawing.Point(8, 46);
			this.label13.Name = "label13";
			this.label13.Size = new System.Drawing.Size(96, 16);
			this.label13.TabIndex = 32;
			this.label13.Text = "2.标题：";
			// 
			// txt_RefertoDataSource
			// 
			this.txt_RefertoDataSource.Location = new System.Drawing.Point(124, 134);
			this.txt_RefertoDataSource.Multiline = true;
			this.txt_RefertoDataSource.Name = "txt_RefertoDataSource";
			this.txt_RefertoDataSource.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
			this.txt_RefertoDataSource.Size = new System.Drawing.Size(242, 60);
			this.txt_RefertoDataSource.TabIndex = 18;
			this.txt_RefertoDataSource.Text = "";
			// 
			// cbo_Save
			// 
			this.cbo_Save.Location = new System.Drawing.Point(124, 290);
			this.cbo_Save.Name = "cbo_Save";
			this.cbo_Save.Size = new System.Drawing.Size(242, 20);
			this.cbo_Save.TabIndex = 16;
			// 
			// cbo_Referto
			// 
			this.cbo_Referto.Items.AddRange(new object[] {
															 "0=网格列表参照",
															 "1=日期参照",
															 "2=列表参照",
															 "3=数型结构参照",
															 "4=数型文件路径参照",
															 "5=文本输入参照",
															 "6=复选参照",
															 "11=其它"});
			this.cbo_Referto.Location = new System.Drawing.Point(124, 112);
			this.cbo_Referto.Name = "cbo_Referto";
			this.cbo_Referto.Size = new System.Drawing.Size(242, 20);
			this.cbo_Referto.TabIndex = 15;
			// 
			// cbo_ReadOnly
			// 
			this.cbo_ReadOnly.Items.AddRange(new object[] {
															  "True",
															  "False"});
			this.cbo_ReadOnly.Location = new System.Drawing.Point(124, 198);
			this.cbo_ReadOnly.Name = "cbo_ReadOnly";
			this.cbo_ReadOnly.Size = new System.Drawing.Size(242, 20);
			this.cbo_ReadOnly.TabIndex = 14;
			// 
			// cbo_IndexSN
			// 
			this.cbo_IndexSN.Items.AddRange(new object[] {
															 "1",
															 "2",
															 "3",
															 "4",
															 "5",
															 "6",
															 "7",
															 "8",
															 "9",
															 "10",
															 "11",
															 "12",
															 "13",
															 "14",
															 "15",
															 "16",
															 "17",
															 "18",
															 "19",
															 "20"});
			this.cbo_IndexSN.Location = new System.Drawing.Point(124, 18);
			this.cbo_IndexSN.Name = "cbo_IndexSN";
			this.cbo_IndexSN.Size = new System.Drawing.Size(242, 20);
			this.cbo_IndexSN.TabIndex = 12;
			this.cbo_IndexSN.Text = "1";
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(8, 292);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(104, 14);
			this.label6.TabIndex = 8;
			this.label6.Text = "10.对应参数列：";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(8, 136);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(104, 14);
			this.label5.TabIndex = 7;
			this.label5.Text = "6.参照数据源：";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(8, 114);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(84, 14);
			this.label4.TabIndex = 6;
			this.label4.Text = "5.参照类型：";
			// 
			// label10
			// 
			this.label10.Location = new System.Drawing.Point(8, 202);
			this.label10.Name = "label10";
			this.label10.Size = new System.Drawing.Size(106, 14);
			this.label10.TabIndex = 5;
			this.label10.Text = "7.不可编辑：";
			// 
			// label11
			// 
			this.label11.Location = new System.Drawing.Point(8, 70);
			this.label11.Name = "label11";
			this.label11.Size = new System.Drawing.Size(116, 14);
			this.label11.TabIndex = 4;
			this.label11.Text = "3.默认值(或主键)：                         ";
			// 
			// lbl_Caption1
			// 
			this.lbl_Caption1.Location = new System.Drawing.Point(8, 22);
			this.lbl_Caption1.Name = "lbl_Caption1";
			this.lbl_Caption1.Size = new System.Drawing.Size(98, 14);
			this.lbl_Caption1.TabIndex = 3;
			this.lbl_Caption1.Text = "1.序号：";
			// 
			// label12
			// 
			this.label12.Location = new System.Drawing.Point(8, 90);
			this.label12.Name = "label12";
			this.label12.Size = new System.Drawing.Size(104, 14);
			this.label12.TabIndex = 28;
			this.label12.Text = "4.字段类型：";
			// 
			// cmd_Edit
			// 
			this.cmd_Edit.Location = new System.Drawing.Point(228, 228);
			this.cmd_Edit.Name = "cmd_Edit";
			this.cmd_Edit.Size = new System.Drawing.Size(62, 24);
			this.cmd_Edit.TabIndex = 75;
			this.cmd_Edit.Text = "修改";
			this.cmd_Edit.Click += new System.EventHandler(this.cmd_Edit_Click);
			// 
			// cmd_Clear
			// 
			this.cmd_Clear.Location = new System.Drawing.Point(52, 228);
			this.cmd_Clear.Name = "cmd_Clear";
			this.cmd_Clear.Size = new System.Drawing.Size(66, 24);
			this.cmd_Clear.TabIndex = 74;
			this.cmd_Clear.Text = "移除";
			this.cmd_Clear.Click += new System.EventHandler(this.cmd_Clear_Click);
			// 
			// cmd_Insert
			// 
			this.cmd_Insert.Location = new System.Drawing.Point(294, 228);
			this.cmd_Insert.Name = "cmd_Insert";
			this.cmd_Insert.Size = new System.Drawing.Size(68, 24);
			this.cmd_Insert.TabIndex = 73;
			this.cmd_Insert.Text = "插入";
			this.cmd_Insert.Click += new System.EventHandler(this.button1_Click);
			// 
			// txt_RefertoType
			// 
			this.txt_RefertoType.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(224)), ((System.Byte)(224)), ((System.Byte)(224)));
			this.txt_RefertoType.Location = new System.Drawing.Point(536, 370);
			this.txt_RefertoType.Multiline = true;
			this.txt_RefertoType.Name = "txt_RefertoType";
			this.txt_RefertoType.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
			this.txt_RefertoType.Size = new System.Drawing.Size(198, 84);
			this.txt_RefertoType.TabIndex = 72;
			this.txt_RefertoType.Text = "";
			// 
			// txt_Rule
			// 
			this.txt_Rule.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(224)), ((System.Byte)(224)), ((System.Byte)(224)));
			this.txt_Rule.Location = new System.Drawing.Point(306, 366);
			this.txt_Rule.Multiline = true;
			this.txt_Rule.Name = "txt_Rule";
			this.txt_Rule.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
			this.txt_Rule.Size = new System.Drawing.Size(308, 84);
			this.txt_Rule.TabIndex = 71;
			this.txt_Rule.Text = "注意规则：0标题,1默认值,2字段类型,3参照类型,4参照数据源,5锁定参照(只读=True,否则false或空)";
			// 
			// cmd_Save
			// 
			this.cmd_Save.Enabled = false;
			this.cmd_Save.Location = new System.Drawing.Point(150, 274);
			this.cmd_Save.Name = "cmd_Save";
			this.cmd_Save.Size = new System.Drawing.Size(70, 22);
			this.cmd_Save.TabIndex = 67;
			this.cmd_Save.Text = "保存(&S)";
			this.cmd_Save.Click += new System.EventHandler(this.cmd_Save_Click);
			// 
			// cmd_Refresh
			// 
			this.cmd_Refresh.Location = new System.Drawing.Point(10, 298);
			this.cmd_Refresh.Name = "cmd_Refresh";
			this.cmd_Refresh.Size = new System.Drawing.Size(70, 22);
			this.cmd_Refresh.TabIndex = 66;
			this.cmd_Refresh.Text = "刷新(&R)";
			this.cmd_Refresh.Click += new System.EventHandler(this.cmd_Refresh_Click);
			// 
			// cmd_Modify
			// 
			this.cmd_Modify.Location = new System.Drawing.Point(80, 274);
			this.cmd_Modify.Name = "cmd_Modify";
			this.cmd_Modify.Size = new System.Drawing.Size(70, 22);
			this.cmd_Modify.TabIndex = 65;
			this.cmd_Modify.Text = "修改(&M)";
			this.cmd_Modify.Click += new System.EventHandler(this.cmd_Modify_Click);
			// 
			// cmd_Del
			// 
			this.cmd_Del.Location = new System.Drawing.Point(80, 298);
			this.cmd_Del.Name = "cmd_Del";
			this.cmd_Del.Size = new System.Drawing.Size(70, 22);
			this.cmd_Del.TabIndex = 64;
			this.cmd_Del.Text = "删除(&D)";
			this.cmd_Del.Click += new System.EventHandler(this.cmd_Del_Click);
			// 
			// cmd_Add
			// 
			this.cmd_Add.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.cmd_Add.Location = new System.Drawing.Point(10, 274);
			this.cmd_Add.Name = "cmd_Add";
			this.cmd_Add.Size = new System.Drawing.Size(70, 22);
			this.cmd_Add.TabIndex = 63;
			this.cmd_Add.Text = "添加(&A)";
			this.cmd_Add.Click += new System.EventHandler(this.cmd_Add_Click);
			// 
			// cmd_Cancel
			// 
			this.cmd_Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.cmd_Cancel.Enabled = false;
			this.cmd_Cancel.Location = new System.Drawing.Point(150, 298);
			this.cmd_Cancel.Name = "cmd_Cancel";
			this.cmd_Cancel.Size = new System.Drawing.Size(70, 22);
			this.cmd_Cancel.TabIndex = 62;
			this.cmd_Cancel.Text = "取消(&C)";
			this.cmd_Cancel.Click += new System.EventHandler(this.cmd_Cancel_Click);
			// 
			// cmd_Exit
			// 
			this.cmd_Exit.BackColor = System.Drawing.SystemColors.Control;
			this.cmd_Exit.ForeColor = System.Drawing.SystemColors.ControlText;
			this.cmd_Exit.Location = new System.Drawing.Point(222, 274);
			this.cmd_Exit.Name = "cmd_Exit";
			this.cmd_Exit.Size = new System.Drawing.Size(70, 46);
			this.cmd_Exit.TabIndex = 61;
			this.cmd_Exit.Text = "退出(&Q)";
			this.cmd_Exit.Click += new System.EventHandler(this.cmd_Exit_Click);
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(8, 40);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(112, 20);
			this.label2.TabIndex = 4;
			this.label2.Text = "存储名称：";
			// 
			// txt_Parameter
			// 
			this.txt_Parameter.Location = new System.Drawing.Point(8, 78);
			this.txt_Parameter.Multiline = true;
			this.txt_Parameter.Name = "txt_Parameter";
			this.txt_Parameter.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
			this.txt_Parameter.Size = new System.Drawing.Size(310, 76);
			this.txt_Parameter.TabIndex = 2;
			this.txt_Parameter.Text = "";
			// 
			// cbo_Desc
			// 
			this.cbo_Desc.Location = new System.Drawing.Point(76, 12);
			this.cbo_Desc.Name = "cbo_Desc";
			this.cbo_Desc.Size = new System.Drawing.Size(240, 20);
			this.cbo_Desc.TabIndex = 0;
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 18);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(90, 18);
			this.label1.TabIndex = 3;
			this.label1.Text = "存储描述：                                            ";
			// 
			// txt_ID
			// 
			this.txt_ID.Location = new System.Drawing.Point(10, 180);
			this.txt_ID.Name = "txt_ID";
			this.txt_ID.Size = new System.Drawing.Size(56, 21);
			this.txt_ID.TabIndex = 68;
			this.txt_ID.Text = "0";
			// 
			// cbo_ConnectReceipt
			// 
			this.cbo_ConnectReceipt.Items.AddRange(new object[] {
																	"单据名称=第N列",
																	"销售单=1"});
			this.cbo_ConnectReceipt.Location = new System.Drawing.Point(448, 12);
			this.cbo_ConnectReceipt.Name = "cbo_ConnectReceipt";
			this.cbo_ConnectReceipt.Size = new System.Drawing.Size(242, 20);
			this.cbo_ConnectReceipt.TabIndex = 17;
			// 
			// cbo_ConnectNext
			// 
			this.cbo_ConnectNext.Location = new System.Drawing.Point(448, 34);
			this.cbo_ConnectNext.Name = "cbo_ConnectNext";
			this.cbo_ConnectNext.Size = new System.Drawing.Size(242, 20);
			this.cbo_ConnectNext.TabIndex = 77;
			// 
			// label7
			// 
			this.label7.Location = new System.Drawing.Point(332, 38);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(116, 14);
			this.label7.TabIndex = 9;
			this.label7.Text = "下一级存储连接：";
			// 
			// label8
			// 
			this.label8.Location = new System.Drawing.Point(332, 16);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(104, 14);
			this.label8.TabIndex = 10;
			this.label8.Text = "原始单据连接：";
			// 
			// label9
			// 
			this.label9.Location = new System.Drawing.Point(332, 56);
			this.label9.Name = "label9";
			this.label9.Size = new System.Drawing.Size(114, 16);
			this.label9.TabIndex = 80;
			this.label9.Text = "指定列求和：";
			// 
			// cbo_ColSum
			// 
			this.cbo_ColSum.Items.AddRange(new object[] {
															"1|2|3|4|5|",
															"6|7|8|9|10|11|"});
			this.cbo_ColSum.Location = new System.Drawing.Point(448, 56);
			this.cbo_ColSum.Name = "cbo_ColSum";
			this.cbo_ColSum.Size = new System.Drawing.Size(242, 20);
			this.cbo_ColSum.TabIndex = 81;
			// 
			// frmProcedureInf
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(706, 547);
			this.Controls.Add(this.lv_List);
			this.Controls.Add(this.groupBox1);
			this.Name = "frmProcedureInf";
			this.Text = "frmProcedureInf";
			this.Load += new System.EventHandler(this.frmProcedureInf_Load);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

	
		private void frmProcedureInf_Load(object sender, System.EventArgs e)
		{
			ShowRefresh();
			//			SELECT fcName, fcDesc, fcParameterList, ID FROM S_ProcedureInf
			
			InitData.InitComboBox(cbo_Name,"SELECT distinct dbo.sysobjects.name FROM  dbo.sysobjects WHERE (dbo.sysobjects.xtype = 'p')");
			InitData.InitComboBox(cbo_Desc,"Select distinct fcDesc FROM S_ProcedureInf");
			InitData.InitComboBox(cbo_ConnectNext,"Select distinct fcDesc FROM S_ProcedureInf");
			InitData.InitComboBox(cbo_ConnectReceipt,"Select distinct fcReceiptName FROM S_ReceiptSetup where left(fcReceiptNo,3)='N01' and fcClass='1'");
			
			////
////			string s="";
////			s="参照类型对照："+"\r\n";
////			s=s+"0=网格列表参照"+"\r\n";
////			s=s+"1=日期参照"+"\r\n";
////			s=s+"2=列表参照"+"\r\n";
////			s=s+"3=数型结构参照"+"\r\n";
////			s=s+"4=数型文件路径参照"+"\r\n";
////			s=s+"5=文本输入参照"+"\r\n";
////			s=s+"6=复选参照"+"\r\n";
////			s=s+"11=其它"+"\r\n";
////			txt_RefertoType.Text=s;
////
////			
////			s="注意规则："+"\r\n";
////			s=s+"0标题,1默认值,2字段类型,3参照类型,4参照数据源,5锁定参照(只读=True,否则false或空)"+"\r\n";
////			s=s+"例如：日期,D,@Date,1|业务员,C,@Operator,2,SELECT DISTINCT fcName  FROM I_Customer,true"+"\r\n";
////			txt_Rule.Text =s;

		}


		private void cmd_Cancel_Click(object sender, System.EventArgs e)
		{
			w_EidtFlag=false;
			CmdEnable(true);
		}

		private void cmd_Add_Click(object sender, System.EventArgs e)
		{
			cbo_Desc.Text ="";
			cbo_Name.Text="";
			txt_Parameter.Text ="";
			CmdEnable(false);
			w_EidtFlag=false;

		}

		private void cmd_Del_Click(object sender, System.EventArgs e)
		{
			if (newQueryAttrib.RemoveRecord(txt_ID.Text)==true ) {ShowRefresh();}
		}

		private void cmd_Modify_Click(object sender, System.EventArgs e)
		{
			w_EidtFlag=true;
			CmdEnable(false);
			w_keyId=txt_ID.Text;
		}

		private void cmd_Save_Click(object sender, System.EventArgs e)
		{
			newQueryAttrib.QueryName=this.cbo_Name.Text ;
			newQueryAttrib.QueryDesc=this.cbo_Desc.Text ;
			newQueryAttrib.ParameterList=this.txt_Parameter.Text  ;
			newQueryAttrib.ConnectReceipt=this.cbo_ConnectReceipt.Text  ;
			newQueryAttrib.ConnectNextQuery=this.cbo_ConnectNext.Text ;
			newQueryAttrib.ColSum =this.cbo_ColSum.Text  ;
			newQueryAttrib.KeyId=int.Parse(txt_ID.Text) ;
			if (newQueryAttrib.RecordSave(w_EidtFlag)==true)
			{
				ShowRefresh();
				CmdEnable(true);
				w_EidtFlag=false;
			}
		}

		private void ShowRefresh()
		{
			InitData.InitListView(lv_List,newDb.GetDataArray(newQueryAttrib.GetQuerySQL(),1));
		}
		private void CmdEnable(bool p_YesNo)
		{
			cmd_Add.Enabled =p_YesNo;
			cmd_Modify.Enabled =p_YesNo;
			cmd_Save.Enabled =! p_YesNo;
			cmd_Del.Enabled =p_YesNo;
			cmd_Cancel.Enabled =!p_YesNo;
			cmd_Refresh.Enabled =p_YesNo;
			cmd_Exit.Enabled =p_YesNo;
		
		}
		private void cmd_Refresh_Click(object sender, System.EventArgs e)
		{
			ShowRefresh();
		}

		private void cmd_Exit_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void lv_List_DoubleClick(object sender, System.EventArgs e)
		{
			cbo_Desc.Text =lv_List.SelectedItems[0].SubItems[1].Text ;
			cbo_Name.Text=lv_List.SelectedItems[0].SubItems[2].Text ;
			txt_Parameter.Text =lv_List.SelectedItems[0].SubItems[3].Text ;
			this.cbo_ConnectReceipt.Text =lv_List.SelectedItems[0].SubItems[4].Text;
			this.cbo_ConnectNext.Text =lv_List.SelectedItems[0].SubItems[5].Text;
			this.cbo_ColSum.Text=lv_List.SelectedItems[0].SubItems[6].Text;
			txt_ID.Text =lv_List.SelectedItems[0].SubItems[7].Text ; 
			SetParameterChar(txt_Parameter.Text);

		}

		private void cmd_Ex_Click(object sender, System.EventArgs e)
		{	
			frmDataTable f=new frmDataTable();
			f.Show() ;
		}

		private void cmd_SQL_Click(object sender, System.EventArgs e)
		{
			frmDataTable f=new frmDataTable();
			f.Show() ;

		}
		private void SetTextString(string p_FormatString)
		{
//			newQueryAttrib.FormatString =p_FormatString;
			this.cbo_IndexSN.Text=newQueryAttrib.SplitChar(p_FormatString).IndexSN  ;
			this.cbo_Caption.Text=newQueryAttrib.SplitChar(p_FormatString).RowCaption ;
			this.cbo_Default.Text =newQueryAttrib.SplitChar(p_FormatString).TextDefault;
			if (newQueryAttrib.SplitChar(p_FormatString).ReadOnly==false)
			{
				this.cbo_ReadOnly.Text="";
			}
			else
			{
				this.cbo_ReadOnly.Text=newQueryAttrib.SplitChar(p_FormatString).ReadOnly.ToString();
			}

			this.cbo_Referto.Text=newQueryAttrib.SplitChar(p_FormatString).RefertoType ;
			this.cbo_ConnectReceipt.Text=newQueryAttrib.ConnectReceipt ;
			this.cbo_ConnectNext.Text=newQueryAttrib.ConnectNextQuery ;

			this.txt_RefertoDataSource.Text=newQueryAttrib.SplitChar(p_FormatString).RefertoDataSource;
			this.cbo_FieldType.Text=newQueryAttrib.SplitChar(p_FormatString).FieldType ;

		}
		private string GetTextString()
		{
			string [] sArrTemp=null;
			JXC_MIS.MyClass.sFilterAttrib newFilterAttrib=new JXC_MIS.MyClass.sFilterAttrib();
//			newQueryAttrib.FilterAttrib.IndexSN =this.cbo_IndexSN.Text;
//			newQueryAttrib.FilterAttrib.RowCaption=this.cbo_Caption.Text;
//			sArrTemp=this.cbo_Default.Text.Split('=');
//			newQueryAttrib.FilterAttrib.TextDefault =sArrTemp[0].Trim();
//			sArrTemp=this.cbo_Referto.Text.Split('=');
//			newQueryAttrib.FilterAttrib.RefertoType =sArrTemp[0];
//			newQueryAttrib.FilterAttrib.RefertoDataSource =this.txt_RefertoDataSource.Text;
			newFilterAttrib.IndexSN =this.cbo_IndexSN.Text;
			newFilterAttrib.RowCaption=this.cbo_Caption.Text;
			sArrTemp=this.cbo_Default.Text.Split('=');
			newFilterAttrib.TextDefault =sArrTemp[0].Trim();
			sArrTemp=this.cbo_Referto.Text.Split('=');
			newFilterAttrib.RefertoType =sArrTemp[0];
			newFilterAttrib.RefertoDataSource =this.txt_RefertoDataSource.Text;


			if (this.cbo_ReadOnly.Text.ToLower()=="true")
			{
				newFilterAttrib.ReadOnly =true;
			}
			else
			{
				newFilterAttrib.ReadOnly =false;
			}

			newQueryAttrib.FilterAttrib=newFilterAttrib;
			newQueryAttrib.ConnectReceipt =this.cbo_ConnectReceipt.Text ;
			newQueryAttrib.ConnectNextQuery =this.cbo_ConnectNext.Text ;
			string s=newQueryAttrib.GetFormatString();
			return s;

		}
		private string GetParameterChar()
		{

           int j=lst_Text.Items.Count-1 ;
			string s="";
			for (int i=0;i<j;i++)
			{
			  s=s+lst_Text.Items[i].ToString()+"|" ; 
			}
			if (s==""){return s;}
			else{
				return s=s.Substring(0,s.Length-1);}
		}
		private void SetParameterChar(string p_ReadText)
		{
			string [] sArrTemp=null;
			sArrTemp=p_ReadText.Split('|');
			int j=sArrTemp.Length ;
			lst_Text.Items.Clear(); 
			for (int i=0;i<j;i++)
			{
				lst_Text.Items.Add(sArrTemp[i]) ; 
			}
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			lst_Text.Items.Insert(lst_Text.Items.IndexOf(lst_Text.Text), GetTextString()) ;
			txt_Parameter.Text =GetParameterChar();
		}

		private void lst_Text_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			SetTextString(lst_Text.Text); 
			this.cbo_IndexSN.Text=lst_Text.Items.IndexOf(lst_Text.Text).ToString() ; 
		}

		private void lst_Text_DoubleClick(object sender, System.EventArgs e)
		{
			
		}

		private void cmd_Edit_Click(object sender, System.EventArgs e)
		{
			try
			{
				string sTemp=lst_Text.Text;
				lst_Text.Items.Insert(lst_Text.Items.IndexOf(lst_Text.Text), GetTextString()) ;
				lst_Text.Items.Remove(sTemp);
				txt_Parameter.Text =GetParameterChar();
			}
			catch
			{}
		}

		private void cmd_Clear_Click(object sender, System.EventArgs e)
		{
			try
			{
			lst_Text.Items.Remove(lst_Text.Text);
			txt_Parameter.Text =GetParameterChar();
			}
			catch
			{}
		}

		private void cbo_Name_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			InitData.InitComboBox(cbo_Parameter,"SELECT rtrim(dbo.syscolumns.colid)+'.'+dbo.syscolumns.name FROM  dbo.sysobjects  RIGHT OUTER JOIN   dbo.syscolumns  ON  dbo.sysobjects.id = dbo.syscolumns.id WHERE (dbo.sysobjects.xtype = 'p') and dbo.sysobjects.name='"+cbo_Name.Text +"' Order by dbo.sysobjects.name,dbo.syscolumns.colid");
		}




	}
}
