Ejemplo n.º 1
0
        protected void lnkDelete_OnClick(object sender, EventArgs e)
        {
            ImageButton lb = (ImageButton)sender;

            Profiles.Proxy.Utilities.DataIO data = new Profiles.Proxy.Utilities.DataIO();
            data.DeleteProxy(lb.CommandArgument);


            DrawProfilesModule();
        }
Ejemplo n.º 2
0
 protected void gridSearchResults_SelectedIndexChanged(object sender, EventArgs e)
 {
     Utilities.DataIO data = new Profiles.Proxy.Utilities.DataIO();
     data.InsertProxy(gridSearchResults.DataKeys[gridSearchResults.SelectedIndex]["UserID"].ToString());
     Response.Redirect(Root.Domain + "/proxy/default.aspx?subject=" + HttpContext.Current.Request.QueryString["subject"]);
 }
        private void DrawProfilesModule()
        {
            Utilities.DataIO data = new Profiles.Proxy.Utilities.DataIO();

            SqlDataReader reader;
            List<Proxy> proxies = new List<Proxy>();

            reader = data.ManageProxies("GetAllUsersWhoCanEditMyNodes");

            while (reader.Read())
            {

                proxies.Add(new Proxy(reader["UserID"].ToString(),reader["DisplayName"].ToString(), reader["PersonURI"].ToString(), reader["Institution"].ToString()
                    , reader["Department"].ToString(), ""
                    , reader["EmailAddr"].ToString(), Convert.ToBoolean(reader["CanDelete"])));

            }
            reader.Close();

            gvMyProxies.DataSource = proxies;
            gvMyProxies.DataBind();

            proxies = null;
            proxies = new List<Proxy>();
            reader = data.ManageProxies("GetDesignatedUsersWhoseNodesICanEdit");

            while (reader.Read())
            {

                proxies.Add(new Proxy(reader["DisplayName"].ToString(), reader["PersonURI"].ToString(), reader["Institution"].ToString()
                    , "", "", reader["EmailAddr"].ToString()));

            }
            reader.Close();

            gvWhoCanIEdit.DataSource = proxies;
            gvWhoCanIEdit.DataBind();

            proxies = null;
            proxies = new List<Proxy>();
            reader = data.ManageProxies("GetDefaultUsersWhoseNodesICanEdit");

            while (reader.Read())
            {
                proxies.Add(new Proxy(reader["Institution"].ToString()
                    , reader["Department"].ToString(), reader["Division"].ToString()));

            }

            gvYouCanEdit.DataSource = proxies;
            gvYouCanEdit.DataBind();
            reader.Close();
        }
Ejemplo n.º 4
0
        private void DrawProfilesModule()
        {
            if (sm.Session().UserID == 0)
            {
                Response.Redirect(Root.Domain + "/search");
            }

            Utilities.DataIO data = new Profiles.Proxy.Utilities.DataIO();

            imgAdd.ImageUrl = Root.Domain + "/framework/images/icon_roundArrow.gif";


            SqlDataReader reader;
            List <Proxy>  proxies = new List <Proxy>();

            reader = data.ManageProxies("GetAllUsersWhoCanEditMyNodes");

            while (reader.Read())
            {
                proxies.Add(new Proxy(reader["UserID"].ToString(), reader["DisplayName"].ToString(), reader["PersonURI"].ToString(), reader["Institution"].ToString()
                                      , reader["Department"].ToString(), reader["EmailAddr"].ToString(), Convert.ToBoolean(reader["CanDelete"])));
            }
            reader.Close();

            gvMyProxies.DataSource = proxies;
            gvMyProxies.DataBind();


            proxies = new List <Proxy>();
            reader  = data.ManageProxies("GetDesignatedUsersWhoseNodesICanEdit");

            while (reader.Read())
            {
                proxies.Add(new Proxy(reader["DisplayName"].ToString(), reader["PersonURI"].ToString(), reader["Institution"].ToString()
                                      , "", reader["EmailAddr"].ToString()));
            }
            reader.Close();

            gvWhoCanIEdit.DataSource = proxies;
            gvWhoCanIEdit.DataBind();



            proxies = new List <Proxy>();
            reader  = data.ManageProxies("GetDefaultUsersWhoseNodesICanEdit");
            string yorn = string.Empty;

            while (reader.Read())
            {
                if (Convert.ToBoolean(reader["isVisible"]))
                {
                    yorn = "Y";
                }
                else
                {
                    yorn = "N";
                }

                proxies.Add(new Proxy(reader["Institution"].ToString()
                                      , reader["Department"].ToString(), yorn));
            }

            gvYouCanEdit.DataSource = proxies;
            gvYouCanEdit.DataBind();

            reader.Close();

            if (sm.Session().NodeID > 0)
            {
                pnlAddProxy.Visible = true;
                string url = Root.Domain + "/proxy/default.aspx?method=search&subject=" + HttpContext.Current.Request.QueryString["subject"];
                lnkAddProxyTmp.Text = "<a href='" + url + "'>Add A Proxy</a>";
            }
        }
Ejemplo n.º 5
0
        private void ExecuteSearch(bool button)
        {
            Utilities.DataIO data = new Profiles.Proxy.Utilities.DataIO();


            Int32 totalpageremainder = 0;

            if (drpDepartment.SelectedItem.Text != "--Select--")
            {
                this.Department = drpDepartment.SelectedItem.Value;
            }
            else
            {
                this.Department = string.Empty;
            }

            if (drpInstitution.SelectedItem.Text != "--Select--")
            {
                this.Institution = drpInstitution.SelectedItem.Value;
            }
            else
            {
                this.Institution = string.Empty;
            }

            this.Fname = txtFirstName.Text;
            this.Lname = txtLastName.Text;

            if (!button)
            {
                if (Request.QueryString["offset"] != null)
                {
                    this.Offset = Convert.ToInt32(Request.QueryString["offset"]);
                }

                if (Request.QueryString["totalrows"] != null)
                {
                    this.TotalRowCount = Convert.ToInt32(Request.QueryString["totalrows"]);
                }

                if (Request.QueryString["CurrentPage"] != null)
                {
                    this.CurrentPage = Convert.ToInt32(Request.QueryString["CurrentPage"]);
                }

                if (Request.QueryString["TotalPages"] != null)
                {
                    this.TotalPages = Convert.ToInt32(Request.QueryString["TotalPages"]);
                }
            }

            if (this.TotalPages == 0)
            {
                MyDataSet          = data.SearchProxies(Lname, Fname, Institution, Department, 0, 1000000);
                this.TotalRowCount = MyDataSet.Tables[0].Rows.Count;
            }

            if (this.CurrentPage <= 0)
            {
                this.CurrentPage = 1;
            }

            this.TotalPages = Math.DivRem(this.TotalRowCount, 25, out totalpageremainder);

            if (totalpageremainder > 0)
            {
                this.TotalPages = this.TotalPages + 1;
            }

            if (this.CurrentPage > this.TotalPages)
            {
                this.CurrentPage = this.TotalPages;
            }

            this.Offset = ((Convert.ToInt32(this.CurrentPage) * 25) + 1) - 25;

            if (this.Offset < 0)
            {
                this.Offset = 0;
            }


            MyDataSet = data.SearchProxies(Lname, Fname, Institution, Department, this.Offset - 1, 25);

            gridSearchResults.PageIndex  = 0;
            gridSearchResults.DataSource = MyDataSet;
            gridSearchResults.DataBind();

            if (MyDataSet.Tables[0].Rows.Count > 0)
            {
                gridSearchResults.BottomPagerRow.Visible = true;
            }

            pnlProxySearchResults.Visible = true;


            litPagination.Text = "<script type='text/javascript'>" +
                                 "_page = " + this.CurrentPage + ";" +
                                 "_offset = " + this.Offset + ";" +
                                 "_totalrows = " + this.TotalRowCount + ";" +
                                 "_totalpages =" + this.TotalPages + ";" +
                                 "_root = '" + Root.Domain + "';" +
                                 "_subject = '" + Subject + "';" +
                                 "_fname = '" + this.Fname + "';" +
                                 "_lname = '" + this.Lname.Replace("'", "\\'") + "';" +
                                 "_department = '" + this.Department.Replace("'", "\\'") + "';" +
                                 "_institution = '" + this.Institution.Replace("'", "\\'") + "';" +

                                 "</script>";
        }
        protected void lnkDelete_OnClick(object sender, EventArgs e)
        {
            ImageButton lb = (ImageButton)sender;

            Utilities.DataIO data = new Profiles.Proxy.Utilities.DataIO();
            data.DeleteProxy(lb.CommandArgument);

            DrawProfilesModule();
        }
        private void DrawProfilesModule()
        {
            if (sm.Session().UserID == 0)
                Response.Redirect(Root.Domain + "/search");

            Utilities.DataIO data = new Profiles.Proxy.Utilities.DataIO();

            imgAdd.ImageUrl = Root.Domain + "/framework/images/icon_roundArrow.gif";

            litBackLink.Text = "<b>Manage Proxies</b>";

            SqlDataReader reader;
            List<Proxy> proxies = new List<Proxy>();

            reader = data.ManageProxies("GetAllUsersWhoCanEditMyNodes");

            while (reader.Read())
            {
                proxies.Add(new Proxy(reader["UserID"].ToString(), reader["DisplayName"].ToString(), reader["PersonURI"].ToString(), reader["Institution"].ToString()
                    , reader["Department"].ToString(), ""
                    , reader["EmailAddr"].ToString(), Convert.ToBoolean(reader["CanDelete"])));
            }
            reader.Close();

            gvMyProxies.DataSource = proxies;
            gvMyProxies.DataBind();
            gvMyProxies.CellPadding = 2;
            proxies = null;
            proxies = new List<Proxy>();
            reader = data.ManageProxies("GetDesignatedUsersWhoseNodesICanEdit");

            while (reader.Read())
            {
                proxies.Add(new Proxy(reader["DisplayName"].ToString(), reader["PersonURI"].ToString(), reader["Institution"].ToString()
                    , "", "", reader["EmailAddr"].ToString()));
            }
            reader.Close();

            gvWhoCanIEdit.DataSource = proxies;
            gvWhoCanIEdit.DataBind();
            gvWhoCanIEdit.CellPadding = 2;

            proxies = null;
            proxies = new List<Proxy>();
            reader = data.ManageProxies("GetDefaultUsersWhoseNodesICanEdit");
            string yorn = string.Empty;

            while (reader.Read())
            {
                if (Convert.ToBoolean(reader["isVisible"]))
                    yorn = "Y";
                else
                    yorn = "N";

                proxies.Add(new Proxy(reader["Institution"].ToString()
                    , reader["Department"].ToString(), reader["Division"].ToString(), yorn));
            }

            gvYouCanEdit.DataSource = proxies;
            gvYouCanEdit.DataBind();
            gvYouCanEdit.CellPadding = 2;
            reader.Close();

            string url = Root.Domain + "/proxy/default.aspx?method=search&subject=" + HttpContext.Current.Request.QueryString["subject"];
            lnkAddProxyTmp.Text = "<a href='" + url + "'>Add A Proxy</a>";
        }
        protected void gridSearchResults_SelectedIndexChanged(object sender, EventArgs e)
        {
            Utilities.DataIO data = new Profiles.Proxy.Utilities.DataIO();

            if (drpDepartmentPermissions.SelectedItem.Text != "--Select--")
                this.Department = drpDepartmentPermissions.SelectedItem.Value;
            else
                this.Department = string.Empty;

            if (drpInstitutionPermissions.SelectedItem.Text != "--Select--")
                this.Institution = drpInstitutionPermissions.SelectedItem.Value;
            else
                this.Institution = string.Empty;

            // Do not allow Super proxies to be made with the following permissions: institution: all, department: <specified>
            if (this.Institution == string.Empty && this.Department != string.Empty)
            {
                // This permission combination does not make much sense
                // Return an error
                string strScript = " window.alert('I am sorry you cannot define the following permissions: institution: all, department: <specified> ');";
                if (!Page.ClientScript.IsStartupScriptRegistered("myscript"))
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "myscript", strScript, true);
                return;
            }

            // Check if the current user has a higher or equal permission level then the one it is trying to add
            if (!data.doesCurrentUserHavePermissionsOverInputtedPermissions(this.Institution, this.Department))
            {
                // Currently logged in user does not have permissions high enough to add a super proxy with these permissions
                string strScript = " window.alert('I am sorry you cannot add a super proxy with permissions higher than your own.');";
                if (!Page.ClientScript.IsStartupScriptRegistered("myscript"))
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "myscript", strScript, true);
                return;
            }

            // Check to make sure that this person is not already in the default proxy table
            SqlDataReader reader = data.ManageProxies("GetAllDefaultProxies");

            while (reader.Read())
            {
                if (reader["UserID"].ToString() == gridSearchResults.DataKeys[gridSearchResults.SelectedIndex]["UserID"].ToString())
                {
                    // User is already a super proxy
                    // Display an error
                    string strScript = " window.alert('I am sorry you cannot add a super proxy that already exists.');";
                    if (!Page.ClientScript.IsStartupScriptRegistered("myscript"))
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "myscript", strScript, true);
                    return;
                }

            }
            data.InsertDefaultProxy(gridSearchResults.DataKeys[gridSearchResults.SelectedIndex]["UserID"].ToString(), this.Institution, this.Department, true);

            reader.Close();

            Response.Redirect(Root.Domain + "/proxy/default.aspx?subject=" + HttpContext.Current.Request.QueryString["subject"]);
        }
        private void ExecuteSearch(bool button)
        {
            Utilities.DataIO data = new Profiles.Proxy.Utilities.DataIO();

            Int32 totalpageremainder = 0;

            if (drpDepartment.SelectedItem.Text != "--Select--")
                this.Department = drpDepartment.SelectedItem.Value;
            else
                this.Department = string.Empty;

            if (drpInstitution.SelectedItem.Text != "--Select--")
                this.Institution = drpInstitution.SelectedItem.Value;
            else
                this.Institution = string.Empty;

            this.Fname = txtFirstName.Text;
            this.Lname = txtLastName.Text;

            if (!button)
            {
                if (Request.QueryString["offset"] != null)
                    this.Offset = Convert.ToInt32(Request.QueryString["offset"]);

                if (Request.QueryString["totalrows"] != null)
                    this.TotalRowCount = Convert.ToInt32(Request.QueryString["totalrows"]);

                if (Request.QueryString["CurrentPage"] != null)
                    this.CurrentPage = Convert.ToInt32(Request.QueryString["CurrentPage"]);

                if (Request.QueryString["TotalPages"] != null)
                    this.TotalPages = Convert.ToInt32(Request.QueryString["TotalPages"]);

            }

            if (this.TotalPages == 0)
            {
                MyDataSet = data.SearchProxies(Lname, Fname, Institution, Department, 0, 1000000);
                this.TotalRowCount = MyDataSet.Tables[0].Rows.Count;
            }

            if (this.CurrentPage <= 0)
            {
                this.CurrentPage = 1;
            }

            this.TotalPages = Math.DivRem(this.TotalRowCount, 25, out totalpageremainder);

            if (totalpageremainder > 0) { this.TotalPages = this.TotalPages + 1; }

            if (this.CurrentPage > this.TotalPages)
                this.CurrentPage = this.TotalPages;

            this.Offset = ((Convert.ToInt32(this.CurrentPage) * 25) + 1) - 25;

            if (this.Offset < 0)
                this.Offset = 0;

            MyDataSet = data.SearchProxies(Lname, Fname, Institution, Department, this.Offset - 1, 25);

            gridSearchResults.PageIndex = 0;
            gridSearchResults.DataSource = MyDataSet;
            gridSearchResults.DataBind();

            if (MyDataSet.Tables[0].Rows.Count > 0)
                gridSearchResults.BottomPagerRow.Visible = true;

            pnlProxySearchResults.Visible = true;

            litPagination.Text = "<script type='text/javascript'>" +
                "_page = " + this.CurrentPage + ";" +
                "_offset = " + this.Offset + ";" +
                "_totalrows = " + this.TotalRowCount + ";" +
                "_totalpages =" + this.TotalPages + ";" +
                "_root = '" + Root.Domain + "';" +
                "_subject = '" + Subject + "';" +
                "_fname = '" + this.Fname + "';" +
                "_lname = '" + this.Lname.Replace("'", "\\'") + "';" +
                "_department = '" + this.Department.Replace("'","\\'") + "';" +
                "_institution = '" + this.Institution.Replace("'", "\\'") + "';" +

                //TODO: add the params i added for the dept/inst permission?

                "</script>";

            // show the form to populate the addDefaultProxy
            superProxyPermissions.Visible = true;
        }
Ejemplo n.º 10
0
        protected void btnAddProfile_Click(object sender, EventArgs e)
        {
            Utilities.DataIO data = new Profiles.Proxy.Utilities.DataIO();

            string firstName = txtFirstName.Text.ToString();
            string middleName = txtMiddleName.Text.ToString();
            string lastName = txtLastName.Text.ToString();
            string gender = txtGender.Text.ToString(); // TODO : make a drop down
            string addressLineOne = txtAddressLineOne.Text.ToString();
            string addressLineTwo = txtAddressLineTwo.Text.ToString();
            string city = txtCity.Text.ToString();
            string state = txtState.Text.ToString(); //TODO: make a drop down
            string zip = txtZip.Text.ToString();
            string phoneNumber = txtPhoneNumber.Text.ToString();
            string emailAddress = txtEmail.Text.ToString();
            string title = txtTitle.Text.ToString();
            string institutionName = txtInstitutionName.Text.ToString();
            string institutionAbbreviation= txtInstitutionAbbreviation.Text.ToString();
            string departmentName = txtDepartmentName.Text.ToString();

            // Check that all of the inputs are valid

            if (firstName == string.Empty)
            {
                printErrorMessage("First Name is required", txtFirstName);
                return;
            }

            if (firstName.Length > 50)
            {
                printErrorMessage("First Name must be less than 50 characters", txtFirstName);
                return;
            }

            if (middleName == string.Empty)
            {
                printErrorMessage("Middle Name is required", txtMiddleName);
                return;
            }

            if (middleName.Length > 50)
            {
                printErrorMessage("Middle Name must be less than 50 characters.", txtMiddleName);
                return;
            }

            if (lastName == string.Empty)
            {
                printErrorMessage("Last Name is required.", txtLastName);
                return;
            }

            if (lastName.Length > 50)
            {
                printErrorMessage("You cannot input a Last Name with more than 50 characters.", txtLastName);
                return;
            }

            if (gender == string.Empty)
            {
                printErrorMessage("Gender is required", txtGender);
                return;
            }

            if (gender.Length > 50)
            {
                printErrorMessage("Gender must be less than 50 characters", txtGender);
                return;
            }

            if (addressLineOne == string.Empty)
            {
                printErrorMessage("Address Line One is required", txtAddressLineOne);
                return;
            }

            if (addressLineOne.Length > 55)
            {
                printErrorMessage("Address Line One must be less than 55 characters", txtAddressLineOne);
                return;
            }

            if (addressLineTwo == string.Empty)
            {
                printErrorMessage("Address Line Two is required", txtAddressLineTwo);
                return;
            }

            if (addressLineTwo.Length > 55)
            {
                printErrorMessage("Address Line Two must be less than 55 characters", txtAddressLineTwo);
                return;
            }

            if (city == string.Empty)
            {
                printErrorMessage("City is required", txtCity);
                return;
            }

            if (city.Length > 100)
            {
                printErrorMessage("City must be less than 100 characters", txtCity);
                return;
            }

            if (state == string.Empty)
            {
                printErrorMessage("State is required", txtState);
                return;
            }

            if (state.Length != 2)
            {
                printErrorMessage("State must be 2 characters", txtState);
                return;
            }

            if (zip == string.Empty)
            {
                printErrorMessage("Zip is required", txtZip);
                return;
            }

            if (zip.Length > 50)
            {
                printErrorMessage("Zip must be less than 10 characters", txtZip);
                return;
            }

            if (phoneNumber == string.Empty)
            {
                printErrorMessage("Phone Number is required", txtPhoneNumber);
                return;
            }

            // TODO: Are there any other restrictions on phone number? Should I put some simple regex checks here?

            if (phoneNumber.Length > 35)
            {
                printErrorMessage("Phone Number must be less than 35 characters", txtPhoneNumber);
                return;
            }

            if (emailAddress == string.Empty)
            {
                printErrorMessage("Email is required", txtEmail);
                return;
            }

            // TODO: Are there any other restrictions on email address? Should I put some simple regex checks here?

            if (emailAddress.Length > 255)
            {
                printErrorMessage("Email must be less than 255 characters", txtEmail);
                return;
            }

            if (title == string.Empty)
            {
                printErrorMessage("Title is required", txtTitle);
                return;
            }

            if (title.Length > 500)
            {
                printErrorMessage("Title must be less than 500", txtTitle);
                return;
            }

            if (institutionName == string.Empty)
            {
                printErrorMessage("Institution Name is required", txtInstitutionName);
                return;
            }

            if (institutionName.Length > 500)
            {
                printErrorMessage("Institution Name must be less than 500 characters", txtInstitutionName);
                return;
            }

            if (institutionAbbreviation == string.Empty)
            {
                printErrorMessage("Institution Name is required", txtInstitutionAbbreviation);
                return;
            }

            if (institutionAbbreviation.Length > 50)
            {
                printErrorMessage("Institution Name must be less than 500 characters", txtInstitutionAbbreviation);
                return;
            }

            if (departmentName == string.Empty)
            {
                printErrorMessage("Department Name is required", txtDepartmentName);
                return;
            }

            if (departmentName.Length > 500)
            {
                printErrorMessage("Institution Name must be less than 500 characters", txtDepartmentName);
                return;
            }

            // Check that the profile we are trying to add doesn't already exist in the system
            if (data.emailExists(emailAddress.ToLower()))
            {
                printErrorMessage("A profile with this email already exists in the system.", txtEmail);
                return;
            }

            // Add a row into Profile.Import.Person and Profile.Import.PersonAffiliation tables
            data.loadNewProfileIntoStagingTables(new Profile(firstName, middleName, lastName, gender, addressLineOne, addressLineTwo, city, state, zip, phoneNumber, emailAddress, title, institutionName, institutionAbbreviation, departmentName));

            // TODO: Should I call Profiles.Import.ValidateProfileImportblahblah.StoredProcedure.sql here?? --> I looked at it brielfy
            //    --> we might be able to use it here to validate user inputs (I have to read through it all first to ensure it doesnt have unintended side effects)
            // data.validateProfileImport();

            // call the Profile.Import.LoadProfilesData stored procedure
            data.loadProfilesData();

            // call RDF.Stage.ProcessDataMap stored procedure
            data.processDataMap();

            // At this point the new profile should be in the system.

            // I need to update cache now. So it is searchable
            // call Search.Cache.Public.UpdateCache stored proc
            data.updatePublicCache();
        }
