예제 #1
0
 public int AddTreeNode(SysNode model)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("insert into SA_Tree(");
     builder.Append("TreeText,ParentID,Location,OrderID,comment,Url,PermissionID,ImageUrl,TreeType,Enabled)");
     builder.Append(" values (");
     builder.Append("@TreeText,@ParentID,@Location,@OrderID,@comment,@Url,@PermissionID,@ImageUrl,@TreeType,@Enabled)");
     SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@TreeText", SqlDbType.NVarChar, 100), new SqlParameter("@ParentID", SqlDbType.Int, 4), new SqlParameter("@Location", SqlDbType.NVarChar, 50), new SqlParameter("@OrderID", SqlDbType.Int, 4), new SqlParameter("@comment", SqlDbType.NVarChar, 50), new SqlParameter("@Url", SqlDbType.NVarChar, 100), new SqlParameter("@PermissionID", SqlDbType.Int, 4), new SqlParameter("@ImageUrl", SqlDbType.NVarChar, 100), new SqlParameter("@TreeType", SqlDbType.SmallInt), new SqlParameter("@Enabled", SqlDbType.Bit) };
     cmdParms[0].Value = model.TreeText;
     cmdParms[1].Value = model.ParentID;
     cmdParms[2].Value = model.Location;
     cmdParms[3].Value = model.OrderID;
     cmdParms[4].Value = model.Comment;
     cmdParms[5].Value = model.Url;
     cmdParms[6].Value = model.PermissionID;
     cmdParms[7].Value = model.ImageUrl;
     cmdParms[8].Value = model.TreeType;
     cmdParms[9].Value = model.Enabled;
     object single = DbHelperSQL.GetSingle(builder.ToString(), cmdParms);
     if (single == null)
     {
         return 1;
     }
     return Convert.ToInt32(single);
 }
