protected void Page_Load(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 6)
            {
                try
                {
                    lblNoFile.Visible = false;
                    imgFile.Visible   = true;

                    ServiceReference1.Organisation org = serv.getOrg(int.Parse(Request.QueryString["orgId"].ToString()));
                    lblName.Text = org.OrganisationName;
                    lblNum.Text  = org.OrganisationNumber.ToString();
                    lblCN.Text   = org.ContactNumber;

                    ServiceReference1.FileClass file = serv.getFile(int.Parse(Request.QueryString["orgId"].ToString()), false);
                    MemoryStream ms = new MemoryStream(file.FileBytes, 0, file.FileBytes.Length);
                    imgFile.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String(file.FileBytes);
                }
                catch (Exception ex)
                {
                    imgFile.Visible   = false;
                    lblNoFile.Visible = true;
                }
            }
        }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if ((int)HttpContext.Current.Session["User_lvl"] > 0 && (int)HttpContext.Current.Session["User_lvl"] < 8)
     {
         try
         {
             ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
             ServiceReference1.UserDetail     user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
             ServiceReference1.FileClass      file = serv.getUserImage(user.userValue.UserID);
             MemoryStream ms = new MemoryStream(file.FileBytes, 0, file.FileBytes.Length);
             imgUserPic.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String(file.FileBytes);
         }
         catch (Exception ex)
         {
             imgUserPic.ImageUrl = "~/images/ina.jpg";
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            menu_statistics.Visible = false;
            menu_dashboard.Visible  = false;
            menu_home.Visible       = false;
            menu_login.Visible      = false;
            menu_register.Visible   = false;
            menu_user_list.Visible  = false;
            menu_login.Attributes.Remove("class");
            menu_home.Attributes.Remove("class");
            menu_register.Attributes.Remove("class");
            menu_faq.Attributes.Remove("class");
            menu_dashboard.Attributes.Remove("class");

            if (index.onPage)
            {
                menu_home.Attributes.Add("class", "current");

                menu_statistics.Visible = true;
            }
            if (login.onPage)
            {
                menu_login.Attributes.Add("class", "current");
            }
            if (RegisterPage.onPage)
            {
                menu_register.Attributes.Add("class", "current");
            }
            if (HelpPage.onPage)
            {
                menu_faq.Attributes.Add("class", "current");
            }
            if (DashboardPage.onPage)
            {
                menu_dashboard.Attributes.Add("class", "current");
            }
            if (UserListPage.onPage)
            {
                menu_user_list.Attributes.Add("class", "current");
            }
            if (ReportPage.onPage)
            {
            }
            if (HttpContext.Current.Session["User_lvl"] != null)
            {
                logo.HRef = "DashboardPage.aspx";
                menu_dashboard.Visible = true;
                menu_user_list.Visible = true;
                userPic.Visible        = true;

                ServiceReference1.UserDetail u = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                viewProfile.HRef = "UserPage.aspx?userId=" + u.userValue.UserID;

                if (HttpContext.Current.Session["User_FistName"] == null)
                {
                    userNameP.InnerHtml = "Guest";
                }
                else
                {
                    userNameP.InnerHtml = (String)HttpContext.Current.Session["User_FistName"];
                }
            }
            else
            {
                logo.HRef = "HomePage.aspx";

                menu_home.Visible     = true;
                menu_login.Visible    = true;
                menu_register.Visible = true;
                userPic.Visible       = false;
            }

            try
            {
                ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
                ServiceReference1.UserDetail     user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                ServiceReference1.FileClass      file = serv.getUserImage(user.userValue.UserID);
                MemoryStream ms = new MemoryStream(file.FileBytes, 0, file.FileBytes.Length);
                imgPP.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String(file.FileBytes);
            }
            catch (Exception ex)
            {
                imgPP.ImageUrl = "images/avatar1.png";
            }
        }
Пример #4
0
        /// <summary>
        /// This method is called and executed when the btnUpdate button is clicked.
        /// The user's information is updated
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpdata_Click(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] > 0 && (int)HttpContext.Current.Session["User_lvl"] < 8)
            {
                serv = new ServiceReference1.Service1Client();
                ServiceReference1.UserDetail user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                user.userValue.FirstName = txtFirstName.Text;
                user.userValue.LastName  = txtLastName.Text;

                if (ddlTitle.SelectedIndex > 0)
                {
                    user.userValue.Title = ddlTitle.SelectedItem.Text;
                }

                if (ddlDay1.SelectedIndex > 0 && ddlDay2.SelectedIndex > 0 && ddlMonth.SelectedIndex > 0 && ddlYear1.SelectedIndex > 0 && ddlYear2.SelectedIndex > 0 && ddlYear3.SelectedIndex > 0)
                {
                    string dateStr = ddlYear1.SelectedValue + ddlYear2.SelectedValue + ddlYear3.SelectedValue + "-" + ddlMonth.SelectedValue + "-" + ddlDay1.SelectedValue + ddlDay2.SelectedValue;
                    user.userValue.DateOfBirth = Convert.ToDateTime(dateStr);
                }

                if (ddlProvince.SelectedIndex > 0)
                {
                    user.userValue.Province = ddlProvince.SelectedItem.Text;
                }

                if (rbGender.SelectedIndex == 1)
                {
                    user.userValue.Gender = 'F';
                }
                if (rbGender.SelectedIndex == 0)
                {
                    user.userValue.Gender = 'M';
                }
                if (rbGender.SelectedIndex == 2)
                {
                    user.userValue.Gender = 'O';
                }

                if (fileUpProfilePic.HasFile)
                {
                    try
                    {
                        string filename = Path.GetFileName(fileUpProfilePic.FileName);
                        ServiceReference1.FileClass file = new ServiceReference1.FileClass();
                        file.FilePath  = filename;
                        file.FileBytes = fileUpProfilePic.FileBytes;
                        serv.addUserImage(file, user.userValue.UserID);
                    }
                    catch (Exception ex)
                    {
                    }
                }

                if (serv.UpdateProfile(user))
                {
                    HttpContext.Current.Session["User_FistName"] = user.userValue.FirstName;
                    lblIsValid.Text = "Updated";
                }
                else
                {
                    lblIsValid.Text = "Failed";
                }
            }
        }
        /// <summary>
        /// Data for Businesses are captured and then sent to the the server to the stored in the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnRegBus_Click(object sender, EventArgs e)
        {
            lblWrongText.Visible = false;
            lblReqField.Visible  = false;

            if (fupBus.HasFile)
            {
                if (!txtBusENum.Text.Equals("") && !txtBusName.Text.Equals("") && !txtBusStreet.Text.Equals("") && !txtBusSuburb.Text.Equals("") && !TxtBusCNumber.Text.Equals(""))
                {
                    try
                    {
                        ServiceReference1.Service1Client regBusServ = new ServiceReference1.Service1Client();
                        bool registrationSuccessful = false;

                        business                  = new Business(long.Parse(txtBusENum.Text), txtBusName.Text);
                        business.Street1          = txtBusStreet.Text;
                        business.Suburb1          = txtBusSuburb.Text;
                        business.Province1        = BusDDProvince.SelectedItem.Text;
                        business.ContactNumber1   = TxtBusCNumber.Text;
                        business.Industry1        = ddlBusIndustry.SelectedItem.Text;
                        business.OrganisaionType1 = 2;

                        orgNumber = int.Parse(txtBusENum.Text);

                        registrationSuccessful = regBusServ.addOrganisation(business.OrganisationNumber1, business.OrganisationName1, business.Street1, business.Suburb1, business.Province1, business.COUNTRY1, business.ContactNumber1, business.Industry1, business.OrganisaionType1);

                        string filename = Path.GetFileName(fupBus.FileName);
                        ServiceReference1.FileClass file = new ServiceReference1.FileClass();
                        file.FilePath  = filename;
                        file.FileBytes = fupBus.FileBytes;
                        regBusServ.addOrgFile(file, orgNumber);

                        if (fudBusP.HasFile)
                        {
                            string filePname = Path.GetFileName(fudBusP.FileName);
                            ServiceReference1.FileClass fileP = new ServiceReference1.FileClass();
                            fileP.FilePath  = filePname;
                            fileP.FileBytes = fudBusP.FileBytes;
                            regBusServ.addOrgImage(fileP, orgNumber);
                        }

                        if (registrationSuccessful == true)
                        {
                            regBusDiv.Visible = false;
                            regIndDiv.Visible = true;
                            lblTitleRI.Text   = "Business manager";
                        }
                        else if (registrationSuccessful == false)
                        {
                            lblRegMessage.Text = "Error occured when registering. Please make sure your email has not been registered previously.";
                        }
                    }
                    catch (Exception ex)
                    {
                        lblWrongText.Visible = true;
                    }
                }
                else
                {
                    lblReqField.Visible = true;
                }
            }
            else
            {
                lblReqField.Visible = true;
                lblReqField.Text    = "Please add a file to proof the existance of your NPO!";
            }
        }
        /// <summary>
        /// Data for NPO are captured and then sent to the the server to the stored in the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnRegNPO_Click(object sender, EventArgs e)
        {
            lblWrongInput.Visible = false;
            lblReqField2.Visible  = false;

            if (fupNPO.HasFile)
            {
                if (!txtNPONum.Text.Equals("") && !txtNPOName.Text.Equals("") && !txtNPOStreet.Text.Equals("") && !txtNPOSub.Text.Equals("") && !txtNPONumber.Text.Equals(""))
                {
                    try
                    {
                        ServiceReference1.Service1Client regNPOServ = new ServiceReference1.Service1Client();
                        bool registrationSuccessful = false;

                        npo                  = new NPO(int.Parse(txtNPONum.Text), txtNPOName.Text);
                        npo.Street1          = txtNPOStreet.Text;
                        npo.Suburb1          = txtNPOSub.Text;
                        npo.Province1        = ddlNPOProv.SelectedItem.Text;
                        npo.ContactNumber1   = txtNPONumber.Text;
                        npo.Industry1        = DDLNPOInd.SelectedItem.Text;
                        npo.OrganisaionType1 = 1;
                        orgNumber            = int.Parse(txtNPONum.Text);

                        registrationSuccessful = regNPOServ.addOrganisation(npo.OrganisationNumber1, npo.OrganisationName1, npo.Street1, npo.Suburb1, npo.Province1, npo.COUNTRY1, npo.ContactNumber1, npo.Industry1, npo.OrganisaionType1);


                        string filename = Path.GetFileName(fupNPO.FileName);
                        ServiceReference1.FileClass file = new ServiceReference1.FileClass();
                        file.FilePath  = filename;
                        file.FileBytes = fupNPO.FileBytes;
                        regNPOServ.addOrgFile(file, orgNumber);

                        if (fileUpNPOProfilePic.HasFile)
                        {
                            string filePname = Path.GetFileName(fileUpNPOProfilePic.FileName);
                            ServiceReference1.FileClass fileP = new ServiceReference1.FileClass();
                            fileP.FilePath  = filePname;
                            fileP.FileBytes = fileUpNPOProfilePic.FileBytes;
                            regNPOServ.addOrgImage(fileP, orgNumber);
                        }

                        if (registrationSuccessful == true)
                        {
                            regNPODiv.Visible = false;
                            regIndDiv.Visible = true;
                            lblTitleRI.Text   = "NPO manager";
                        }
                        else if (registrationSuccessful == false)
                        {
                            lblRegMessage.Text = "Error occured when registering. Please make sure your email has not been registered previously.";
                        }
                    }
                    catch (Exception ex)
                    {
                        lblWrongInput.Visible = true;
                    }
                }
                else
                {
                    lblReqField2.Visible = true;
                }
            }
            else
            {
                lblReqField2.Visible = true;
                lblReqField2.Text    = "Please add a file to proof the existance of your NPO!";
            }
        }
