日期:2014-05-17 浏览次数:20581 次
namespace Zznode.OA.Common.Data { /// <summary> /// DepData 的摘要说明。 /// </summary> public class DepData : DataSet { public const string STREET_FIELD = "Street"; public const string POSTCODE_FIELD = "PostCode"; public const string SORTORDER_FIELD = "SortOrder"; public const string NUMBER_FIELD = "AllowedEmpNumber"; [color=#FF0000]public const string DEPJG_FIELD = "Dep_JG";[/color] private void BuildTable() { cols.Add(STREET_FIELD,typeof(System.String)); cols.Add(POSTCODE_FIELD,typeof(System.String)); cols.Add(SORTORDER_FIELD, typeof(System.Int16)); cols.Add(NUMBER_FIELD, typeof(System.Int16)); [color=#FF0000]cols.Add(DEPJG_FIELD,typeof(System.String));[/color] Tables.Add(table); } public DepData() { BuildTable(); } } }
//创建部门 private void CreateNewDep() { DepData depData = new DepData(); DataTable depTB = depData.Tables[DepData.DEP_TABLE_NAME]; DataRow row = depTB.NewRow(); row[DepData.BRANCHID_FIELD] = Convert.ToInt32(lstBranch.SelectedItem.Value,10); row[DepData.DEPNAME_FIELD] = txtName.Text.ToString().Trim(); row[DepData.MANAGER_FIELD] = txtManager.Text.ToString().Trim(); row[DepData.TEL1_FIELD] = txtTel1.Text.ToString().Trim(); row[DepData.TEL2_FIELD] = txtTel2.Text.ToString().Trim(); row[DepData.FAX_FIELD] = txtFax.Text.ToString().Trim(); row[DepData.POSTCODE_FIELD] = txtPostCode.Text.ToString().Trim(); row[DepData.PROVINCE_FIELD] = txtProvince.Text.ToString().Trim(); row[DepData.CITY_FIELD] = txtCity.Text.ToString().Trim(); row[DepData.DISTRICT_FIELD] = txtDistrict.Text.ToString().Trim(); row[DepData.STREET_FIELD] = txtStreet.Text.ToString().Trim(); row[DepData.DEPJG_FIELD] = txtDep_XZ.Text.ToString().Trim(); depTB.Rows.Add(row); bool result = (new DepSystem()).CreateDep(depData); }