Пример #1
0
 private void DiGui(TreeNode tn, string userName)
 {
     foreach (TreeNode tnSub in tn.ChildNodes)
     {
         if (tnSub.Checked)
         {
             T_WEBMANAGEROLEEntity MT = new T_WEBMANAGEROLEEntity();
             MT.ID       = Sequence.GetNextValue("SEQ_T_WEBMANAGEROLE");
             MT.USERNAME = userName;
             MT.NODEID   = int.Parse(tnSub.Value);
             MT.Save();
             GetParentID(userName, MT.NODEID.ToString());
         }
         DiGui(tnSub, userName);
     }
 }
Пример #2
0
    private void GetParentID(string username, string nodeid)
    {
        string    strSql = "SELECT PARENTID FROM T_NEWSNODE WHERE ID = " + nodeid;
        DataTable DT     = PersistenceLayer.Query.ProcessSql(strSql, Names.DBName);

        if (DT.Rows.Count > 0)
        {
            if (!ishasrole(DT.Rows[0][0].ToString()))
            {
                T_WEBMANAGEROLEEntity MT2 = new T_WEBMANAGEROLEEntity();
                MT2.ID       = Sequence.GetNextValue("SEQ_T_WEBMANAGEROLE");
                MT2.USERNAME = username;
                MT2.NODEID   = int.Parse(DT.Rows[0][0].ToString());
                MT2.Save();
            }
            GetParentID(username, DT.Rows[0][0].ToString());
        }
    }
Пример #3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (ishasuser())
        {
            MessageBox("该用户名已经存在,请重新输入!");
            return;
        }
        if (!StringOperate.IsCheckEngNumUnderLine(txtUserName.Text.Trim()))
        {
            MessageBox("用户名需由字母、数字或下划线组成,请重新输入!");
            return;
        }
        T_WEBMANAGEEntity FM = new T_WEBMANAGEEntity();

        FM.ID         = Sequence.GetNextValue("SEQ_T_WEBMANAGE");
        FM.USERNAME   = txtUserName.Text.Trim();
        FM.PASSWORD   = Names.EncryptPassword(txtPassword.Text.Trim());
        FM.TRUENAME   = txtTrueName.Text.Trim();
        FM.TELEPHONE  = txtTelephone.Text.Trim();
        FM.DEPT       = txtDept.Text.Trim();
        FM.CREATETIME = DateTime.Now;
        FM.STATUS     = 0;
        FM.Save();
        foreach (TreeNode n in trNode.Nodes)
        {
            if (n.Checked)
            {
                T_WEBMANAGEROLEEntity MT = new T_WEBMANAGEROLEEntity();
                MT.ID       = Sequence.GetNextValue("SEQ_T_WEBMANAGEROLE");
                MT.USERNAME = FM.USERNAME;
                MT.NODEID   = int.Parse(n.Value);
                MT.Save();
                GetParentID(FM.USERNAME, MT.NODEID.ToString());
            }
            DiGui(n, FM.USERNAME);
        }
        Response.Redirect("adminList.aspx");
    }
Пример #4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        T_WEBMANAGEEntity FM = new T_WEBMANAGEEntity();

        FM.ID = int.Parse(txtID.Text);
        FM.Retrieve();
        if (FM.IsPersistent)
        {
            //FM.USERNAME = txtUserName.Text.Trim();
            if (!txtVisPassword.Text.Trim().Equals(txtPassword.Text.Trim()))
            {
                FM.PASSWORD = Names.EncryptPassword(txtPassword.Text.Trim());
            }
            FM.TRUENAME   = txtTrueName.Text.Trim();
            FM.TELEPHONE  = txtTelephone.Text.Trim();
            FM.DEPT       = txtDept.Text.Trim();
            FM.CREATETIME = DateTime.Now;
            FM.STATUS     = 0;
            FM.Save();
            string strSql = "DELETE FROM T_WEBMANAGEROLE WHERE USERNAME = '******'";
            PersistenceLayer.Query.ProcessSqlNonQuery(strSql, Names.DBName);
            foreach (TreeNode n in trNode.Nodes)
            {
                if (n.Checked)
                {
                    T_WEBMANAGEROLEEntity MT = new T_WEBMANAGEROLEEntity();
                    MT.ID       = Sequence.GetNextValue("SEQ_T_WEBMANAGEROLE");
                    MT.USERNAME = FM.USERNAME;
                    MT.NODEID   = int.Parse(n.Value);
                    MT.Save();
                    GetParentID(FM.USERNAME, MT.NODEID.ToString());
                }
                DiGui(n, FM.USERNAME);
            }
            Response.Redirect("adminList.aspx");
        }
    }