Пример #7
0
        /// <summary>
        /// This method is called and executed when the page is loaded.
        /// A specific user's information is displayed on this page.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] > 0 && (int)HttpContext.Current.Session["User_lvl"] < 8)
            {
                btnRemoveOrg.Visible  = false;
                btnRemoveUser.Visible = false;

                try
                {
                    userDiv.Visible            = false;
                    OrgDiv.Visible             = false;
                    VolunteerFrame.Visible     = false;
                    RateReviewNPOFrame.Visible = false;
                    AvgRatingFrame.Visible     = false;

                    if (Request.QueryString["orgId"] != null)
                    {
                        OrgDiv.Visible = true;
                        int tmpID = int.Parse(Request.QueryString["orgId"].ToString());
                        ServiceReference1.Service1Client serv       = new ServiceReference1.Service1Client();
                        ServiceReference1.Organisation   currentOrg = serv.getOrg(tmpID);
                        orgDetailsDiv.InnerHtml = "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr><td><h1>" + currentOrg.OrganisationName + "</h1></td><td></td><td></td><td></td></tr><tr><td><h1>Address:</h1></td><td></td><td></td><td></td></tr><tr><td></td><td>" + currentOrg.Street + "</td><td></td><td></td></tr><tr><td></td><td>" + currentOrg.Suburb + "</td><td></td><td></td></tr><tr><td></td><td>" + currentOrg.Province + "</td><td></td><td></td></tr><tr><td><h1>Contact number:</h1></td><td>" + currentOrg.ContactNumber + "</td><td></td><td></td></tr><tr><td><h1>Industry:</h1></td><td>" + currentOrg.Industry + "</td><td></td><td></td></tr><table>";
                        ServiceReference1.UserDetail u = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];

                        if ((int)HttpContext.Current.Session["User_lvl"] == 7)
                        {
                            btnRemoveOrg.Visible = true;
                        }

                        if (u.AccessLvl == 5)
                        {
                            VolunteerFrame.Visible = true;
                            VolunteerFrame.Src     = "frames/VolunteerPage.aspx?Org_ID=" + tmpID;
                        }

                        if (u.AccessLvl == 5 || u.AccessLvl == 3)
                        {
                            RateReviewNPOFrame.Visible = true;
                            RateReviewNPOFrame.Src     = "frames/RateReviewNPO.aspx?orgId=" + tmpID;
                        }
                        if (currentOrg.OrganisationType == 1)
                        {
                            if (u.AccessLvl == 1 || u.AccessLvl == 2 || u.AccessLvl == 3 || u.AccessLvl == 4 || u.AccessLvl == 5 || u.AccessLvl == 6 || u.AccessLvl == 7)
                            {
                                AvgRatingFrame.Visible = true;
                                AvgRatingFrame.Src     = "frames/AverageRating.aspx?orgId=" + tmpID;
                            }
                        }

                        try
                        {
                            ServiceReference1.UserDetail user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                            ServiceReference1.FileClass  file = serv.getFile(tmpID, true);
                            MemoryStream ms = new MemoryStream(file.FileBytes, 0, file.FileBytes.Length);
                            orgPic.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String(file.FileBytes);
                        }
                        catch (Exception ex)
                        {
                            imgUser.ImageUrl = "~/images/ina.jpg";
                        }
                    }

                    if (Request.QueryString["userId"] != null)
                    {
                        userDiv.Visible = true;
                        int tmpID = int.Parse(Request.QueryString["userId"].ToString());
                        ServiceReference1.Service1Client serv        = new ServiceReference1.Service1Client();
                        ServiceReference1.User           currentUser = serv.getUser(tmpID);
                        IndDetailsDiv.InnerHtml = "<table style='width: 100%; border: solid #ddd; border-width: 1px 1px 1px 1px; clear: both; margin: 10px 0 30px; height: 0;'><tr><td><h1>" + currentUser.FirstNameValue + " " + currentUser.LastNameValue + "</h1></td><td></td><td></td><td></td></tr><tr><td><h2>Email:</h2></td><td>" + currentUser.EmailValue + "</td><td></td><td></td></tr></table>";

                        if ((int)HttpContext.Current.Session["User_lvl"] == 7)
                        {
                            btnRemoveUser.Visible = true;
                        }

                        try
                        {
                            ServiceReference1.UserDetail user = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                            ServiceReference1.FileClass  file = serv.getUserImage(user.userValue.UserID);
                            MemoryStream ms = new MemoryStream(file.FileBytes, 0, file.FileBytes.Length);
                            imgUser.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String(file.FileBytes);
                        }
                        catch (Exception ex)
                        {
                            imgUser.ImageUrl = "~/images/avatar1.png";
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }