using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
using Pub_Class;
|
|
namespace OAM
|
{
|
public partial class frm_ModlueEdit : Form
|
{
|
public string sCondition; //¹ýÂËÌõ¼þ
|
TreeNode CurNode = new TreeNode();
|
public frm_ModlueEdit()
|
{
|
InitializeComponent();
|
}
|
|
|
//¼ÓÔØÊ÷ÐÎ
|
public static void LoadTree(TreeView tv, ImageList imageList1, string Text)//Lock
|
{
|
try
|
{
|
tv.Nodes.Clear();
|
tv.ImageList = imageList1;
|
TreeNode sNode = tv.Nodes.Add("T0", Text, 0, 1);
|
LoadAllNodes(sNode);
|
}
|
catch (Exception e)
|
{
|
MessageBox.Show("¼ÓÔØÊ÷ÐÍʧ°Ü£¡" + e.Message, "Ìáʾ");
|
}
|
}
|
public static void LoadAllNodes(TreeNode sNode) //huan
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
if (sNode != null)
|
{
|
try
|
{
|
string BillName2 = "OA_UserModule";
|
long sName = Convert.ToInt64(sNode.Name.Substring(1, sNode.Name.Length - 1));
|
sNode.Nodes.Clear();
|
DataSet Ds = oCn.RunProcReturn("select FileName,ModuleID,FileCode,isgroup from OA_UserModule where parentid='" + sName + "' and username='" + DBUtility.ClsPub.CurUserName + "' order by ModuleID", "OA_UserModule", ref ClsPub.sExeReturnInfo);
|
for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
|
{
|
TreeNode oNode = sNode.Nodes.Add("T" + Ds.Tables[0].Rows[i]["ModuleID"].ToString(), Ds.Tables[0].Rows[i]["FileName"].ToString(), 0, 1);
|
}
|
sNode.Expand();
|
}
|
catch (Exception e)
|
{
|
MessageBox.Show("¼ÓÔØ×ÓÏîĿʧ°Ü£¡" + e.Message, "Ìáʾ");
|
}
|
}
|
|
}
|
private void cmdOk2_Click(object sender, EventArgs e)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
if (CurNode.Text == "")
|
{
|
MessageBox.Show("δѡÖÐÕýÈ·µÄÏî");
|
|
}
|
else
|
{
|
string parentid = CurNode.Name.Substring(1);
|
if (DBUtility.ClsPub.isStrNull(txtFilePath.Text) == "")
|
{
|
MessageBox.Show("Èí¼þ·¾¶²»ÄÜΪ¿Õ£¡", "Ìáʾ");
|
return;
|
}
|
if (DBUtility.ClsPub.isStrNull(txtFileName2.Text) == "")
|
{
|
MessageBox.Show("Èí¼þÃû³Æ²»ÄÜΪ¿Õ£¡", "Ìáʾ");
|
return;
|
}
|
oCn.RunProc("Insert into OA_UserModule " +
|
" (FileName,parentid,UserName,FileCode,isgroup,prjname) " +
|
" Values('" + txtFileName2.Text.Trim() + "','" + parentid + "','" + Pub_Class.ClsPub.CurUserName + "','" + txtFilePath.Text.Trim() + "'," + 0 + ",'" + "" + "')", ref DBUtility.ClsPub.sExeReturnInfo);
|
|
LoadTree(TreeView, imageList1, this.Text);
|
MessageBox.Show("ÐÂÔö³É¹¦");
|
}
|
}
|
|
private void cmdFilePath_Click(object sender, EventArgs e)
|
{
|
OpenFileDialog fileDialog = new OpenFileDialog();
|
fileDialog.Multiselect = true;
|
fileDialog.Title = "ÇëÑ¡ÔñÎļþ";
|
fileDialog.Filter = "ËùÓÐÎļþ(*.*)|*.*";
|
if (fileDialog.ShowDialog() == DialogResult.OK)
|
{
|
txtFilePath.Text = fileDialog.FileName;
|
}
|
}
|
|
private void cmdCanCel2_Click(object sender, EventArgs e)
|
{
|
this.Close();
|
}
|
|
private void jz_Click(object sender, EventArgs e)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
if (DBUtility.ClsPub.isStrNull(txtName.Text) == "")
|
{
|
MessageBox.Show("Ìí¼Ó×éÃû²»ÄÜΪ¿Õ£¡", "Ìáʾ");
|
return;
|
|
}
|
else
|
{
|
if (CurNode.Name == "")
|
{
|
|
MessageBox.Show("δѡÖÐÕýÈ·µÄÏî");
|
}
|
else
|
{
|
|
string parentid = CurNode.Name.Substring(1);
|
DialogResult dr = MessageBox.Show("È·¶¨ÒªÔÚ¡¾" + CurNode.Text + "¡¿ÏÂÌí¼ÓÒ»¸öÃûΪ¡¾" + txtName.Text + "¡¿µÄÐÂ×éÂð£¿", "Ìáʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
if (dr == DialogResult.Yes)
|
{
|
oCn.RunProc("Insert into OA_UserModule " +
|
" (FileName,parentid,UserName,FileCode,isgroup,prjname) " +
|
" Values('" + txtName.Text.Trim() + "','" + parentid + "','" + Pub_Class.ClsPub.CurUserName + "','" + "" + "'," + 0 + ",'" + "" + "')", ref DBUtility.ClsPub.sExeReturnInfo);
|
|
LoadTree(TreeView, imageList1, this.Text);
|
MessageBox.Show("ÐÂÔö³É¹¦");
|
}
|
else
|
{
|
}
|
|
}
|
}
|
}
|
|
private void frm_ModlueEdit_Load(object sender, EventArgs e)
|
{
|
txtEmp.Text = Pub_Class.ClsPub.CurUserName;
|
LoadTree(TreeView, imageList1, this.Text);
|
}
|
|
private void TreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
|
{
|
CurNode = e.Node;
|
if (CurNode != null)
|
{
|
if (CurNode.Nodes.Count == 0)
|
LoadAllNodes(CurNode);
|
//ÕÒµ½Ñ¡Öнáµã
|
}
|
}
|
|
private void sz_Click(object sender, EventArgs e)
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
if (CurNode != null)
|
{
|
if (CurNode.Name == "T0")
|
{
|
|
MessageBox.Show("´Ë½Úµã²»¿Éɾ³ý£¡");
|
}
|
else
|
{
|
DialogResult dr = MessageBox.Show("È·¶¨ÒªÉ¾³ý´ËĿ¼Âð£¿", "Ìáʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
if (dr == DialogResult.Yes)
|
{
|
string parentid = CurNode.Name.Substring(1);
|
oCn.RunProc("DELETE FROM OA_UserModule WHERE ModuleID =" + parentid + " ", ref DBUtility.ClsPub.sExeReturnInfo);
|
LoadTree(TreeView, imageList1, this.Text);
|
MessageBox.Show("×é" + "¡¾" + CurNode.Text + "¡¿" + "ÒÑɾ³ý");
|
}
|
else
|
{
|
}
|
}
|
}
|
else
|
{
|
MessageBox.Show("δѡÖÐÕýÈ·µÄÏî");
|
}
|
}
|
|
private void tc_Click(object sender, EventArgs e)
|
{
|
this.Close();
|
}
|
|
|
|
|
}
|
}
|