示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile  = Int32.Parse(Request.Cookies["profileid"].Value);
            oPermission = new Permissions(intProfile, dsn);
            oRole       = new NCC.ClearView.Application.Core.Roles(intProfile, dsn);
            oColor      = new ColorLevels();
            DataSet       ds = oRole.Gets(intProfile);
            int           intApplications = 0;
            string        strDefaultApp   = "";
            StringBuilder sb = new StringBuilder(strMenu);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                intApplications++;
                strDefaultApp = "/" + dr["url"].ToString() + "/default.aspx";
                string strColor = oColor.Name(Int32.Parse(dr["permission"].ToString()));

                sb.Append("<tr><td>&nbsp;</td><td><img src=\"/images/");
                sb.Append(strColor);
                sb.Append("level.gif\" title=\"");
                sb.Append(strColor);
                sb.Append("\" border=\"0\" align=\"absmiddle\">&nbsp;<a href=\"/");
                sb.Append(dr["url"].ToString());
                sb.Append("/default.aspx\">");
                sb.Append(dr["name"].ToString());
                sb.Append("</a></td></tr>");
            }

            if (sb.ToString() != "")
            {
                if (intApplications == 1 && boolRedirect == true && strDefaultApp != "")
                {
                    Response.Redirect(strDefaultApp);
                }
                else
                {
                    sb.Insert(0, "<tr height=\"5\"><td colspan=\"2\"><img src=\"/images/spacer.gif\" border=\"0\" height=\"5\" width=\"1\" /></td></tr>");
                }
            }
            else
            {
                //sb.Append("<p><font class=\"error\">There are no applications...</font><p/>");
                // Add the default application
                oRole.Add(intProfile, intClearViewUsersGroupID);
                Response.Redirect(Request.Url.PathAndQuery);
            }

            strMenu = sb.ToString();
        }
示例#2
0
        protected void btnSave_Click(Object Sender, EventArgs e)
        {
            int    intUser  = Int32.Parse(lblUserId.Text);
            string strRoles = Request.Form[hdnRoles.UniqueID];

            if (strRoles != "")
            {
                oRole.DeleteUser(intUser);
                while (strRoles != "")
                {
                    int intId = Int32.Parse(strRoles.Substring(0, strRoles.IndexOf("&")));
                    strRoles = strRoles.Substring(strRoles.IndexOf("&") + 1);
                    oRole.Add(intUser, intId);
                }
            }
            Response.Redirect(Request.Path + "?id=" + intUser.ToString() + "&save=true");
        }
示例#3
0
        protected void btnRegister_Click(Object Sender, EventArgs e)
        {
            int intManager = Int32.Parse(Request.Form[hdnManager.UniqueID]);

            oUser.Add(txtXID.Text, txtPNC.Text, txtFirst.Text, txtLast.Text, intManager, 0, 0, 0, "", 0, txtPhone.Text, "", 0, 0, 0, 0, 1);
            int intUser = oUser.GetId(strUser);

            // Load Manager's Role(s)
            NCC.ClearView.Application.Core.Roles oRole = new NCC.ClearView.Application.Core.Roles(0, dsn);
            DataSet dsRoles = oRole.Gets(intManager);

            foreach (DataRow drRole in dsRoles.Tables[0].Rows)
            {
                int intApp = Int32.Parse(drRole["applicationid"].ToString());
                oRole.Add(intUser, oRole.Get(intManager, intApp));
            }
            Response.Redirect(Request.Path + "?done=true");
        }