Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Authenticated"] == null)
            {
                Response.Redirect("default.aspx");
            }
            else if (Request.QueryString["name"] == null)
            {
                Response.Redirect("Search.aspx");
            }
            else
            {
                string  ventureName = Request.QueryString["name"];
                int     vId         = Convert.ToInt32(dbm.GetVentureID(ventureName));
                Venture v           = dbm.GetVenture(vId);

                h2VentureName.InnerText     = v.name;
                spVentureContact.InnerText  = v.contactEmail;
                pAboutUs.InnerText          = v.aboutUs;
                imgLogo.ImageUrl            = d.ConvertToImage(v.Picture);
                h3VentureDesc.InnerText     = v.description;
                spVenturePhone.InnerText    = v.contactPhoneNumber;
                spVentureLinkedIn.InnerText = v.contactLinkedIn;
                lblPrimaryContactEmail.Text = v.primaryContactEmail;

                //put venture data into session
                sm.storeVentureDataInSession(vId);
                ventureObj = (Venture)Session["ventureObj"];
                //Bind Repeaters
                this.rptMembersAndRoles.DataSource = ventureObj.memberNameAndRoleList;
                this.rptMembersAndRoles.DataBind();
                this.rptStaticMembersAndRoles.DataSource = ventureObj.staticMembersList;
                this.rptStaticMembersAndRoles.DataBind();
                this.rptVentureSkills.DataSource = ventureObj.AllVentureSkills;
                this.rptVentureSkills.DataBind();

                //Make sure only members of a venture are able to edit this particular venture
                Expert    expertProfileObj = sm.getAllTheExpertInfo((string)Session["TU_ID"]);
                string    user_name        = expertProfileObj.username;
                DataTable usernamesTable   = dbm.GetUsernamesForVenture(vId).Tables[0];
                int       isMember         = 0;
                for (int i = 0; i < usernamesTable.Rows.Count && isMember == 0; i++)
                {
                    if (usernamesTable.Rows[i][0].ToString() == user_name)
                    {
                        isMember            = 1;
                        editVenture.Visible = true;
                    }
                }//End of Restricting Edit Venture
            }
        }
Пример #2
0
        }//end btnSearchExperts_Click

        public List <ExpertSearchObj> getVentureSkillDuplicatesAndData(List <ExpertSearchObj> expertSkillSearch)
        {
            List <ExpertSearchObj> distinctVentureIds = new List <ExpertSearchObj>(); //distinct ventures with all their skills

            var temp = expertSkillSearch.Select(o => o.VentureID).Distinct();         //get all unique tuids

            foreach (var i in temp)
            {//add unique tuids to a new list
                distinctVentureIds.Add(new ExpertSearchObj {
                    VentureID = i
                });                                                          //only contains venture names
            }

            foreach (ExpertSearchObj dvid in distinctVentureIds)
            {                                                                                                                                                          //get all duplicates on put them into distinct objects
                var newList = (from n in expertSkillSearch where n.VentureID == dvid.VentureID select new { n.SkillName, n.VentureID, n.Name, n.Picture }).Distinct(); //get all data

                //add venture data to each object
                Venture currentVenture = DbMethods.GetVenture(dvid.VentureID);//get that venture's data and load that into it's object
                dvid.VentureID   = currentVenture.ventureID;
                dvid.Name        = currentVenture.name;
                dvid.VentureDesc = currentVenture.description;
                if (currentVenture.Picture != null)
                {
                    dvid.image = d.ConvertToImage((byte[])currentVenture.Picture);//returns string url
                }
                else
                {//in case expert's profile pic is null
                    byte[]               imageBytes;
                    MemoryStream         ms  = new MemoryStream();
                    System.Drawing.Image img = System.Drawing.Image.FromFile("Images/TUOwls_logo.png");
                    img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    imageBytes = ms.ToArray();
                    dvid.image = d.ConvertToImage(imageBytes);
                }
                //dvid.SkillName = currentVenture.skillName;
                foreach (var j in newList)
                {    //add all skillNames associated with the distinct tuid into its SkillName list in VentureSearch obj
                    dvid.AllVentureSkills.Add(j.ToString());
                }
            }//end getting distinct ventures and adding data
            return(distinctVentureIds);
        }