예제 #2
0
파일: SysTree.cs 프로젝트: bookxiao/orisoft
        public int AddTreeNode(SysNode model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into SA_Tree(");
            strSql.Append("TreeText,ParentID,Location,OrderID,comment,Url,PermissionID,ImageUrl)");
            strSql.Append(" values (");
            strSql.Append("@TreeText,@ParentID,@Location,@OrderID,@comment,@Url,@PermissionID,@ImageUrl)");
            SqlParameter[] parameters = {
                                            new SqlParameter("@TreeText", SqlDbType.VarChar,100),
                                            new SqlParameter("@ParentID", SqlDbType.Int,4),
                                            new SqlParameter("@Location", SqlDbType.VarChar,50),
                                            new SqlParameter("@OrderID", SqlDbType.Int,4),
                                            new SqlParameter("@comment", SqlDbType.VarChar,50),
                                            new SqlParameter("@Url", SqlDbType.VarChar,100),
                                            new SqlParameter("@PermissionID", SqlDbType.Int,4),
                                            new SqlParameter("@ImageUrl", SqlDbType.VarChar,100)};

            parameters[0].Value = model.TreeText;
            parameters[1].Value = model.ParentID;
            parameters[2].Value = model.Location;
            parameters[3].Value = model.OrderID;
            parameters[4].Value = model.Comment;
            parameters[5].Value = model.Url;
            parameters[6].Value = model.PermissionID;
            parameters[7].Value = model.ImageUrl;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
예제 #3
0
        public int AddTreeNode(SysNode node)
        {
            node.NodeID=GetMaxId();

            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into SA_Tree(");
            strSql.Append("NodeID,Text,ParentID,Location,OrderID,comment,Url,PermissionID,ImageUrl)");
            strSql.Append(" values (");
            strSql.Append("'"+node.NodeID+"',");
            strSql.Append("'"+node.Text+"',");
            strSql.Append(""+node.ParentID+",");
            strSql.Append("'"+node.Location+"',");
            strSql.Append(""+node.OrderID+",");
            strSql.Append("'"+node.Comment+"',");
            strSql.Append("'"+node.Url+"',");
            strSql.Append(""+node.PermissionID+",");
            strSql.Append("'"+node.ImageUrl+"'");
            //			strSql.Append(""+node.ModuleID+",");
            //			strSql.Append(""+node.KeShiDM+",");
            //			strSql.Append("'"+node.KeshiPublic+"'");
            strSql.Append(")");
            DbHelperSQL.ExecuteSql(strSql.ToString());
            return node.NodeID;
        }
예제 #4
0
 public int AddTreeNode(SysNode node)
 {
     return this.dal.AddTreeNode(node);
 }
예제 #5
0
 public void UpdateNode(SysNode node)
 {
     this.dal.UpdateNode(node);
 }
예제 #6
0
파일: SysTree.cs 프로젝트: bookxiao/orisoft
        public void UpdateNode(SysNode model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update SA_Tree set ");
            strSql.Append("TreeText=@TreeText,");
            strSql.Append("ParentID=@ParentID,");
            strSql.Append("Location=@Location,");
            strSql.Append("OrderID=@OrderID,");
            strSql.Append("comment=@comment,");
            strSql.Append("Url=@Url,");
            strSql.Append("PermissionID=@PermissionID,");
            strSql.Append("ImageUrl=@ImageUrl");
            strSql.Append(" where NodeID=@NodeID");

            SqlParameter[] parameters = {
                                            new SqlParameter("@NodeID", SqlDbType.Int,4),
                                            new SqlParameter("@TreeText", SqlDbType.VarChar,100),
                                            new SqlParameter("@ParentID", SqlDbType.Int,4),
                                            new SqlParameter("@Location", SqlDbType.VarChar,50),
                                            new SqlParameter("@OrderID", SqlDbType.Int,4),
                                            new SqlParameter("@comment", SqlDbType.VarChar,50),
                                            new SqlParameter("@Url", SqlDbType.VarChar,100),
                                            new SqlParameter("@PermissionID", SqlDbType.Int,4),
                                            new SqlParameter("@ImageUrl", SqlDbType.VarChar,100)};
            parameters[0].Value = model.NodeID;
            parameters[1].Value = model.TreeText;
            parameters[2].Value = model.ParentID;
            parameters[3].Value = model.Location;
            parameters[4].Value = model.OrderID;
            parameters[5].Value = model.Comment;
            parameters[6].Value = model.Url;
            parameters[7].Value = model.PermissionID;
            parameters[8].Value = model.ImageUrl;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
예제 #7
0
파일: SysTree.cs 프로젝트: bookxiao/orisoft
        /// <summary>
        /// Get Menu Node
        /// </summary>
        /// <param name="NodeID"></param>
        /// <returns></returns>
        public SysNode GetNode(int NodeID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * from SA_Tree ");
            strSql.Append(" where NodeID=@NodeID");

            SqlParameter[] parameters = {
                                            new SqlParameter("@NodeID", SqlDbType.Int,4)
                                        };
            parameters[0].Value = NodeID;

            SysNode node = new SysNode();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                node.NodeID = int.Parse(ds.Tables[0].Rows[0]["NodeID"].ToString());
                node.TreeText = ds.Tables[0].Rows[0]["TreeText"].ToString();
                if (ds.Tables[0].Rows[0]["ParentID"].ToString() != "")
                {
                    node.ParentID = int.Parse(ds.Tables[0].Rows[0]["ParentID"].ToString());
                }
                node.Location = ds.Tables[0].Rows[0]["Location"].ToString();
                if (ds.Tables[0].Rows[0]["OrderID"].ToString() != "")
                {
                    node.OrderID = int.Parse(ds.Tables[0].Rows[0]["OrderID"].ToString());
                }
                node.Comment = ds.Tables[0].Rows[0]["comment"].ToString();
                node.Url = ds.Tables[0].Rows[0]["url"].ToString();
                if (ds.Tables[0].Rows[0]["PermissionID"].ToString() != "")
                {
                    node.PermissionID = int.Parse(ds.Tables[0].Rows[0]["PermissionID"].ToString());
                }
                node.ImageUrl = ds.Tables[0].Rows[0]["ImageUrl"].ToString();

                return node;
            }
            else
            {
                return null;
            }
        }
예제 #8
0
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            string id = Maticsoft.Common.PageValidate.InputText(this.lblID.Text, 10);
            string orderid = Maticsoft.Common.PageValidate.InputText(this.txtOrderid.Text, 5);
            string treeText = txtTreeText.Text;
            string url = Maticsoft.Common.PageValidate.InputText(txtUrl.Text, 100);
            //string imgUrl=Maticsoft.Common.PageValidate.InputText(txtImgUrl.Text,100);
            string imgUrl = this.hideimgurl.Value;
            string target = this.listTarget.SelectedValue;
            int parentid = int.Parse(target);

            string strErr = "";

            if (orderid.Trim() == "")
            {
                strErr += "编号不能为空\\n";
            }
            try
            {
                int.Parse(orderid);
            }
            catch
            {
                strErr += "编号格式不正确\\n";
            }
            if (treeText.Trim() == "")
            {
                strErr += "名称不能为空\\n";
            }
            if (this.listPermission.SelectedItem.Text.StartsWith("╋"))
            {
                strErr += "权限类别不能做权限使用\\n";
            }
            if (strErr != "")
            {
                Maticsoft.Common.MessageBox.Show(this, strErr);
                return;
            }

            int permission_id = -1;
            if (this.listPermission.SelectedIndex > 0)
            {
                permission_id = int.Parse(this.listPermission.SelectedValue);
            }
            int moduleid = -1;

            //if (this.dropModule.SelectedIndex > 0)
            //{
            //    moduleid = int.Parse(this.dropModule.SelectedValue);
            //}
            //int moduledeptid = -1;
            //if (this.dropModuleDept.SelectedIndex > 0)
            //{
            //    moduledeptid = int.Parse(this.dropModuleDept.SelectedValue);
            //}
            int keshidm = -1;
            //if (this.Dropdepart.SelectedIndex > 0)
            //{
            //    keshidm = int.Parse(this.Dropdepart.SelectedValue);
            //}
            string keshipublic = "false";

            //if (this.chkPublic.Checked)
            //{
            //    keshipublic = "true";
            //}
            string comment = Maticsoft.Common.PageValidate.InputText(txtDescription.Text, 100);

            SysNode node = new SysNode();
            node.NodeID = int.Parse(id);
            node.OrderID = int.Parse(orderid);
            node.TreeText = treeText;
            node.ParentID = parentid;
            node.Location = parentid + "." + orderid;
            node.Comment = comment;
            node.Url = url;
            node.PermissionID = permission_id;
            node.ImageUrl = imgUrl;
            node.ModuleID = moduleid;
            node.KeShiDM = keshidm;
            node.KeshiPublic = keshipublic;

            Maticsoft.BLL.SysManage.SysTree sm = new Maticsoft.BLL.SysManage.SysTree();
            sm.UpdateNode(node);
            Response.Redirect("show.aspx?id=" + id);
        }
예제 #9
0
 public void UpdateNode(SysNode model)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("update SA_Tree set ");
     builder.Append("TreeText=@TreeText,");
     builder.Append("ParentID=@ParentID,");
     builder.Append("Location=@Location,");
     builder.Append("OrderID=@OrderID,");
     builder.Append("comment=@comment,");
     builder.Append("Url=@Url,");
     builder.Append("PermissionID=@PermissionID,");
     builder.Append("ImageUrl=@ImageUrl,");
     builder.Append("TreeType=@TreeType,");
     builder.Append("Enabled=@Enabled");
     builder.Append(" where NodeID=@NodeID");
     SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@NodeID", SqlDbType.Int, 4), new SqlParameter("@TreeText", SqlDbType.NVarChar, 100), new SqlParameter("@ParentID", SqlDbType.Int, 4), new SqlParameter("@Location", SqlDbType.NVarChar, 50), new SqlParameter("@OrderID", SqlDbType.Int, 4), new SqlParameter("@comment", SqlDbType.NVarChar, 50), new SqlParameter("@Url", SqlDbType.NVarChar, 100), new SqlParameter("@PermissionID", SqlDbType.Int, 4), new SqlParameter("@ImageUrl", SqlDbType.NVarChar, 100), new SqlParameter("@TreeType", SqlDbType.SmallInt), new SqlParameter("@Enabled", SqlDbType.Bit) };
     cmdParms[0].Value = model.NodeID;
     cmdParms[1].Value = model.TreeText;
     cmdParms[2].Value = model.ParentID;
     cmdParms[3].Value = model.Location;
     cmdParms[4].Value = model.OrderID;
     cmdParms[5].Value = model.Comment;
     cmdParms[6].Value = model.Url;
     cmdParms[7].Value = model.PermissionID;
     cmdParms[8].Value = model.ImageUrl;
     cmdParms[9].Value = model.TreeType;
     cmdParms[10].Value = model.Enabled;
     DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms);
 }
