Ejemplo n.º 1
0
 protected void SendJoinRequest_Click(object sender, EventArgs e)
 {
     try
     {
         string posID = JoinRequestID.Value;
         if (posID != "")
         {
             UserInfo loggedUser = new UserInfo((int)Session["UserID"]);
             loggedUser.LisrProf = loggedUser.GetUserProfessionsList2();
             ProjectPos position     = new ProjectPos(int.Parse(posID));
             bool       containsItem = loggedUser.LisrProf.Any(item => item.ProfessionID == position.profession.ProfessionID);
             if (containsItem)
             {
                 Project.AddProjectRequest(int.Parse(posID), (int)Session["UserID"], 1, 1);
             }
         }
     }
     catch
     {
         Response.Redirect("HomePage.aspx", true);
     }
 }
Ejemplo n.º 2
0
 protected void PosRepeater_OnItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         ProjectPos projectpos = (ProjectPos)e.Item.DataItem;
         UserInfo   PosUser    = new UserInfo(projectpos.userID, false, false);
         if (PosUser.ProfilePath != null)
         {
             ((ImageButton)e.Item.FindControl("ProfilePosPic")).ImageUrl      = PosUser.ProfilePath;
             ((ImageButton)e.Item.FindControl("ProfilePosPic")).AlternateText = PosUser.ID.ToString();
             if (PosUser.ID == 1)
             {
                 ((ImageButton)e.Item.FindControl("ProfilePosPic")).Enabled = false;
             }
         }
         else
         {
             ((ImageButton)e.Item.FindControl("ProfilePosPic")).ImageUrl      = "DesignElements/elements/ProfilePicEmpty.png";
             ((ImageButton)e.Item.FindControl("ProfilePosPic")).AlternateText = PosUser.ID.ToString();
         }
         ((HtmlGenericControl)e.Item.FindControl("PosTitle")).InnerText = projectpos.profession.ProfName;
         HtmlGenericControl programsArea = ((HtmlGenericControl)e.Item.FindControl("PosPrograms"));
         if (projectpos.Programs != null)
         {
             foreach (Knowledge program in projectpos.Programs)
             {
                 Image programImage = new Image();
                 programImage.ImageUrl = program.ProgPath;
                 programsArea.Controls.Add(programImage);
             }
         }
         Label idLabel = new Label();
         idLabel.Text     = projectpos.id.ToString();
         idLabel.CssClass = "posNumber";
         ((HtmlGenericControl)e.Item.FindControl("ReJoinButton")).Controls.Add(idLabel);
         // add OR and check if user has already requested this Position
         List <int> loggedUser_professions = null;
         try
         {
             loggedUser_professions = UserInfo.GetUserProfessions((int)Session["UserID"]);
         }
         catch
         {
             Response.Redirect("ProjectShowcase.aspx", true);
         }
         bool containsItem = loggedUser_professions.Contains(projectpos.profession.ProfessionID);
         if (PosUser.ID != 1 || !containsItem)
         {
             ((Button)e.Item.FindControl("SendJoinRe")).Visible = false;
         }
         if (projectpos.CheckUserAtProjectPos((int)Session["UserID"]))
         {
             ((Button)e.Item.FindControl("SendJoinRe")).Attributes.Add("disabled", "true");
         }
         Project currentProject = new Project(int.Parse(PostProjID.Value), false);
         if (currentProject.AdminUSID == projectpos.userID)
         {
             ((Label)e.Item.FindControl("ProjectManager")).Visible = true;
         }
     }
 }