コード例 #1
0
        //Populate City,State.Country based on PinCode
        //protected void FillAddress(object sender, EventArgs e)
        //{
        //    txtBoxCity.Text = hdCity.Value;
        //    txtBoxState.Text = hdState.Value;
        //    txtBoxCountry.Text = hdCountry.Value;
        //}
        //Manage Staff Panel Displays
        protected void ManageStaffVisibility(object sender, CommandEventArgs e)
        {
            string cmdName, strCmd = "";
            int    intEmployeeId;

            cmdName = e.CommandName.ToString();

            switch (cmdName)
            {
            case "AddStaff":
                lblStaffAction.Text            = "Add New Staff";
                pnlViewStaff.Visible           = false;
                pnlAddStaff.Visible            = true;
                pnlUploadStaffDocument.Visible = false;
                pnlViewStaffDocuments.Visible  = false;
                pnlHelp.Visible              = false;
                pnlViewStaffProfile.Visible  = false;
                pnlEditStaffProfile.Visible  = false;
                pnlNeuroAcademics.Visible    = false;
                pnlNeuroPublications.Visible = false;
                BD.DataBindToDropDownList(ddlOrgId, string.Format("SELECT OrganizationID,OrganizationName FROM EduSphere.Organizations"));
                BD.DataBindToDropDownList(ddlManagerId, string.Format("SELECT FUllName,MemberID FROM EduSphere.Members"));
                break;

            case "UploadStaffDocument":
                lblStaffAction.Text            = "Upload Staff Document";
                pnlViewStaff.Visible           = false;
                pnlAddStaff.Visible            = false;
                pnlUploadStaffDocument.Visible = true;
                pnlViewStaffDocuments.Visible  = false;
                pnlHelp.Visible              = false;
                pnlEditStaffProfile.Visible  = false;
                pnlViewStaffProfile.Visible  = false;
                pnlNeuroAcademics.Visible    = false;
                pnlNeuroPublications.Visible = false;
                lblEmployeeId.Text           = e.CommandArgument.ToString();
                break;

            case "ViewStaffDocument":
                lblStaffAction.Text            = "View Document";
                pnlViewStaff.Visible           = false;
                pnlAddStaff.Visible            = false;
                pnlUploadStaffDocument.Visible = false;
                pnlViewStaffDocuments.Visible  = true;
                pnlHelp.Visible              = false;
                pnlEditStaffProfile.Visible  = false;
                pnlViewStaffProfile.Visible  = false;
                pnlNeuroAcademics.Visible    = false;
                pnlNeuroPublications.Visible = false;
                intEmployeeId = Convert.ToInt32(e.CommandArgument.ToString());
                string docQuery = string.Format("SELECT * FROM EduSphere.MemberDocuments WHERE MemberID='{0}'", intEmployeeId);
                BD.DataBindToGridView(gvStaffDocuments, docQuery, "NA");
                break;

            case "ViewHelp":
                lblStaffAction.Text            = "View Document";
                pnlViewStaff.Visible           = false;
                pnlAddStaff.Visible            = false;
                pnlUploadStaffDocument.Visible = false;
                pnlViewStaffDocuments.Visible  = false;
                pnlHelp.Visible              = true;
                pnlEditStaffProfile.Visible  = false;
                pnlViewStaffProfile.Visible  = false;
                pnlNeuroAcademics.Visible    = false;
                pnlNeuroPublications.Visible = false;
                //intEmployeeId = Convert.ToInt32(e.CommandArgument.ToString());
                string helpQuery = string.Format("SELECT * FROM EduSphere.HelpDocuments");
                BD.DataBindToGridView(gvHelpDocuments, helpQuery, "NA");
                break;

            case "AcademicDetails":
                string acadQuery = string.Format("SELECT * FROM EduSphere.MemberAcademics where MemberID='{0}'", Convert.ToInt32(e.CommandArgument.ToString()));
                BD.DataBindToDataList(dlAcademicDetails, acadQuery);
                lblEID.Text                    = e.CommandArgument.ToString();
                pnlViewStaff.Visible           = false;
                pnlAddStaff.Visible            = false;
                pnlUploadStaffDocument.Visible = false;
                pnlViewStaffDocuments.Visible  = false;
                pnlHelp.Visible                = false;
                pnlEditStaffProfile.Visible    = false;
                pnlViewStaffProfile.Visible    = false;
                pnlNeuroAcademics.Visible      = true;

                break;

            case "PublicationDetails":
                string pubQuery = string.Format("SELECT * FROM EduSphere.Publications WHERE MemberID='{0}'", Convert.ToInt32(e.CommandArgument.ToString()));
                BD.DataBindToDataList(dlNeuroPublications, pubQuery);
                lblPubEID.Text                 = e.CommandArgument.ToString();
                pnlViewStaff.Visible           = false;
                pnlAddStaff.Visible            = false;
                pnlUploadStaffDocument.Visible = false;
                pnlViewStaffDocuments.Visible  = false;
                pnlHelp.Visible                = false;
                pnlEditStaffProfile.Visible    = false;
                pnlViewStaffProfile.Visible    = false;
                pnlNeuroAcademics.Visible      = false;
                pnlNeuroPublications.Visible   = true;
                pnlNeuroAcademics.Visible      = false;
                pnlNeuroPublications.Visible   = true;
                break;

            case "SearchStaff":
            case "FilterStaff":
                lblStaffAction.Text            = "Search Staff";
                pnlViewStaff.Visible           = true;
                pnlAddStaff.Visible            = false;
                pnlUploadStaffDocument.Visible = false;
                pnlViewStaffDocuments.Visible  = false;
                pnlHelp.Visible              = false;
                pnlViewStaffProfile.Visible  = false;
                pnlEditStaffProfile.Visible  = false;
                pnlAddStaff.Visible          = false;
                pnlNeuroAcademics.Visible    = false;
                pnlNeuroPublications.Visible = false;
                if (cmdName == "FilterStaff")
                {
                    string strEmploymentStatus = ddlFilterEmploymentStatus.SelectedValue.ToString();
                    //Membership will be visible if its in ACTIVE Status, set by ADMIN
                    //string strEmploymentStatus = "ACTIVE";
                    //strCmd = string.Format(@"SELECT OrganizationName,MemberID,FullName,st.PhoneOne,st.Email
                    //                          FROM EduSphere.Members st
                    //                          JOIN EduSphere.Organizations org ON st.OrganizationID=org.OrganizationID
                    //                          WHERE MembershipStatus='{0}' AND st.Email='{1}' ORDER BY st.FullName ASC", strEmploymentStatus,User.Identity.Name.ToString());
                    strCmd = string.Format(@"SELECT OrganizationName,MemberID,FullName,st.PhoneOne,st.Email,st.MembershipStatus 
                                                 FROM EduSphere.Members st 
                                                 JOIN EduSphere.Organizations org ON st.OrganizationID=org.OrganizationID 
                                                 WHERE MembershipStatus='{0}' AND st.Email='{1}' ORDER BY st.FullName ASC", strEmploymentStatus, User.Identity.Name.ToString());
                }
                if (cmdName == "SearchStaff")
                {
                    string strSerachParam = txtBoxSearchStaff.Text;
                    //strCmd = string.Format("SELECT OrganizationName,MemberID,FullName,PhoneOne,Email FROM EduSphere.Members st JOIN EduSphere.Organizations org ON st.OrganizationID=org.OrganizationID WHERE FullName LIKE '%{0}%' OR MemberID LIKE '%{0}%' ORDER BY st.FullName ASC", strSerachParam);
                }
                BD.DataBindToDataList(dlStaff, strCmd);
                break;

            case "ViewProfile":
                lblStaffAction.Text            = "Staff Details";
                pnlViewStaff.Visible           = false;
                pnlAddStaff.Visible            = false;
                pnlUploadStaffDocument.Visible = false;
                pnlViewStaffDocuments.Visible  = true;      //display document alongwith profile
                pnlHelp.Visible              = false;
                pnlViewStaffProfile.Visible  = true;        //display profile details
                pnlEditStaffProfile.Visible  = false;
                pnlAddStaff.Visible          = false;
                pnlNeuroAcademics.Visible    = false;
                pnlNeuroPublications.Visible = false;
                if (cmdName == "ViewProfile")
                {
                    intEmployeeId = Convert.ToInt32(e.CommandArgument.ToString());
                    strCmd        = string.Format(@"SELECT *,(SELECT FullName FROM EduSphere.Members WHERE MemberID=(SELECT MentorID FROM EduSphere.Members WHERE MemberID='{0}')) AS MentorName 
                                                 FROM EduSphere.Members n
                                                 JOIN EduSphere.Programs p ON n.ProgramID=p.ProgramID
                                                 JOIN EduSphere.Organizations edu ON n.OrganizationID=edu.OrganizationID
                                                 WHERE n.MemberID='{0}' AND n.Email='{1}'", intEmployeeId, User.Identity.Name.ToString());
                    BD.DataBindToDataList(dlStaffDetails, strCmd);
                    BD.DataBindToGridView(gvPostalAddresses, string.Format("Select * FROM EduSphere.PostalAddresses WHERE MemberID={0}", intEmployeeId), "NA");
                    //Display Documents too
                    string docQ = string.Format("SELECT * FROM EduSphere.MemberDocuments WHERE MemberID='{0}'", intEmployeeId);
                    BD.DataBindToGridView(gvStaffDocuments, docQ, "NA");

                    //Display Academics
                    string acadQ = string.Format("SELECT * FROM EduSphere.MemberAcademics where MemberID='{0}'", Convert.ToInt32(e.CommandArgument.ToString()));
                    BD.DataBindToGridView(gvViewAcademics, acadQ, "NA");
                    lblEID.Text = e.CommandArgument.ToString();
                }
                break;

            case "EditProfile":
                lblStaffAction.Text            = "Edit Profile";
                lblNeutherapistID.Text         = e.CommandArgument.ToString();
                pnlViewStaff.Visible           = false;
                pnlAddStaff.Visible            = false;
                pnlUploadStaffDocument.Visible = false;
                pnlHelp.Visible = false;
                pnlViewStaffDocuments.Visible = false;
                pnlViewStaffProfile.Visible   = false;
                pnlEditStaffProfile.Visible   = true;
                pnlAddStaff.Visible           = false;
                pnlNeuroAcademics.Visible     = false;
                pnlNeuroPublications.Visible  = false;
                BD.DataBindToDataList(dlEditStaffProfile, string.Format(@"SELECT * FROM EduSphere.Members n 
                                                                                       JOIN EduSphere.Programs p ON n.ProgramID=p.ProgramID
                                                                                       JOIN EduSphere.Organizations o ON n.OrganizationID=o.OrganizationID 
                                                                                       WHERE n.MemberID='{0}'", Convert.ToInt32(e.CommandArgument.ToString())));
                DropDownList ddlOrg         = new DropDownList();
                DropDownList ddlEditProgram = new DropDownList();
                DropDownList ddlManager     = new DropDownList();
                foreach (DataListItem li in dlEditStaffProfile.Items)
                {
                    ddlOrg         = (DropDownList)li.FindControl("ddlEditOrgId");
                    ddlEditProgram = (DropDownList)li.FindControl("ddlEditProgram");
                    ddlManager     = (DropDownList)li.FindControl("ddlEditManagerId");
                }
                BD.DataBindToDropDownList(ddlOrg, string.Format("SELECT OrganizationName, OrganizationID FROM EduSphere.Organizations"));
                BD.DataBindToDropDownList(ddlEditProgram, string.Format("SELECT ProgramTitle, ProgramID FROM EduSphere.Programs"));
                BD.DataBindToDropDownList(ddlManager, string.Format("SELECT MemberID, FullName FROM EduSphere.Members"));
                break;

            case "ViewEnrolmentCertificate":
                //PG.EnrolmentCertificate(102);
                string strTemplate = "~/Artifacts/Members/MembershipTemplate.pdf";
                int    intMemberID = Convert.ToInt32(e.CommandArgument.ToString());
                PG.GeneratePdfFromPdfTemplate(strTemplate, intMemberID);
                break;

            case "TopnlProfileEditFrompnlUploadStaffDocument":
                pnlUploadStaffDocument.Visible = false;
                pnlEditStaffProfile.Visible    = true;
                break;

            case "TopnlProfileEditFrompnlNeuroAcademics":
                pnlNeuroAcademics.Visible   = false;
                pnlEditStaffProfile.Visible = true;
                break;

            case "ReturnToViewStaff":
                Response.Redirect("Admission.aspx");
                break;

            default:
                break;
            }
        }