国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

C#中TreeView類操作全攻略(三)

2024-07-21 02:19:40
字體:
供稿:網(wǎng)友
using system;
using system.drawing;
using system.collections;
using system.componentmodel;
using system.windows.forms;
using com.prm.client.tools;
using system.data.oracleclient;
//using com.prm.client.common;

namespace com.prm.client.forms
{
/// <summary>
/// sm_editfunction 的摘要說明。
/// </summary>
public class sm_editfunction: system.windows.forms.form
{
private system.windows.forms.label lbl_name;
private system.windows.forms.textbox txt_name;
private system.windows.forms.label lbl_tag;
private system.windows.forms.textbox txt_tag;
private system.windows.forms.checkbox ckb_isinterface;
private system.windows.forms.label lbl_isinterface;
private system.windows.forms.label lbl_type;
private system.windows.forms.label lbl_funentity;
private system.windows.forms.combobox cbo_type;
private system.windows.forms.textbox txt_funentity;
private system.windows.forms.label lbl_belongto;
private system.windows.forms.textbox txt_belongto;
private system.windows.forms.textbox txt_detail;
private system.windows.forms.label lbl_detail;
private system.windows.forms.button btn_confirm;
private system.windows.forms.button btn_cancel;
private system.windows.forms.button btn_help;

//用來保存原始的功能記錄
private functiontable orifuncitem;

//用來保存數(shù)字字典功能類別的數(shù)據(jù)
clientdictionary[] dic_functype;
//用來保存connection屬性
private oracleconnection functableconn;
//用來保存修改后的記錄
private functiontable newfuncitem;
public functiontable newfuncitem {get {return newfuncitem;}}
//用來判斷是否用戶進行了修改
private bool isedit=false;
public bool isedit {get {return isedit;}}
/// <summary>
/// 必需的設(shè)計器變量。
/// </summary>
private system.componentmodel.container components = null;

/// <summary>
/// 構(gòu)造函數(shù),通過editfuncitem參數(shù)和dic_functype對窗口進行初始化值
/// </summary>
public sm_editfunction(functiontable editfuncitem,clientdictionary[] dic_functype)
{
//
// windows 窗體設(shè)計器支持所必需的
//
initializecomponent();
//用參數(shù)值對本窗口相應的變量進行賦值保存
orifuncitem=editfuncitem;
dic_functype=dic_functype;
const string valuemember="valuemember",displaymember="displaymember",nulltext="";
cbo_type.datasource = dic_functype;
cbo_type.valuemember = valuemember;
cbo_type.displaymember = displaymember;

dataaccessobject functableaccessobject=new dataaccessobject();
functableconn=functableaccessobject.connection;

this.txt_name.text=orifuncitem.funcname;
this.txt_tag.text=orifuncitem.functag;
if (orifuncitem.funcisinterface =="0")
{
this.ckb_isinterface.checked=false;
}
else
{
this.ckb_isinterface.checked=true;
}
this.cbo_type.selectedvalue=orifuncitem.functype;
this.txt_funentity.text=orifuncitem.funcentity;
this.txt_belongto.text=orifuncitem.funcbelongto;
this.txt_detail.text=orifuncitem.funcdetail;

}

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

#region windows 窗體設(shè)計器生成的代碼
/// <summary>
/// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void initializecomponent()
{
system.resources.resourcemanager resources = new system.resources.resourcemanager(typeof(sm_editfunction));
this.lbl_name = new system.windows.forms.label();
this.lbl_tag = new system.windows.forms.label();
this.lbl_type = new system.windows.forms.label();
this.lbl_funentity = new system.windows.forms.label();
this.lbl_belongto = new system.windows.forms.label();
this.txt_name = new system.windows.forms.textbox();
this.txt_tag = new system.windows.forms.textbox();
this.cbo_type = new system.windows.forms.combobox();
this.txt_belongto = new system.windows.forms.textbox();
this.txt_detail = new system.windows.forms.textbox();
this.lbl_detail = new system.windows.forms.label();
this.ckb_isinterface = new system.windows.forms.checkbox();
this.btn_confirm = new system.windows.forms.button();
this.btn_cancel = new system.windows.forms.button();
this.btn_help = new system.windows.forms.button();
this.lbl_isinterface = new system.windows.forms.label();
this.txt_funentity = new system.windows.forms.textbox();
this.suspendlayout();
//
// lbl_name
//
this.lbl_name.location = new system.drawing.point(56, 24);
this.lbl_name.name = "lbl_name";
this.lbl_name.size = new system.drawing.size(48, 23);
this.lbl_name.tabindex = 0;
this.lbl_name.text = "名稱:";
//
// lbl_tag
//
this.lbl_tag.location = new system.drawing.point(56, 56);
this.lbl_tag.name = "lbl_tag";
this.lbl_tag.size = new system.drawing.size(48, 23);
this.lbl_tag.tabindex = 1;
this.lbl_tag.text = "標識:";
//
// lbl_type
//
this.lbl_type.location = new system.drawing.point(56, 112);
this.lbl_type.name = "lbl_type";
this.lbl_type.size = new system.drawing.size(48, 23);
this.lbl_type.tabindex = 2;
this.lbl_type.text = "類別:";
//
// lbl_funentity
//
this.lbl_funentity.location = new system.drawing.point(32, 144);
this.lbl_funentity.name = "lbl_funentity";
this.lbl_funentity.size = new system.drawing.size(72, 23);
this.lbl_funentity.tabindex = 3;
this.lbl_funentity.text = " 功能體:";
//
// lbl_belongto
//
this.lbl_belongto.location = new system.drawing.point(8, 176);
this.lbl_belongto.name = "lbl_belongto";
this.lbl_belongto.size = new system.drawing.size(96, 23);
this.lbl_belongto.tabindex = 4;
this.lbl_belongto.text = "所屬窗口標識:";
//
// txt_name
//
this.txt_name.forecolor = system.drawing.color.fromargb(((system.byte)(30)), ((system.byte)(66)), ((system.byte)(94)));
this.txt_name.location = new system.drawing.point(104, 16);
this.txt_name.name = "txt_name";
this.txt_name.size = new system.drawing.size(152, 21);
this.txt_name.tabindex = 5;
this.txt_name.text = "";
//
// txt_tag
//
this.txt_tag.forecolor = system.drawing.color.fromargb(((system.byte)(30)), ((system.byte)(66)), ((system.byte)(94)));
this.txt_tag.location = new system.drawing.point(104, 48);
this.txt_tag.name = "txt_tag";
this.txt_tag.size = new system.drawing.size(152, 21);
this.txt_tag.tabindex = 6;
this.txt_tag.text = "";
//
// cbo_type
//
this.cbo_type.dropdownstyle = system.windows.forms.comboboxstyle.dropdownlist;
this.cbo_type.forecolor = system.drawing.color.fromargb(((system.byte)(30)), ((system.byte)(66)), ((system.byte)(94)));
this.cbo_type.location = new system.drawing.point(104, 104);
this.cbo_type.name = "cbo_type";
this.cbo_type.size = new system.drawing.size(152, 20);
this.cbo_type.tabindex = 7;
//
// txt_belongto
//
this.txt_belongto.forecolor = system.drawing.color.fromargb(((system.byte)(30)), ((system.byte)(66)), ((system.byte)(94)));
this.txt_belongto.location = new system.drawing.point(104, 168);
this.txt_belongto.name = "txt_belongto";
this.txt_belongto.size = new system.drawing.size(152, 21);
this.txt_belongto.tabindex = 8;
this.txt_belongto.text = "";
//
// txt_detail
//
this.txt_detail.forecolor = system.drawing.color.fromargb(((system.byte)(30)), ((system.byte)(66)), ((system.byte)(94)));
this.txt_detail.location = new system.drawing.point(104, 200);
this.txt_detail.name = "txt_detail";
this.txt_detail.size = new system.drawing.size(152, 21);
this.txt_detail.tabindex = 9;
this.txt_detail.text = "";
//
// lbl_detail
//
this.lbl_detail.location = new system.drawing.point(56, 208);
this.lbl_detail.name = "lbl_detail";
this.lbl_detail.size = new system.drawing.size(48, 23);
this.lbl_detail.tabindex = 10;
this.lbl_detail.text = "描述:";
//
// ckb_isinterface
//
this.ckb_isinterface.location = new system.drawing.point(104, 72);
this.ckb_isinterface.name = "ckb_isinterface";
this.ckb_isinterface.size = new system.drawing.size(24, 24);
this.ckb_isinterface.tabindex = 11;
//
// btn_confirm
//
this.btn_confirm.backgroundimage = ((system.drawing.image)(resources.getobject("btn_confirm.backgroundimage")));
this.btn_confirm.location = new system.drawing.point(40, 240);
this.btn_confirm.name = "btn_confirm";
this.btn_confirm.size = new system.drawing.size(64, 22);
this.btn_confirm.tabindex = 12;
this.btn_confirm.text = "確 定";
this.btn_confirm.click += new system.eventhandler(this.btn_confirm_click);
//
// btn_cancel
//
this.btn_cancel.backgroundimage = ((system.drawing.image)(resources.getobject("btn_cancel.backgroundimage")));
this.btn_cancel.location = new system.drawing.point(128, 240);
this.btn_cancel.name = "btn_cancel";
this.btn_cancel.size = new system.drawing.size(64, 22);
this.btn_cancel.tabindex = 13;
this.btn_cancel.text = "取 消";
this.btn_cancel.click += new system.eventhandler(this.btn_cancel_click);
//
// btn_help
//
this.btn_help.backgroundimage = ((system.drawing.image)(resources.getobject("btn_help.backgroundimage")));
this.btn_help.location = new system.drawing.point(216, 240);
this.btn_help.name = "btn_help";
this.btn_help.size = new system.drawing.size(64, 22);
this.btn_help.tabindex = 14;
this.btn_help.text = "幫 助";
//
// lbl_isinterface
//
this.lbl_isinterface.location = new system.drawing.point(32, 80);
this.lbl_isinterface.name = "lbl_isinterface";
this.lbl_isinterface.size = new system.drawing.size(72, 23);
this.lbl_isinterface.tabindex = 15;
this.lbl_isinterface.text = "有無界面:";
//
// txt_funentity
//
this.txt_funentity.forecolor = system.drawing.color.fromargb(((system.byte)(30)), ((system.byte)(66)), ((system.byte)(94)));
this.txt_funentity.location = new system.drawing.point(104, 136);
this.txt_funentity.name = "txt_funentity";
this.txt_funentity.size = new system.drawing.size(152, 21);
this.txt_funentity.tabindex = 16;
this.txt_funentity.text = "";
//
// sm_editfunction
//
this.autoscalebasesize = new system.drawing.size(6, 14);
this.backcolor = system.drawing.color.fromargb(((system.byte)(242)), ((system.byte)(247)), ((system.byte)(250)));
this.clientsize = new system.drawing.size(320, 273);
this.controls.add(this.txt_funentity);
this.controls.add(this.lbl_isinterface);
this.controls.add(this.btn_help);
this.controls.add(this.btn_cancel);
this.controls.add(this.btn_confirm);
this.controls.add(this.ckb_isinterface);
this.controls.add(this.lbl_detail);
this.controls.add(this.txt_detail);
this.controls.add(this.txt_belongto);
this.controls.add(this.cbo_type);
this.controls.add(this.txt_tag);
this.controls.add(this.txt_name);
this.controls.add(this.lbl_belongto);
this.controls.add(this.lbl_funentity);
this.controls.add(this.lbl_type);
this.controls.add(this.lbl_tag);
this.controls.add(this.lbl_name);
this.forecolor = system.drawing.color.fromargb(((system.byte)(30)), ((system.byte)(66)), ((system.byte)(94)));
this.icon = ((system.drawing.icon)(resources.getobject("$this.icon")));
this.name = "sm_editfunction";
this.startposition = system.windows.forms.formstartposition.centerscreen;
this.text = "修改功能";
this.resumelayout(false);

}
#endregion

/// <summary>
/// 按確定按鈕后,先檢查輸入的數(shù)據(jù)的合法性;接著生成一個functiontable類的實例
/// 并根據(jù)輸入進行 相應的賦值,接著調(diào)用updatefuncitem過程對功能表進行相應的修改
/// </summary>
private void btn_confirm_click(object sender, system.eventargs e)
{
if(txt_name.text=="")
{
messagebox.show("功能名稱不能為空");
return;
}
if(txt_tag.text=="")
{
messagebox.show("功能標識不能為空");
return;
}
if(this.txt_funentity.text=="")
{
messagebox.show("功能體不能為空");
return;
}
newfuncitem=new functiontable();
newfuncitem.funcname=txt_name.text.trim();
newfuncitem.functag=txt_tag.text.trim();
if(this.ckb_isinterface.checked==true)
{
newfuncitem.funcisinterface="1";
}
else
{
newfuncitem.funcisinterface="0";
}
newfuncitem.functype=this.cbo_type.selectedvalue.tostring().trim();
newfuncitem.funcentity=this.txt_funentity.text.trim();
newfuncitem.funcbelongto=this.txt_belongto.text.trim();
newfuncitem.funcdetail=this.txt_detail.text.trim();
newfuncitem.funcisexpand=orifuncitem.funcisexpand;
newfuncitem.funcver=orifuncitem.funcver;
newfuncitem.funcid=orifuncitem.funcid;
newfuncitem.funcfatherid=orifuncitem.funcfatherid;
updatefuncitem(newfuncitem);
isedit=true;
this.close();

}

/// <summary>
/// 對功能表進行修改,利用了回滾功能,即如果修改不成功則功能表
/// 恢復為修改前的狀態(tài)
/// </summary>
/// <param name="newitem">要修改的新的紀錄信息</param>
private void updatefuncitem(functiontable newitem)
{
functableconn.open();
system.data.oracleclient.oracletransaction mytran = functableconn.begintransaction ();
try
{
oraclecommand cmd = new oraclecommand ();
cmd.commandtext ="update 功能 set 功能標識='"+newitem.functag
+"', 功能名稱='"+newitem.funcname
+"', 功能簡述='"+newitem.funcdetail
+"', 所屬窗體='"+newitem.funcbelongto
+"', 有無界面='"+newitem.funcisinterface
+"', 功能類別='"+newitem.functype
+"', 功能體='"+newitem.funcentity
+"', 上級功能id='"+newitem.funcfatherid
+"', 可否展顯='"+newitem.funcisexpand
+"', 版本號='"+newitem.funcver
+"' where 功能id = '"+newitem.funcid+"'";
cmd.transaction = mytran;
cmd.connection =functableconn;
cmd.executenonquery ();
mytran.commit ();
}
catch(exception ee)
{
try
{
mytran.rollback();
}
catch (oracleexception ex)
{
if (mytran.connection != null)
{
messagebox.show ("在回滾時發(fā)生 " + ex.gettype() +" 異常!",
"警告",system.windows.forms.messageboxbuttons.ok,
system.windows.forms.messageboxicon.warning);
}
}

messagebox.show ("發(fā)生" + ee.gettype() +
"異常/n" +"修改記錄失敗!","警告",system.windows.forms.messageboxbuttons.ok,
system.windows.forms.messageboxicon.warning);
}
finally
{
functableconn.close();
}
}

private void btn_cancel_click(object sender, system.eventargs e)
{
//用戶點擊了取消鍵,則表示沒有進行修改
isedit=false;
this.close();
}

}
}



商業(yè)源碼熱門下載www.html.org.cn

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 澳门| 砚山县| 武清区| 金塔县| 岑巩县| 东安县| 阳曲县| 墨脱县| 长宁县| 阿克| SHOW| 桂东县| 五原县| 林西县| 临海市| 舟山市| 平顶山市| 桃园市| 普洱| 浏阳市| 且末县| 嘉善县| 阜宁县| 宁强县| 福安市| 德庆县| 巩留县| 宜昌市| 大厂| 甘谷县| 珠海市| 连云港市| 宝清县| 池州市| 格尔木市| 视频| 隆化县| 万山特区| 南陵县| 堆龙德庆县| 宜都市|