protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Reload();
     }
     oPermission       = new Permissions(intProfile, dsn);
     oUser             = new Users(intProfile, dsn);
     oRole             = new NCC.ClearView.Application.Core.Roles(intProfile, dsn);
     oGroup            = new Groups(intProfile, dsn);
     lblFinish.Visible = false;
     if (Request.QueryString["save"] != null && Request.QueryString["save"] != "")
     {
         lblFinish.Visible = true;
     }
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         if (!IsPostBack)
         {
             lblUserId.Text = Request.QueryString["id"];
             int intUser = Int32.Parse(lblUserId.Text);
             lblUser.Text = oUser.GetFullName(intUser);
             LoadLists();
             btnAdd.Attributes.Add("onclick", "return MoveIn(" + ddlAvailable.ClientID + "," + lstCurrent.ClientID + ",'" + hdnRoles.ClientID + "');");
             btnRemove.Attributes.Add("onclick", "return MoveOut(" + lstCurrent.ClientID + "," + ddlAvailable.ClientID + ",'" + hdnRoles.ClientID + "');");
             lstCurrent.Attributes.Add("ondblclick", "return MoveOut(this," + ddlAvailable.ClientID + ",'" + hdnRoles.ClientID + "');");
             btnClose.Attributes.Add("onclick", "return HidePanel();");
         }
     }
 }
        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();
        }
Exemple #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");
        }
Exemple #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/admin_users.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oRole          = new NCC.ClearView.Application.Core.Roles(intProfile, dsn);
     oUser          = new Users(intProfile, dsn);
     oAD            = new AD(intProfile, dsn, intEnvironment);
     oUserAt        = new Users_At(intProfile, dsn);
     lblResult.Text = "";
     txtName.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnSearch.ClientID + "').click();return false;}} else {return true}; ");
     if (!IsPostBack)
     {
         if (Request.QueryString["f"] != null)
         {
             divAdd.Style["display"] = "inline";
             if (Request.QueryString["f"].Trim() != "")
             {
                 Find(Request.QueryString["f"]);
             }
             else
             {
                 lblResult.Text = "<img src='/images/error.gif' border='0' align='absmiddle'> Please enter a name";
             }
         }
         else if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
         {
             divEdit.Style["display"] = "inline";
             hdnId.Value       = "0";
             btnDelete.Visible = false;
             btnCancel.Visible = false;
         }
         else if (Request.QueryString["s"] != null)
         {
             divView.Style["display"] = "inline";
             if (Request.QueryString["s"].Trim() != "")
             {
                 LoopRepeater(Request.QueryString["s"]);
             }
             else
             {
                 lblResult.Text = "<img src='/images/error.gif' border='0' align='absmiddle'> Please enter a name";
             }
             LoadList();
         }
         else
         {
             divView.Style["display"] = "inline";
         }
         Variables oVariable = new Variables(intEnvironment);
         txtManager.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divAJAX.ClientID + "','" + lstAJAX.ClientID + "','" + hdnManager.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
         lstAJAX.Attributes.Add("ondblclick", "AJAXClickRow();");
         btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this user?');");
         btnCancel.Attributes.Add("onclick", "return Cancel();");
     }
     btnRoles.Attributes.Add("onclick", "return OpenWindow('USERROLES','" + hdnId.ClientID + "','',false,'500',300);");
     btnPages.Attributes.Add("onclick", "return OpenWindow('USERPAGEBROWSER','" + hdnId.ClientID + "','',false,'400',475);");
 }