예제 #10
0
 public SysNode GetNode(int NodeID)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("select * from SA_Tree ");
     builder.Append(" where NodeID=@NodeID");
     SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@NodeID", SqlDbType.Int, 4) };
     cmdParms[0].Value = NodeID;
     SysNode node = new SysNode();
     DataSet set = DbHelperSQL.Query(builder.ToString(), cmdParms);
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     node.NodeID = int.Parse(set.Tables[0].Rows[0]["NodeID"].ToString());
     node.TreeText = set.Tables[0].Rows[0]["TreeText"].ToString();
     if (set.Tables[0].Rows[0]["ParentID"].ToString() != "")
     {
         node.ParentID = int.Parse(set.Tables[0].Rows[0]["ParentID"].ToString());
     }
     node.Location = set.Tables[0].Rows[0]["Location"].ToString();
     if (set.Tables[0].Rows[0]["OrderID"].ToString() != "")
     {
         node.OrderID = new int?(int.Parse(set.Tables[0].Rows[0]["OrderID"].ToString()));
     }
     node.Comment = set.Tables[0].Rows[0]["comment"].ToString();
     node.Url = set.Tables[0].Rows[0]["url"].ToString();
     if (set.Tables[0].Rows[0]["PermissionID"].ToString() != "")
     {
         node.PermissionID = int.Parse(set.Tables[0].Rows[0]["PermissionID"].ToString());
     }
     node.ImageUrl = set.Tables[0].Rows[0]["ImageUrl"].ToString();
     node.TreeType = int.Parse(set.Tables[0].Rows[0]["TreeType"].ToString());
     node.Enabled = bool.Parse(set.Tables[0].Rows[0]["Enabled"].ToString());
     return node;
 }
예제 #11
0
 public void UpdateNode(SysNode node)
 {
     StringBuilder strSql=new StringBuilder();
     strSql.Append("update SA_Tree set ");
     strSql.Append("Text='"+node.Text+"',");
     strSql.Append("ParentID="+node.ParentID.ToString()+",");
     strSql.Append("Location='"+node.Location+"',");
     strSql.Append("OrderID="+node.OrderID+",");
     strSql.Append("comment='"+node.Comment+"',");
     strSql.Append("Url='"+node.Url+"',");
     strSql.Append("PermissionID="+node.PermissionID+",");
     strSql.Append("ImageUrl='"+node.ImageUrl+"'");
     //			strSql.Append("ModuleID="+node.ModuleID+",");
     //			strSql.Append("KeShiDM="+node.KeShiDM+",");
     //			strSql.Append("KeshiPublic='"+node.KeshiPublic+"'");
     strSql.Append(" where NodeID="+node.NodeID);
     DbHelperSQL.ExecuteSql(strSql.ToString());
 }
예제 #12
0
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            string orderid = Maticsoft.Common.PageValidate.InputText(txtOrderid.Text, 10);
            string name = txtName.Text;
            string url = Maticsoft.Common.PageValidate.InputText(txtUrl.Text, 100);
            //string imgUrl=Maticsoft.Common.PageValidate.InputText(txtImgUrl.Text,100);
            string imgUrl = this.hideimgurl.Value;

            string target = this.listTarget.SelectedValue;
            int parentid = int.Parse(target);

            string strErr = "";

            if (orderid.Trim() == "")
            {
                strErr += "编号不能为空\\n";
            }
            try
            {
                int.Parse(orderid);
            }
            catch
            {
                strErr += "编号格式不正确\\n";

            }
            if (name.Trim() == "")
            {
                strErr += "名称不能为空\\n";
            }

            //if (this.listPermission.SelectedItem.Text.StartsWith("╋"))
            //{
            //    strErr += "权限类别不能做权限使用\\n";
            //}

            if (strErr != "")
            {
                Maticsoft.Common.MessageBox.Show(this, strErr);
                return;
            }

            int permission_id = -1;
            if (UCDroplistPermission1.PermissionID > 0)
            {
                permission_id = UCDroplistPermission1.PermissionID;
            }

            int moduleid = -1;
            int keshidm = -1;
            string keshipublic = "false";
            string comment = Maticsoft.Common.PageValidate.InputText(txtDescription.Text, 100);

            SysNode node = new SysNode();
            node.TreeText = name;
            node.ParentID = parentid;
            node.Location = parentid + "." + orderid;
            node.OrderID = int.Parse(orderid);
            node.Comment = comment;
            node.Url = url;
            node.PermissionID = permission_id;
            node.ImageUrl = imgUrl;
            node.ModuleID = moduleid;
            node.KeShiDM = keshidm;
            node.KeshiPublic = keshipublic;
            Maticsoft.BLL.SysManage.SysTree sm = new Maticsoft.BLL.SysManage.SysTree();
            if (CheckBox1.Checked)
            {
                Maticsoft.Accounts.Bus.Permissions p = new Maticsoft.Accounts.Bus.Permissions();
                string permissionName = node.TreeText;
                int parentID = node.ParentID;
                if (parentID == 0)
                {
                    //根目录下不能选择同步创建权限
                    Maticsoft.Common.MessageBox.Show(this.Page, "根目录不能选择同步创建权限,请您手动创建!");
                    return;
                }
                SysNode parentNode = new SysNode();
                parentNode = sm.GetNode(parentID);
                int catalogID = sm.GetPermissionCatalogID(parentNode.PermissionID);
                int permissionID = p.Create(catalogID, permissionName);
                node.PermissionID = permissionID;
            }
            sm.AddTreeNode(node);
            lblMsg.Text = Resources.Site.TooltipSaveOK;
            if (chkAddContinue.Checked)
            {
                txtOrderid.Text = "";
                txtName.Text = "";
                txtUrl.Text = "";
                txtImgUrl.Text = "";
                txtDescription.Text = "";
            }
            else
            {
                Response.Redirect("treelist.aspx");
            }
        }