コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["ADMIN"] == null)
            {
                Response.Redirect("~/Web/Account/tempLogin.aspx?");
            }

            #region Shop Owner

            ShopConnection shopConnection = new ShopConnection();
            //Check if Shopowner is to be confirmed
            if (Request.QueryString["ShopId"] != null)
            {
                int id = Convert.ToInt32(Request.QueryString["ShopId"]);
                //Confirm user

                /***ADMIN ***/
                if (shopConnection.unVerifyShopowner(id))
                {
                    lblSuccess.Text      = "You have successfully Deactivated the Account";
                    lblErrorMessage.Text = "";
                }
                else
                {
                    lblSuccess.Text      = "";
                    lblErrorMessage.Text = "Could not Deactivate Account, please try again";
                }
            }
            List <Qaelo.Models.ShopOwnerModel.ShopOwner> shops = shopConnection.getAllShopOwners();

            foreach (Qaelo.Models.ShopOwnerModel.ShopOwner item in shops)
            {
                if (item.Verified)
                {
                    lblShopOwner.Text += string.Format(@"<tr>
                                                <td>{0}</td>
                                                <td>{1}</td>
                                                <td>{2}</td>
                                                <td>{3}</td>
                                                <td><a href='unConfirmAccount.aspx?ShopId={4}' class='btn btn-danger'>Deactivate</a></td>", item.FullName, item.Email, item.Number, General.getDateString(item.RegistrationDate), item.Id);
                }
            }
            #endregion

            #region Posters
            Data.EventsData.EventConnection posterConnection = new Data.EventsData.EventConnection();

            //Check if eventPoster is to be confirmed
            if (Request.QueryString["posterId"] != null)
            {
                int id = Convert.ToInt32(Request.QueryString["posterId"]);
                //Confirm user

                /***ADMIN ***/
                if (posterConnection.unverify(id))
                {
                    lblSuccess.Text      = "You have successfully Deactivated the Account";
                    lblErrorMessage.Text = "";
                }
                else
                {
                    lblSuccess.Text      = "";
                    lblErrorMessage.Text = "Could not Deactivate Account, please try again";
                }
            }
            List <Qaelo.Models.EventPosterModel.EventPoster> posters = posterConnection.getAllPosters();

            foreach (Qaelo.Models.EventPosterModel.EventPoster item in posters)
            {
                if (item.Verified)
                {
                    lblEventPoster.Text += string.Format(@"<tr>
                                                <td>{0}</td>
                                                <td>{1}</td>
                                                <td>{2}</td>
                                                <td>{3}</td>
                                                <td><a href='unConfirmAccount.aspx?posterId={4}' class='btn btn-danger'>Deactivate</a></td>", item.FullName, item.Email, item.Number, General.getDateString(item.RegistrationDate), item.Id);
                }
            }
            #endregion

            #region Property Owner
            Data.AccommodationData.ManagerConnection managerConnection = new Data.AccommodationData.ManagerConnection();

            //Check if eventPoster is to be confirmed
            if (Request.QueryString["managerId"] != null)
            {
                int id = Convert.ToInt32(Request.QueryString["managerId"]);
                //Confirm user

                /***ADMIN ***/
                if (managerConnection.unverify(id))
                {
                    lblSuccess.Text      = "You have successfully Deactivate the Account";
                    lblErrorMessage.Text = "";
                }
                else
                {
                    lblSuccess.Text      = "";
                    lblErrorMessage.Text = "Could not Deactivate Account, please try again";
                }
            }
            List <Qaelo.Models.AccommodationModel.Manager> managers = managerConnection.getAllManagers();

            foreach (Qaelo.Models.AccommodationModel.Manager item in managers)
            {
                if (item.verified)
                {
                    lblManagers.Text += string.Format(@"<tr>
                                                <td>{0}</td>
                                                <td>{1}</td>
                                                <td>{2}</td>
                                                <td>{3}</td>
                                                <td><a href='unConfirmAccount.aspx?managerId={4}' class='btn btn-danger'>Deactivate</a></td>", item.firstName + item.lastName, item.email, item.number, General.getDateString(item.registrationDate), item.id);
                }
            }
            #endregion

            #region Societies
            Data.SocietyData.SocietyConnection societyConnection = new Data.SocietyData.SocietyConnection();

            //Check if eventPoster is to be confirmed
            if (Request.QueryString["societyId"] != null)
            {
                int id = Convert.ToInt32(Request.QueryString["societyId"]);
                //Confirm user

                /***ADMIN ***/
                if (societyConnection.unverify(id))
                {
                    lblSuccess.Text      = "You have successfully Deactivated the Account";
                    lblErrorMessage.Text = "";
                }
                else
                {
                    lblSuccess.Text      = "";
                    lblErrorMessage.Text = "Could not Deactivate Account, please try again";
                }
            }
            List <Qaelo.Models.SocietyModel.Society> societies = societyConnection.getAllSocieties();

            foreach (Qaelo.Models.SocietyModel.Society item in societies)
            {
                if (item.Verified)
                {
                    lblSocieties.Text += string.Format(@"<tr>
                                                <td>{0}</td>
                                                <td>{1}</td>
                                                <td>{2}</td>
                                                <td>{3}</td>
                                                <td><a href='unConfirmAccount.aspx?societyId={4}' class='btn btn-danger'>Deactivate</a></td>", item.Name, item.Email, item.Number, General.getDateString(item.RegistrationDate), item.Id);
                }
            }
            #endregion
        }
コード例 #2
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            SocietyConnection connection = new Data.SocietyData.SocietyConnection();

            Qaelo.Models.StudentModel.Student student = (Qaelo.Models.StudentModel.Student)Session["STUDENT"];


            //Check if the user clicked the join button
            if (Request.QueryString["joinId"] != null)
            {
                if (student != null)
                {
                    int societyId = Convert.ToInt32(Request.QueryString["joinId"].ToString());
                    connection.joinSociety(societyId, student.Id);
                }
                else
                {
                    //Redirect
                    Response.Redirect("~/Web/Account/tempLogin.aspx");
                }
            }
            else if (Request.QueryString["unJoinId"] != null)
            {
                if (student != null)
                {
                    int societyId = Convert.ToInt32(Request.QueryString["unJoinId"].ToString());

                    connection.unJoinSociety(societyId, student.Id);
                }
            }

            List <Qaelo.Models.SocietyModel.Society> societies = connection.getAllSocietiesByVarsity(txtText.Text);

            string html = "";

            if (student != null)
            {
                foreach (Qaelo.Models.SocietyModel.Society society in societies)
                {
                    if (new SocietyConnection().getSociety(society.Id).Verified)
                    {
                        //Check if the society was likeed
                        if (connection.societyJoinedByUser(society.Id, student.Id))
                        {
                            html += string.Format(@"<div class='col-sm-3'>
                    <div class='thumbnail'>
                      <div class='w3-card-12'>
                                    <figure >
                                        <img src='../../../Images/Scociety/{0}'  class='' style='height:220px;width:100%' />
                              <figcaption style = 'background-image: url('')'>
                                    {1}                  
                              </figcaption>
                               </figure>
                        <div class='w3-container' style='margin:10px'>
                            <h6><b>{2}- <small style='font-size:12px'>{3}</small></b></h6>
                            <strong>Type:<small>{4}</small></strong><br />
                           <strong> Meeting time: <small>{5}</small></strong><br />
                            <strong>Call:<small>{6}</small>
                                <a href='Societies.aspx?unJoinId={7}' class='btn btn-danger pull-right'>Joined</a>
                            </strong><br />
                        </div><br />
                      </div>
                    </div>
                        </div>
                ", society.ProfileImage, society.Description, society.Name, society.University, society.SocietyType, society.MeetingTime, society.Number, society.Id);
                        }
                        else
                        {
                            html += string.Format(@"<div class='col-sm-3'>
                    <div class='thumbnail'>
                      <div class='w3-card-12'>
                                    <figure >
                                        <img src='../../../Images/Scociety/{0}'  class='' style='height:220px;width:100%' />
                              <figcaption style = 'background-image: url('')'>
                                    {1}                  
                              </figcaption>
                               </figure>
                        <div class='w3-container' style='margin:10px'>
                            <h6><b>{2}- <small style='font-size:12px'>{3}</small></b></h6>
                            <strong>Type:<small>{4}</small></strong><br />
                           <strong> Meeting time: <small>{5}</small></strong><br />
                            <strong>Call:<small>{6}</small>
                                <a href='Societies.aspx?joinId={7}' class='btn btn-default pull-right'>Join</a>
                            </strong><br />
                        </div><br />
                      </div>
                    </div>
                        </div>
                ", society.ProfileImage, society.Description, society.Name, society.University, society.SocietyType, society.MeetingTime, society.Number, society.Id);
                        }
                    }
                }//End of for each
            }
            else
            {
                foreach (Qaelo.Models.SocietyModel.Society society in societies)
                {
                    html += string.Format(@"<div class='col-sm-3'>
                    <div class='thumbnail'>
                      <div class='w3-card-12'>
                                    <figure >
                                        <img src='../../../Images/Scociety/{0}'  class='' style='height:220px;width:100%' />
                              <figcaption style = 'background-image: url('')'>
                                    {1}                  
                              </figcaption>
                               </figure>
                        <div class='w3-container' style='margin:10px'>
                            <h6><b>{2}- <small style='font-size:12px'>{3}</small></b></h6>
                            <strong>Type:<small>{4}</small></strong><br />
                           <strong> Meeting time: <small>{5}</small></strong><br />
                            <strong>Call:<small>{6}</small>
                                <a href='Societies.aspx?joinId={7}' class='btn btn-default pull-right'>Join</a>
                            </strong><br />
                        </div><br />
                      </div>
                    </div>
                        </div>
                ", society.ProfileImage, society.Description, society.Name, society.University, society.SocietyType, society.MeetingTime, society.Number, society.Id);
                }
            }

            //if (html == "")
            //{
            //    html = "<div class='alert alert-info'><h3>unfortunately Societies are not available at the moment</div></h3>";
            //}

            lblListOfSocieties.Text = html;
        }