Ejemplo n.º 11
0
        protected void superProxyGrid_OnRowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Utilities.DataIO data = new Profiles.Proxy.Utilities.DataIO();
                Proxy proxy = (Proxy)e.Row.DataItem;

                Literal litName = (Literal)e.Row.FindControl("litName");
                Literal litDeparment = (Literal)e.Row.FindControl("litDepartment");
                Literal litInstitution = (Literal)e.Row.FindControl("litInstitution");

                if (proxy.PersonURI != null)
                    litName.Text = "<a href='" + proxy.PersonURI + "'>" + proxy.Name + "</a>";
                else
                    litName.Text = proxy.Name;

                if (proxy.Department.Equals(String.Empty))
                {
                    litDeparment.Text = "All";
                }
                else
                {
                    litDeparment.Text = proxy.Department;
                }

                if (proxy.Institution.Equals(String.Empty))
                {
                    litInstitution.Text = "All";
                }
                else
                {
                    litInstitution.Text = proxy.Institution;
                }

                ImageButton lnkDelete = (ImageButton)e.Row.FindControl("lnkDeleteSuperProxy");

                // Do not show the link to the trash can if the current user does not have proper permissions
                if (data.doesCurrentUserHavePermissionsOverInputtedUserID(proxy.UserID))
                {
                    lnkDelete.CommandArgument = proxy.UserID;
                    lnkDelete.CommandName = "UserID";
                }
                else
                {
                    lnkDelete.Visible = false;
                    //TODO: put some sort of indiciation text here for clarity of why they cannot delete
                }

                e.Row.Cells[0].HorizontalAlign = HorizontalAlign.Left;
                e.Row.Cells[1].HorizontalAlign = HorizontalAlign.Center;
                e.Row.Cells[2].HorizontalAlign = HorizontalAlign.Center;
                // e.Row.Cells[3].HorizontalAlign = HorizontalAlign.Center;
            }
        }
