/// <summary> /// 메뉴 부모,자식 추가 /// </summary> /// <param name="parent"></param> /// <param name="son"></param> /// <returns></returns> public bool InsertMenuTree_Master_VO(MenuTree_Master_VO menu) { using (SqlCommand comm = new SqlCommand()) { comm.Connection = new SqlConnection(Connstr); comm.CommandText = "InsertMenuTree_Master_VO"; comm.CommandType = CommandType.StoredProcedure; comm.Parameters.AddWithValue("@Parent_Screen_Code", menu.Parent_Screen_Code); comm.Parameters.AddWithValue("@Screen_Code", menu.Screen_Code); comm.Parameters.AddWithValue("@Screen_Name", menu.Screen_Name); comm.Parameters.AddWithValue("@Ins_Emp", menu.Ins_Emp); comm.Connection.Open(); int result = comm.ExecuteNonQuery(); comm.Connection.Close(); if (result > 0) { return(true); } else { return(false); } } }
private void TvBookMark_DoubleClick(object sender, EventArgs e) { try { if (tvBookMark.SelectedNode.Text != null) { MenuTree_Master_VO parentcode = menulist.Find(item => item.Screen_Name == tvBookMark.SelectedNode.Text); if (parentcode.Parent_Screen_Code != null) //부모코드에 널값이있는 메뉴를 제외하고 { string form = parentcode.Screen_Code; newForm(form, tvBookMark.SelectedNode.Text); } } } catch { } }
private void AButton1_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(txtparentcode.Text) && !string.IsNullOrEmpty(txtparentname.Text)) { MenuTree_Master_VO additem = new MenuTree_Master_VO() { Parent_Screen_Code = "0", Screen_Code = txtparentcode.Text, Screen_Name = txtparentname.Text, Ins_Date = Convert.ToDateTime(lblday2.Text), Ins_Emp = lblemp2.Text }; if (service.InsertMenuTree_Master_VO(additem)) { MessageBox.Show("저장 완료", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("이미 등록된 검사항목입니다.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else { MessageBox.Show("필수 항목을 입력하세요.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception err) { MessageBox.Show(err.ToString(), "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); Program.Log.WriteError(err.Message); } }
/// <summary> /// 메뉴선택시 메뉴하위목록 트리뷰로 생성 /// </summary> /// <param name="btnname"></param> private void CreateMenuTree(string btnname) { try { if (menulist.Count > 0) { MenuTree_Master_VO parentcode = menulist.Find(item => item.Screen_Name == btnname); //부모코드find List <MenuTree_Master_VO> menu = menulist.FindAll(item => item.Parent_Screen_Code == parentcode.Screen_Code); //부모코드랑관련자녀메뉴 tvMenu.Nodes.Clear(); tvMenu.Nodes.Add(parentcode.Screen_Name); for (int i = 0; i < menu.Count; i++) { tvMenu.TopNode.Nodes.Add(menu[i].Screen_Name); } tvMenu.ExpandAll(); } } catch (Exception err) { MessageBox.Show(err.ToString()); } }
private void 즐겨찾기ToolStripMenuItem_Click(object sender, EventArgs e) { MainForm_Service service = new MainForm_Service(); MenuTree_Master_VO parentname = menulist.Find(item => item.Screen_Name == tvMenu.SelectedNode.Text);//부모코드find BookMark_VO bookmark = new BookMark_VO(); bookmark.Parent_Screen_Code = parentname.Parent_Screen_Code; bookmark.Screen_Code = parentname.Screen_Code; bookmark.User_ID = UserInfo.User_ID; bookmark.Type = parentname.Screen_Name; if (!string.IsNullOrEmpty(parentname.Parent_Screen_Code)) { if (!service.InsertBookMark(bookmark)) { MessageBox.Show("이미등록된 항목입니다.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { tvBookMark.Nodes.Clear(); booklist = service.GetAll_BookMark(UserInfo.User_ID); tvBookMark.Nodes.Add("즐겨찾기"); for (int i = 0; i < booklist.Count; i++) { tvBookMark.TopNode.Nodes.Add(booklist[i].Type); } tvBookMark.ExpandAll(); } } else { MessageBox.Show("등록할 수 없는 항목입니다.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 메뉴 부모,자식 추가 /// </summary> /// <param name="parent"></param> /// <param name="son"></param> /// <returns></returns> public bool InsertMenuTree_Master_VO(MenuTree_Master_VO menu) { MainForm_DAC dac = new DAC.MainForm_DAC(); return(dac.InsertMenuTree_Master_VO(menu)); }