| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- namespace CoreDemo
- {
- public partial class CoreTest : FrmBase
- {
- public CoreTest()
- {
- InitializeComponent();
- }
- private void CoreTest_Load(object sender, EventArgs e)
- {
- this.ucEditTemplateButton1.ButtonClick += new Core.Dev.ComponentLibrary.Common.UcEditTemplateButton.Button_Click(ucEditTemplateButton1_ButtonClick);
- this.ucEditTemplateButton1.CurrentGrid = this.ugEmp;
- this.ucEditTemplateButton1.CurrTemplate = this.ultraGridRowEditTemplate1;
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuery();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void ucEditTemplateButton1_ButtonClick(Core.Dev.ComponentLibrary.Common.EditTemplateButtonType type)
- {
- switch (type)
- {
- case Core.Dev.ComponentLibrary.Common.EditTemplateButtonType.Add:
- DoAdd();
- break;
- case Core.Dev.ComponentLibrary.Common.EditTemplateButtonType.Delete:
- DoDelete();
- break;
- case Core.Dev.ComponentLibrary.Common.EditTemplateButtonType.Edit:
- DoUpdate();
- break;
- }
- }
- //sqlid:C0601010301
- //调用ID C06010103
- private void DoQuery()
- {
- this.dataSet1.Tables[0].Clear();
- string sqlid = "C0601010301";
- CoreClientParam ccp = new CoreClientParam();
- ccp.InvokeID = "C06010103";
- ccp.ServerParams = new object[] { sqlid};
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.External);
- }
- //C0601010101
- //调用ID --C06010101
- private void DoAdd()
- {
- string sqlid = "C0601010101";
- string id = this.ultraGridRowEditTemplate1.Row.Cells["EID"].Text;
- string name = this.ultraGridRowEditTemplate1.Row.Cells["ENAME"].Text;
- string job = this.ultraGridRowEditTemplate1.Row.Cells["EJOB"].Text;
- string dept = this.ultraGridRowEditTemplate1.Row.Cells["EDEPT"].Text;
- CoreClientParam ccp = new CoreClientParam();
- ccp.InvokeID = "C06010101";
- // ccp.ServerName = "CoreFs.Test.EmpManger";
- //ccp.MethodName = "AddEmp";
- ccp.ServerParams = new object[] { sqlid, id,name,job,dept };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.External);
- if (ccp.ReturnCode != 0) return;
- this.ultraGridRowEditTemplate1.Row.Update();
- MessageBox.Show("添加数据成功!");
- }
- // C0601010401
- //调用ID C06010104
- private void DoDelete()
- {
- if (MessageBox.Show("是否确认删除该数据!", "提示", MessageBoxButtons.YesNo) == DialogResult.No) return;
- string sqlid = "C0601010401";
- string id = this.ultraGridRowEditTemplate1.Row.Cells["EID"].Text;
- CoreClientParam ccp = new CoreClientParam();
- ccp.InvokeID = "C06010104";
- //ccp.ServerName = "CoreFs.Test.EmpManger";
- // ccp.MethodName = "DelEmp";
- ccp.ServerParams = new object[] { sqlid, id };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.External);
- if (ccp.ReturnCode != 0) return;
- this.ultraGridRowEditTemplate1.Row.Delete(false);
- MessageBox.Show("删除数据成功!");
- }
- //C0601010201
- //调用ID C06010102
- private void DoUpdate()
- {
- if (MessageBox.Show("是否确认修改该数据!", "提示", MessageBoxButtons.YesNo) == DialogResult.No) return;
- string sqlid = "C0601010201";
- string id = this.ultraGridRowEditTemplate1.Row.Cells["EID"].Text;
- string name = this.ultraGridRowEditTemplate1.Row.Cells["ENAME"].Text;
- string job = this.ultraGridRowEditTemplate1.Row.Cells["EJOB"].Text;
- string dept = this.ultraGridRowEditTemplate1.Row.Cells["EDEPT"].Text;
- CoreClientParam ccp = new CoreClientParam();
- ccp.InvokeID = "C06010102";
- // ccp.ServerName = "CoreFs.Test.EmpManger";
- //ccp.MethodName = "UpdateEmp";
- ccp.ServerParams = new object[] { sqlid, name,job,dept,id };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.External);
- if (ccp.ReturnCode != 0) return;
- this.ultraGridRowEditTemplate1.Row.Update();
- MessageBox.Show("修改数据成功!");
- }
- private void ugEmp_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
- {
- }
-
- }
- }
|