Ejemplo n.º 12
0
        protected void lnkDelete_OnClick_SuperProxies(object sender, EventArgs e)
        {
            ImageButton lb = (ImageButton)sender;
            Utilities.DataIO data = new Profiles.Proxy.Utilities.DataIO();
            string useridToDelete = lb.CommandArgument;

            if (data.doesCurrentUserHavePermissionsOverInputtedUserID(useridToDelete))
            {
                data.DeleteSuperProxy(useridToDelete);
            }

            DrawProfilesModule();
        }
        private void ExecuteSearch()
        {
            Utilities.DataIO data = new Profiles.Proxy.Utilities.DataIO();

            Int32 totalpageremainder = 0;

            if (drpDepartment.SelectedItem.Text != "--Select--")
                this.Department = drpDepartment.SelectedItem.Text;

            if (drpInstitution.SelectedItem.Text != "--Select--")
                this.Institution = drpInstitution.SelectedItem.Text;

            if (drpDivision.SelectedItem.Text != "--Select--")
                this.Division = drpDivision.SelectedItem.Text;

            this.Fname = txtFirstName.Text;
            this.Lname = txtLastName.Text;

            if (Request.QueryString["offset"] != null)
                this.Offset = Convert.ToInt32(Request.QueryString["offset"]);

            if (Request.QueryString["totalrows"] != null)
                this.TotalRowCount = Convert.ToInt32(Request.QueryString["totalrows"]);

            if (Request.QueryString["CurrentPage"] != null)
                this.CurrentPage = Convert.ToInt32(Request.QueryString["CurrentPage"]);

            if (Request.QueryString["TotalPages"] != null)
                this.TotalPages = Convert.ToInt32(Request.QueryString["TotalPages"]);

            if (this.TotalPages == 0)
            {
                MyDataSet = data.SearchProxies(Lname, Fname, Institution, Department, Division, 0, 1000000);
                this.TotalRowCount = MyDataSet.Tables[0].Rows.Count;
            }

            if (this.CurrentPage <= 0)
            {
                this.CurrentPage = 1;
            }

            if (this.TotalPages == 0)
                this.TotalPages = Math.DivRem(this.TotalRowCount, 25, out totalpageremainder);

            if (totalpageremainder > 0) { this.TotalPages = this.TotalPages + 1; }

            this.Offset = ((Convert.ToInt32(this.CurrentPage) * 25) + 1) - 25;

            if (this.Offset < 0)
                this.Offset = 0;

            MyDataSet = data.SearchProxies(Lname, Fname, Institution, Department, Division, this.Offset - 1, 25);

            gridSearchResults.PageIndex = 0;
            gridSearchResults.DataSource = MyDataSet;
            gridSearchResults.DataBind();

            if (MyDataSet.Tables[0].Rows.Count > 0)
                gridSearchResults.BottomPagerRow.Visible = true;

            pnlProxySearchResults.Visible = true;

            litPagination.Text = "<script type='text/javascript'>" +
                "_page = " + this.CurrentPage + ";" +
                "_offset = " + this.Offset + ";" +
                "_totalrows = " + this.TotalRowCount + ";" +
                "_totalpages =" + this.TotalPages + ";" +
                "_root = '" + Root.Domain + "';" +
                "_subject = '" + Subject + "';" +
                "_fname = '" + this.Fname + "';" +
                "_lname = '" + this.Lname + "';" +
                "_department = '" + this.Department + "';" +
                "_institution = '" + this.Institution + "';" +
                "_division = '" + this.Division + "';" +
                "</script>";
        }
 protected void gridSearchResults_SelectedIndexChanged(object sender, EventArgs e)
 {
     Utilities.DataIO data = new Profiles.Proxy.Utilities.DataIO();
     data.InsertProxy(gridSearchResults.DataKeys[gridSearchResults.SelectedIndex]["UserID"].ToString());
     Response.Redirect(Root.Domain + "/proxy/default.aspx?subject=" + HttpContext.Current.Request.QueryString["subject"]);
 }