private void simpleButton1_Click(object sender, EventArgs e) { try { string strErr = ""; if (!SmmuserRule.Check(DataObject, ref strErr, isNew)) { MsgBox.Show(strErr); return; } if (tbDisableflg.Checked) { DataObject.Disableflg = "Y"; } else { DataObject.Disableflg = "N"; } DataObject.Lastlogon = imageComboBoxEdit1.SelectedIndex.ToString(); foreach (DictionaryEntry de in addgroupItems) { Smugroup data = new Smugroup(); data.Groupno = ((Smmgroup)de.Value).Groupno; data.Userid = tbUserid.Text; SmmprogService.Create <Smugroup>(data); } if (!isNew) { foreach (DictionaryEntry de in deletegroupItems) { SmmprogService.Delete <Smugroup>((Smugroup)de.Value); } } this.DialogResult = DialogResult.OK; } catch { MessageBox.Show("数据格式有误"); return; } DialogResult = DialogResult.OK; }
private void CreateView() { IList list = SmmprogService.GetList("SelectSmmprogByMeIco", null); DataTable dt_list = DataConverter.ToDataTable(list); treeView1.ImageList = ImageListRes.GetimageList(16, dt_list); treeView1.ImageList.Images.Add("Icsclient", imageList1.Images[1]); TreeNode node = treeView1.Nodes.Add("", "系统功能目录"); node.ImageKey = "Icsclient"; node.SelectedImageKey = "Icsclient"; VsmdgroupProg data = new VsmdgroupProg(); data.Groupno = groupno; data.ProgModuleType = moduleType; if (projectUID == string.Empty) { projectUID = ""; } data.ProjectUID = projectUID; try { SmmprogService.Create <VsmdgroupProg>(data); } catch (Exception e) {} smmprogTable = DataConverter.ToDataTable(SmmprogService.GetList("SelectSmmprogByModuleType", moduleType), typeof(Smmprog)); smmprogTable.DefaultView.Sort = "index"; //smdprogTable=DataConverter.ToDataTable(smmprogService.GetList("SelectVsmdgroupProgList",groupno),typeof(VsmdgroupProg)); VsmdgroupProg vsmdgroupProg = new VsmdgroupProg(); vsmdgroupProg.Groupno = groupno; vsmdgroupProg.ProgModuleType = moduleType; vsmdgroupProg.ProjectUID = projectUID; if (projectUID == "") { smdprogTable = DataConverter.ToDataTable(smmprogService.GetList("SelectVsmdgroupProgByModuleType", vsmdgroupProg), typeof(VsmdgroupProg)); } else { smdprogTable = DataConverter.ToDataTable(smmprogService.GetList("SelectVsmdgroupProgByProject", vsmdgroupProg), typeof(VsmdgroupProg)); } //除去那些在回收站内的模块 for (int i = 0; i < smdprogTable.Rows.Count; i++) { if (smdprogTable.Rows[i]["ParentId"].ToString() == "a5a6aa87-d87b-48ec-b58d-d05a0ea1c8ee" || smdprogTable.Rows[i]["ProgId"].ToString() == "a5a6aa87-d87b-48ec-b58d-d05a0ea1c8ee") { smdprogTable.Rows.Remove(smdprogTable.Rows[i]); i--; } } smdprogTable.DefaultView.Sort = "index"; groupRightsList1.dataGridView1.DataSource = smdprogTable; //////if(projectUID!="") ExpandNode(node, string.Empty); // node.Expand(); treeView1.ExpandAll(); }