Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
            {
                strPost = CCLib.Common.Strings.GetFormString("post");
                if (strPost == "1" && Session["RegionAdminInfo"] != null)
                {
                    DataRow drAdminInfo = (DataRow)Session["RegionAdminInfo"];
                    //CCLib.Common.DataAccess.ExecuteDb("update RRS_Login_View set Agreement=1 where RegionId='" + drAdminInfo["RegionId"].ToString().Replace("'", "''") + "' and Password='******'", "''") + "'");
                    //
                    this.strPassword = drAdminInfo["Password"].ToString().Replace("'", "''");
                    this.strRegionID = drAdminInfo["RegionId"].ToString();
                    this.strConnectionStringToSLX = WebConfigurationManager.AppSettings["strConSLX"];
                    this.strConnectionStringToCC = WebConfigurationManager.AppSettings["strConLocal"];

                    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
                    System.Net.ServicePointManager.CertificatePolicy = new CareerCruisingWeb.CCLib.SLXIntegration.TrustAllCertificatePolicy();
                    this.wsSLXIntegration = new WSCCIntegrationWithSLX.IntegrationWithSLX();
                    this.userCredential = new System.Net.NetworkCredential("WSCCTOSLX", "Next_20");
                    this.wsSLXIntegration.Credentials = userCredential;
                    this.wsSLXIntegration.PreAuthenticate = true;

                    this.cnnCC = new SqlConnection(this.strConnectionStringToCC);
                    if (this.cnnCC.State == ConnectionState.Closed)
                    {
                        this.cnnCC.Open();
                    }
                    this.trsCC = this.cnnCC.BeginTransaction();

                    this.objDistrictUserID = SqlHelper.ExecuteScalar(this.trsCC, CommandType.Text, this.GetCCSQLSelectDistrictUserID(this.strPassword, this.strRegionID));
                    this.strDistrictUserID = this.objDistrictUserID != null ? this.objDistrictUserID.ToString() : null;

                    this.intReturnValue1 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLUpdateRRSUsers(this.strDistrictUserID), this.cnnCC, this.trsCC);
                    if (this.intReturnValue1 > 0)
                    {
                        this.intReturnValue2 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLUpdateConRRSUsers(this.strDistrictUserID), this.strConnectionStringToSLX);
                        if (this.intReturnValue2 > 0)
                        {
                            this.trsCC.Commit();
                            this.ReleaseObjects();
                        }
                        else
                        {
                            this.trsCC.Rollback();
                            this.ReleaseObjects();
                        }
                    }
                    else
                    {
                        this.trsCC.Rollback();
                        this.ReleaseObjects();
                    }

                    //

                    Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + "/Region/Home.aspx");

                }
            }
        }
Example #2
0
        private void ReleaseObjects()
        {
            this.trsCC = null;

            if (this.cnnCC.State == ConnectionState.Open)
            {
                this.cnnCC.Close();
            }

            this.userCredential = null;
            this.wsSLXIntegration = null;
            this.objDistrictUserID = null;
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Check Login

            CheckSchoolAdminSession();

            #endregion Check Login

            strLoggedInAdminID = AdminInfo["AdminID"].ToString();
            strLoggedInUsernameSQL = "SELECT FirstName + ' ' + LastName AS Username FROM PortfolioAdmin WHERE AdminID = " + strLoggedInAdminID;
            dtLoggedInUsername = CCLib.Common.DataAccess.GetDataTable(strLoggedInUsernameSQL);
            strLoggedInUsername = dtLoggedInUsername.Rows[0]["Username"].ToString();

            dtSecurityLevels = CCLib.Cache.GetCachedDataTable("SecurityLevels-" + PortTypeID + SuffixCode(), "select *, SecurityName" + SuffixCode() + " SecurityName, Description" + SuffixCode() + " Description from PortfolioAdminSecurity where PortTypeID = " + PortTypeID + " order by SecurityLevel DESC");
            SchoolID = AdminInfo["SchoolID"] != null ? AdminInfo["SchoolID"].ToString() : null;
            SchoolUsername = AdminInfo["SchoolUsername"] != null ? (AdminInfo["SchoolUsername"].ToString().Trim().Length > 50 ? AdminInfo["SchoolUsername"].ToString().Trim().Substring(0, 50) : AdminInfo["SchoolUsername"].ToString().Trim()) : null;
            this.strConnectionStringToSLX = WebConfigurationManager.AppSettings["strConSLX"];
            this.strConnectionStringToCC = WebConfigurationManager.AppSettings["strConLocal"];
            uc1.argTitle = new string[] { "Transcript Specialist", "" };
            uc1.argContent = new string[] { @"Transcript Specialists handle the processing of requests by students to have their transcripts submitted to colleges and other institutions.
            <br /><br />
            Transcripts are printed from the student information system, mapped to student accounts in Career Cruising, and are then available to be sent electronically to colleges.
            <br /><br />
            You can also track paper transcripts that are mailed to colleges that do not accept electronic transcripts." };
            uc1.intTagNum = 1;
            uc1.TagID = new string[] { "1" };
            uc1.strBgColor = "#f0ede3";
            uc1.strHeader = "contentTableHeaderDarkBG";
            uc1.ShowDirection = "right-bottom";

            uc2.argTitle = new string[] { "Transcript Specialist", "" };
            uc2.argContent = new string[] { @"Transcript Specialists handle the processing of requests by students to have their transcripts submitted to colleges and other institutions.
            <br /><br />
            Transcripts are printed from the student information system, mapped to student accounts in Career Cruising, and are then available to be sent electronically to colleges.
            <br /><br />
            You can also track paper transcripts that are mailed to colleges that do not accept electronic transcripts." };
            uc2.intTagNum = 1;
            uc2.TagID = new string[] { "2" };
            uc2.strBgColor = "#f0ede3";
            uc2.strHeader = "contentTableHeaderDarkBG";
            uc2.ShowDirection = "right-bottom";
            if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
            {
                //For Web Services Model
                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
                System.Net.ServicePointManager.CertificatePolicy = new CareerCruisingWeb.CCLib.SLXIntegration.TrustAllCertificatePolicy();
                wstest = new WSCCIntegrationWithSLX.IntegrationWithSLX();
                System.Net.NetworkCredential userCredential = new System.Net.NetworkCredential("WSCCTOSLX", "Next_20");
                wstest.Credentials = userCredential;
                wstest.PreAuthenticate = true;
                this.connCC = new SqlConnection(strConnectionStringToCC);

                strMAForm = CCLib.Common.Strings.GetFormString("MAForm");

                string strFirstName = CareerCruisingWeb.CCLib.Common.Strings.ConvertStringToTitleCase(CCLib.Common.Strings.FormatUserInput(CCLib.Common.Strings.GetFormString("FirstName")));
                string strLastName = CareerCruisingWeb.CCLib.Common.Strings.ConvertStringToTitleCase(CCLib.Common.Strings.FormatUserInput(CCLib.Common.Strings.GetFormString("LastName")));
                string strEmail = CCLib.Common.Strings.FormatUserInput(CCLib.Common.Strings.GetFormString("Email"));
                string strPortfolioAdminEmail = CCLib.Common.Strings.FormatUserInput(CCLib.Common.Strings.GetFormString("Email"));
                string strPassword = CCLib.Common.Strings.GetFormString("Password").Replace("'", "''");
                string strSecurityLevel = CCLib.Common.Strings.GetFormString("SecurityLevel");
                string strDisplayName = CCLib.Common.Strings.FormatUserInput(CCLib.Common.Strings.GetFormString("DisplayName"));
                string strSecCodeID = "SYST00000001";
                object objLicenseType = wstest.GetValueFromSLX(this.GetSLXSQLSelectLicenseType(), this.strConnectionStringToSLX);
                string strLicenseType = objLicenseType != null ? objLicenseType.ToString() : null;
                string strTranscript = (CCLib.Common.Strings.GetFormString("cbTranscript") == "1") ? "1" : "0";

                bool booIsLOK;      //For License Type: L--Licensed, O--Ontario, K--Kentucky

                ViewState["Email"] = strEmail;

                switch (strMAForm)
                {
                    case "1":
                        // New advisor posting
                        if (CheckForPwdConflict(strPassword))
                        {
                            Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8246).Replace("'", "\\'")));
                        }
                        else
                        {
                            if ((this.wstest.GetRecordCount(this.GetSLXSQLContactExists(strFirstName, strLastName), this.strConnectionStringToSLX, true) == 1) & (!IntegrationWithSLX.CheckExists(this.GetCCSQLAdminIDExists(strFirstName, strLastName), this.strConnectionStringToCC)))
                            {
                                if (this.connCC.State == ConnectionState.Closed)
                                {
                                    this.connCC.Open();
                                }

                                this.tranConnCC = this.connCC.BeginTransaction();
                                this.intReturnValue1 = IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLInsertAdminPassword(strPassword, strFirstName, strLastName, strPortfolioAdminEmail, strSecurityLevel,strTranscript), this.connCC, this.tranConnCC);
                                this.objAdminID = SqlHelper.ExecuteScalar(this.tranConnCC, CommandType.Text, this.GetCCSQLSelectAdminID(strPassword));
                                this.strAdminID = this.objAdminID != null ? this.objAdminID.ToString() : null;
                                this.intReturnValue6 = IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLInsertAdminName(strFirstName,strLastName,strDisplayName), this.connCC, this.tranConnCC);

                                if ((this.intReturnValue1 > 0)&(this.intReturnValue6 > 0))
                                {
                                    this.objContactID = this.wstest.GetValueFromSLX(this.GetSLXSQLContactExists(strFirstName, strLastName), this.strConnectionStringToSLX);
                                    this.strContactID = this.objContactID != null ? this.objContactID.ToString() : null;
                                    //this.objAdminID = SqlHelper.ExecuteScalar(this.tranConnCC, CommandType.Text, this.GetCCSQLSelectAdminID(strPassword));
                                    //this.strAdminID = this.objAdminID != null ? this.objAdminID.ToString() : null;

                                    if (this.wstest.CheckExists(this.GetSLXSQLEmailExists(strEmail, this.strContactID), this.strConnectionStringToSLX, true))
                                    {
                                        strEmail = null;
                                    }

                                    this.intReturnValue2 = this.wstest.ExecuteNoQuery(this.GetSLXSQLUpdateContactEmail(this.strContactID, strEmail), this.strConnectionStringToSLX);
                                    if (this.intReturnValue2 > 0)
                                    {
                                        this.intReturnValue4 = this.wstest.ExecuteNoQuery(this.GetSLXSQLInsertAdminPassword(this.strContactID, strPassword, strSecurityLevel, this.strAdminID, strLicenseType), this.strConnectionStringToSLX);
                                    }
                                    else
                                    {
                                        this.intReturnValue4 = 0;
                                    }

                                    if ((this.intReturnValue2 > 0) & (this.intReturnValue4 > 0))
                                    {
                                       this.tranConnCC.Commit();
                                       TrackChanges(1);

                                       if (CCLib.Common.Strings.GetFormString("chkEmail").ToString() == "on")
                                           SendEmailToNewAdvisor(strFirstName, ViewState["Email"].ToString());

                                       Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8247)));
                                    }
                                    else
                                    {
                                       this.tranConnCC.Rollback();
                                       Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8248)));
                                    }
                                }
                                else
                                {
                                    this.tranConnCC.Rollback();
                                    this.Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8248)));
                                }
                            }
                            else
                            {

                                if (this.wstest.CheckExists(this.GetSLXSQLEmailExists(strEmail), this.strConnectionStringToSLX, true))
                                {
                                    strEmail = null;
                                }

                                if (this.connCC.State == ConnectionState.Closed)
                                {
                                    this.connCC.Open();
                                }

                                this.tranConnCC = this.connCC.BeginTransaction();
                                this.intReturnValue1 = IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLInsertAdminPassword(strPassword, strFirstName, strLastName, strPortfolioAdminEmail, strSecurityLevel,strTranscript), this.connCC, this.tranConnCC);
                                this.objAdminID = SqlHelper.ExecuteScalar(this.tranConnCC, CommandType.Text, this.GetCCSQLSelectAdminID(strPassword));
                                this.strAdminID = this.objAdminID != null ? this.objAdminID.ToString() : null;
                                this.intReturnValue6 = IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLInsertAdminName(strFirstName, strLastName, strDisplayName), this.connCC, this.tranConnCC);
                                if ((this.intReturnValue1 > 0) & (this.intReturnValue6 > 0))
                                {
                                    this.objContactID = this.wstest.GetNewSLXID("Contact", this.strConnectionStringToSLX);
                                    this.strContactID = this.objContactID != null ? this.objContactID.ToString() : null;
                                    //this.objAdminID = SqlHelper.ExecuteScalar(this.tranConnCC, CommandType.Text, this.GetCCSQLSelectAdminID(strPassword));
                                    //this.strAdminID = this.objAdminID != null ? this.objAdminID.ToString() : null;

                                    //if ((strLicenseType == "Licensed") | (strLicenseType == "Ontario") | (strLicenseType == "Kentucky") | (strLicenseType == "Delaware") | (strLicenseType == "Manitoba") | (strLicenseType == "South Dakota"))
                                    //{
                                       booIsLOK = true;
                                    //}
                                    //else
                                    //{
                                    //   booIsLOK = false;
                                    //}

                                    this.objAccountID = this.wstest.GetValueFromSLX(this.GetSLXSQLSelectAccountID(), this.strConnectionStringToSLX);
                                    this.strAccountID = this.objAccountID != null ? this.objAccountID.ToString() : null;
                                    this.objAccount = this.wstest.GetValueFromSLX(this.GetSLXSQLSelectAccount(), this.strConnectionStringToSLX);
                                    this.strAccount = this.objAccount != null ? this.objAccount.ToString().Replace("'", "''") : null;
                                    this.objAddressID = this.wstest.GetNewSLXID("Address", this.strConnectionStringToSLX);
                                    this.strAddressID = this.objAddressID != null ? this.objAddressID.ToString() : null;

                                    this.intReturnValue2 = this.wstest.ExecuteNoQuery(this.GetSLXSQLInsertContact(this.strContactID, this.strAccountID, this.strAccount, strFirstName, strLastName, strEmail, strSecCodeID, strAddressID), this.strConnectionStringToSLX);
                                    if (this.intReturnValue2 > 0)
                                    {
                                        this.intReturnValue3 = this.wstest.ExecuteNoQuery(this.GetSLXSQLSetReceiveNewsLetter(this.strContactID, booIsLOK, strFirstName), this.strConnectionStringToSLX);
                                       if (this.intReturnValue3 > 0)
                                       {
                                          this.intReturnValue4 = this.wstest.ExecuteNoQuery(this.GetSLXSQLInsertAdminPassword(this.strContactID, strPassword, strSecurityLevel, this.strAdminID, strLicenseType), this.strConnectionStringToSLX);
                                          if (this.intReturnValue4 > 0)
                                          {
                                             this.intReturnValue5 = this.wstest.ExecuteNoQuery(this.GetSLXSQLInsertAddress(this.strAddressID, this.strContactID), this.strConnectionStringToSLX);
                                          }
                                       }
                                    }

                                    if ((this.intReturnValue2 > 0) & (this.intReturnValue3 > 0) & (this.intReturnValue4 > 0) & (this.intReturnValue5 > 0))
                                    {
                                       this.tranConnCC.Commit();
                                       TrackChanges(1);

                                       if (CCLib.Common.Strings.GetFormString("chkEmail").ToString() == "on")
                                           SendEmailToNewAdvisor(strFirstName, ViewState["Email"].ToString());

                                       Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8247)));
                                    }
                                    else
                                    {
                                       this.tranConnCC.Rollback();
                                       Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8248)));
                                    }
                                }
                                else
                                {
                                    this.tranConnCC.Rollback();
                                    Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8248)));
                                }
                            }
                        }

                        this.ReleaseDBObjects();

                        break;

                    case "2":
                        // Update Advisor
                        this.strAdminID = CCLib.Common.Strings.GetFormString("AdminID");

                        strFN = CCLib.Common.Strings.GetFormString("hidFN");
                        strLN = CCLib.Common.Strings.GetFormString("hidLN");
                        strDN = CCLib.Common.Strings.GetFormString("hidDN");
                        strEA = CCLib.Common.Strings.GetFormString("hidEA");
                        strPW = CCLib.Common.Strings.GetFormString("hidPW");
                        strAT = CCLib.Common.Strings.GetFormString("hidAT");

                        if (CheckForPwdConflict(strPassword, strAdminID))
                        {
                            Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8246).Replace("'", "\\'")));
                        }
                        else
                        {
                            this.objContactID = this.wstest.GetValueFromSLX(this.GetSLXSQLSelectContactID(this.strAdminID), this.strConnectionStringToSLX);
                            this.strContactID = this.objContactID != null ? this.objContactID.ToString() : null;

                            if (this.wstest.CheckExists(this.GetSLXSQLEmailExists(strEmail, this.strContactID), this.strConnectionStringToSLX, true))
                            {
                                strEmail = null;
                            }

                            if (this.connCC.State == ConnectionState.Closed)
                            {
                                this.connCC.Open();
                            }
                            this.tranConnCC = this.connCC.BeginTransaction();
                            this.intReturnValue1 = IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLUpdateAdminPassword(strFirstName, strLastName, strPortfolioAdminEmail, strPassword, strSecurityLevel, this.strAdminID, strTranscript), this.connCC, this.tranConnCC);
                            this.intReturnValue6 = IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLUpdateAdminName(strFirstName, strLastName, this.strAdminID, strDisplayName), this.connCC, this.tranConnCC);

                            if ((this.intReturnValue1 > 0) & (this.intReturnValue6 > 0))
                            {
                               object objPrefix;
                               string strDearValue;
                               objPrefix = this.wstest.GetValueFromSLX(this.GetSLXSQLSelectContactPrefix(this.strContactID), this.strConnectionStringToSLX);

                               if (objPrefix != null)
                               {
                                   if (objPrefix.ToString() != "")
                                   {
                                       strDearValue = objPrefix.ToString() + " " + strLastName;
                                   }
                                   else
                                   {
                                       strDearValue = strFirstName;
                                   }
                               }
                               else
                               {
                                   strDearValue = strFirstName;
                               }

                               this.intReturnValue2 = this.wstest.ExecuteNoQuery(this.GetSLXSQLUpdateContact(strFirstName, strLastName, strEmail, strDearValue, this.strContactID), this.strConnectionStringToSLX);
                               if (this.intReturnValue2 > 0)
                               {
                                   this.intReturnValue3 = this.wstest.ExecuteNoQuery(this.GetSLXSQLUpdateAdminPassword(strPassword, strSecurityLevel, this.strAdminID, strLicenseType), this.strConnectionStringToSLX);
                               }

                               if ((this.intReturnValue2 > 0) & (this.intReturnValue3 > 0))
                               {
                                  this.tranConnCC.Commit();
                                  TrackChanges(3);
                                  //Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8249)));
                               }
                               else
                               {
                                  this.tranConnCC.Rollback();
                                  //Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8250)));
                               }
                            }
                            else
                            {
                                this.tranConnCC.Rollback();
                                //Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8250)));
                            }

                            this.ReleaseDBObjects();

                            Response.Redirect("ManageAdvisors.aspx?A=U");
                        }

                        this.ReleaseDBObjects();

                        break;
                }
            }

            strMASection = (CCLib.Common.Strings.GetQueryString("F").Length > 0) ? CCLib.Common.Strings.GetQueryString("F") : "List";
            switch (strMASection)
            {
                case "List":
                    if (CCLib.Common.Strings.GetQueryString("A") == "U")
                        Response.Write(CCLib.Common.Forms.JavaScriptNotify("The advisor has been updated."));

                    strCol = CCLib.Common.Strings.GetQueryString("col");
                    strOrder = CCLib.Common.Strings.GetQueryString("storder");
                    strTranscriptOnly = CCLib.Common.Strings.GetQueryString("T");

                    if (strCol == "")
                        strCol = "2";
                    string strListSQL = "Select FirstName, LastName, AdminPassword, SecurityLevel, AdminID, TranscriptSpecialist from PortfolioAdmin where SchoolID=" + AdminInfo["SchoolID"].ToString();

                    if (strTranscriptOnly == "1")
                        strListSQL += " and TranscriptSpecialist=1";
                    strListSQL += " order by " + strCol + " " + strOrder;
                    dtAdvisorList = CCLib.Common.DataAccess.GetDataTables(strListSQL);
                    if (strOrder == "")
                        strNextStOrder = "desc";
                    else
                        strNextStOrder = "";
                    break;

                case "New":
                    // New Advisor Form

                    break;

                case "Stu":
                    string command = null;

                    //Assigned Student List
                    strAdminID = CCLib.Common.Strings.GetQueryString("I");
                    //string strSort = (CCLib.Common.Strings.GetQueryString("ST").Length > 0) ? CCLib.Common.Strings.GetQueryString("ST") : "2";
                    strCol = (CCLib.Common.Strings.GetQueryString("Col"));
                    strOrder = (CCLib.Common.Strings.GetQueryString("storder"));

                    if (strCol == "")
                        strCol = "2";

                    command += "Select StudentFirstName, StudentLastName, GradeNumber, UserName, PassWord, AdvisorFirstName, AdvisorLastName from PortfolioAdvisorAssignmentView where SchoolID=" + AdminInfo["SchoolID"].ToString() + " and AdminID=" + strAdminID + " order by " + strCol + " " + strOrder;

                    //for reverse sort
                    if (strOrder == "")
                        strNextStOrder = "Desc";
                    else
                        strNextStOrder = "";

                    if (strCol == "2")
                    {
                        command += ", StudentFirstName;";
                    }
                    else
                    {
                        command += ", StudentLastName, StudentFirstName;";
                    }

                    command += "select FirstName, LastName from PortfolioAdmin where AdminID=" + strAdminID;
                    dtAdvisorList = CCLib.Common.DataAccess.GetDataTables(command);
                    break;

                case "Del":
                    //Delete advisor

                    //For Web Services Model
                    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
                    System.Net.ServicePointManager.CertificatePolicy = new CareerCruisingWeb.CCLib.SLXIntegration.TrustAllCertificatePolicy();
                    wstest = new WSCCIntegrationWithSLX.IntegrationWithSLX();
                    System.Net.NetworkCredential userCredential = new System.Net.NetworkCredential("WSCCTOSLX", "Next_20");
                    wstest.Credentials = userCredential;
                    wstest.PreAuthenticate = true;
                    this.connCC = new SqlConnection(strConnectionStringToCC);

                    strAdminID = CCLib.Common.Strings.GetQueryString("I");

                    if (this.connCC.State == ConnectionState.Closed)
                    {
                        this.connCC.Open();
                    }
                    this.tranConnCC = this.connCC.BeginTransaction();
                    this.intReturnValue1 = IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLDeleteAdminPassword(strAdminID), this.connCC, this.tranConnCC);
                    this.intReturnValue2 = IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLDeleteAdvisorAssignments(strAdminID), this.connCC, this.tranConnCC);

                    if ((intReturnValue1 > 0) & (intReturnValue2 > 0))
                    {
                        object objHistoryID = this.wstest.GetNewSLXID("History", this.strConnectionStringToSLX);
                        string strHistoryID = objHistoryID != null ? objHistoryID.ToString() : null;
                        this.objContactID = this.wstest.GetValueFromSLX(this.GetSLXSQLSelectContactID(this.strAdminID), this.strConnectionStringToSLX);
                        this.strContactID = this.objContactID != null ? this.objContactID.ToString() : null;
                        this.objAccountID = this.wstest.GetValueFromSLX(this.GetSLXSQLSelectAccountID(), this.strConnectionStringToSLX);
                        this.strAccountID = this.objAccountID != null ? this.objAccountID.ToString() : null;
                        this.objAccount = this.wstest.GetValueFromSLX(this.GetSLXSQLSelectAccount(), this.strConnectionStringToSLX);
                        this.strAccount = this.objAccount != null ? this.objAccount.ToString().Replace("'", "''") : null;
                        object objContactName = this.wstest.GetValueFromSLX(this.GetSLXSQLSelectContactName(strContactID), this.strConnectionStringToSLX);
                        string strContactName = objContactName != null ? objContactName.ToString() : null;
                        string strLogType = "262148";      //Type: 262148 -- "Note"
                        string strDescription = "Admin password deleted";

                        this.intReturnValue3 = this.wstest.ExecuteNoQuery(this.GetSLXSQLDeleteAdminPassword(strAdminID), this.strConnectionStringToSLX);
                        if (this.intReturnValue3 > 0)
                        {
                            this.intReturnValue4 = this.wstest.ExecuteNoQuery(this.GetSLXSQLLogDeletion(strHistoryID, strContactID, strContactName, strLogType, strDescription, strAccountID, strAccount), this.strConnectionStringToSLX);
                        }
                        else
                        {
                            this.intReturnValue4 = 0;
                        }

                        if ((this.intReturnValue3 > 0) & (this.intReturnValue4 > 0))
                        {
                            this.tranConnCC.Commit();
                            TrackChanges(2);
                            //Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8251)));
                        }
                        else
                        {
                            this.tranConnCC.Rollback();
                            //Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8252)));
                        }
                    }
                    else
                    {
                        this.tranConnCC.Rollback();
                        //Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8252)));
                    }

                    this.ReleaseDBObjects();

                    Response.Redirect("ManageAdvisors.aspx");

                    break;

                case "Edit":
                    //Edit Advisor Info
                    strAdminID = CCLib.Common.Strings.GetQueryString("I");
                    strSQL = "select a.LastName, a.FirstName, a.Email, a.AdminPassword, a.SecurityLevel, a.AdminID, n.DisplayName, a.TranscriptSpecialist from PortfolioAdmin a join PortfolioAdminNames n on a.AdminID=n.AdminID where a.AdminID=" + strAdminID;
                    dtAdvisorList = CCLib.Common.DataAccess.GetDataTables(strSQL);
                    strFN = dtAdvisorList[0].Rows[0]["FirstName"].ToString();
                    strLN = dtAdvisorList[0].Rows[0]["LastName"].ToString();
                    strDN = dtAdvisorList[0].Rows[0]["DisplayName"].ToString();
                    strEA = dtAdvisorList[0].Rows[0]["Email"].ToString();
                    strPW = dtAdvisorList[0].Rows[0]["AdminPassword"].ToString();
                    strAT = dtAdvisorList[0].Rows[0]["SecurityLevel"].ToString();
                    break;
            }

            #region Properties For The School Base Class
            TitleBar = TextCode(8242);
            SubTitleBar = TextCode(8243);
            #endregion Properties For The School Base Class
        }
Example #4
0
 protected void ReleaseDBObjects()
 {
     this.tranConnCC = null;
     if (this.connCC.State == ConnectionState.Open)
     {
         this.connCC.Close();
     }
     this.connCC = null;
     this.wstest = null;
 }
Example #5
0
        private void ReleaseObjects()
        {
            this.trsCC = null;

            if (this.cnnCC.State == ConnectionState.Open)
            {
                this.cnnCC.Close();
            }

            this.userCredential = null;
            this.wsSLXIntegration = null;
            this.objHistoryID = null;
            this.objContactID = null;
            this.objAccountID = null;
            this.objAccount = null;
            this.objContactName = null;
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Check Login
            CheckRegionAdminSession();
            #endregion Check Login

            #region Initialize Values and Form Execution
            //form post and execution
            strCol = CCLib.Common.Strings.GetQueryString("col");
            strOrder = CCLib.Common.Strings.GetQueryString("storder");

            if (strCol == "")
                strCol = "3";

            strSQL = "select DistrictUserID,FirstName,LastName,Password,SecurityLevel from RRSUsers where RegionID = '" + AdminInfo["RegionID"].ToString() + "' order by " + strCol + " " + strOrder;
            dtAdmin = CCLib.Common.DataAccess.GetDataTable(strSQL);

            if (strOrder == "")
                strNextStOrder = "desc";
            else
                strNextStOrder = "";

            if (Page.IsPostBack)
            {
                strDistrictUserID = CCLib.Common.Strings.GetQueryString("ID");
                if (strDistrictUserID != "")
                {
                    //CCLib.Common.DataAccess.ExecuteNonQuery("Delete from RRSUsers where DistrictUserID=" + strID);
                    //

                    this.strRegionID = AdminInfo["RegionID"].ToString();
                    this.strConnectionStringToSLX = WebConfigurationManager.AppSettings["strConSLX"];
                    this.strConnectionStringToCC = WebConfigurationManager.AppSettings["strConLocal"];

                    this.cnnCC = new SqlConnection(this.strConnectionStringToCC);

                    if (this.cnnCC.State == ConnectionState.Closed)
                    {
                       this.cnnCC.Open();
                    }
                    this.trsCC = this.cnnCC.BeginTransaction();

                    this.intReturnValue1 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLDeleteRRSUsers(this.strDistrictUserID), this.cnnCC, this.trsCC);

                    if (this.intReturnValue1 > 0)
                    {
                        System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
                        System.Net.ServicePointManager.CertificatePolicy = new CareerCruisingWeb.CCLib.SLXIntegration.TrustAllCertificatePolicy();
                        this.wsSLXIntegration = new WSCCIntegrationWithSLX.IntegrationWithSLX();
                        this.userCredential = new System.Net.NetworkCredential("WSCCTOSLX", "Next_20");
                        this.wsSLXIntegration.Credentials = userCredential;
                        this.wsSLXIntegration.PreAuthenticate = true;

                        this.objHistoryID = this.wsSLXIntegration.GetNewSLXID("History", this.strConnectionStringToSLX);
                        this.strHistoryID = objHistoryID != null ? objHistoryID.ToString() : null;
                        this.objContactID = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectContactID(this.strDistrictUserID), this.strConnectionStringToSLX);
                        this.strContactID = this.objContactID != null ? this.objContactID.ToString() : null;
                        this.objAccountID = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectAccountID(this.strRegionID), this.strConnectionStringToSLX);
                        this.strAccountID = this.objAccountID != null ? this.objAccountID.ToString() : null;
                        this.objAccount = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectAccount(this.strRegionID), this.strConnectionStringToSLX);
                        this.strAccount = this.objAccount != null ? CCLib.Common.Strings.FormatUserInput(this.objAccount.ToString()) : null;
                        object objContactName = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectContactName(this.strContactID), this.strConnectionStringToSLX);
                        string strContactName = objContactName != null ? CCLib.Common.Strings.FormatUserInput(objContactName.ToString()) : null;
                        string strLogType = "262148";      //Type: 262148 -- "Note"
                        string strDescription = "RRS Account Deleted";

                        this.intReturnValue2 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLLogDeletion(strHistoryID, strContactID, strContactName, strLogType, strDescription, strAccountID, strAccount), this.strConnectionStringToSLX);
                        if (this.intReturnValue2 > 0)
                        {
                            this.intReturnValue3 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLDeleteRRSConRRSUsers(strDistrictUserID), this.strConnectionStringToSLX);
                        }

                        if ((this.intReturnValue2 > 0) & (this.intReturnValue3 > 0))
                        {

                            this.trsCC.Commit();
                            this.ReleaseObjects();
                            Response.Redirect("AccessAccounts.aspx");

                        }
                        else
                        {
                            this.trsCC.Rollback();
                            this.ReleaseObjects();
                            Response.Write(CCLib.Common.Forms.JavaScriptNotify("The RRS user has failed to delete. Plesae try again."));

                        }
                    }
                    else
                    {
                        this.trsCC.Rollback();
                        this.ReleaseObjects();
                        Response.Write(CCLib.Common.Forms.JavaScriptNotify("The RRS user has failed to delete. Plesae try again."));

                    }

                    //
                    //Response.Redirect("AccessAccounts.aspx");
                }
            }
            //generate values
            #endregion Initialize Values and Form Execution

            #region Properties For The Region Base Class
            TitleBar = "Access Accounts";
            SubTitleBar = PortTypeSettings["DistrictAdminName"].ToString();
            #endregion Properties For The Region Base Class
        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
            {
                strPost = CCLib.Common.Strings.GetFormString("post");

                if (strPost == "1" && Session["SchoolAdminInfo"] != null)
                {

                    //For Web Services Model
                    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
                    System.Net.ServicePointManager.CertificatePolicy = new CareerCruisingWeb.CCLib.SLXIntegration.TrustAllCertificatePolicy();
                    wstest = new WSCCIntegrationWithSLX.IntegrationWithSLX();
                    System.Net.NetworkCredential userCredential = new System.Net.NetworkCredential("WSCCTOSLX", "Next_20");
                    wstest.Credentials = userCredential;
                    wstest.PreAuthenticate = true;

                    DataRow drAdminInfo = (DataRow)Session["SchoolAdminInfo"];

                    if (drAdminInfo["IsCcSpark"].ToString() == "True" && drAdminInfo["LicenseType"].ToString() == "ccSpark only")
                        strDefaultHomepage = "/School/CCSparkHome.aspx";

                    this.strConnectionStringToSLX = WebConfigurationManager.AppSettings["strConSLX"];
                    this.strConnectionStringToCC = WebConfigurationManager.AppSettings["strConLocal"];
                    this.connCC = new SqlConnection(strConnectionStringToCC);
                    this.strSchoolID = drAdminInfo["SchoolId"] != null ? drAdminInfo["SchoolId"].ToString() : null;
                    this.strPassword = drAdminInfo["AdminPassword"] != null ? drAdminInfo["AdminPassword"].ToString() : null;

                    this.objAdminID = SqlHelper.ExecuteScalar(this.strConnectionStringToCC, CommandType.Text, this.GetCCSQLSelectAdminID(this.strSchoolID, this.strPassword));
                    this.strAdminID = this.objAdminID != null ? this.objAdminID.ToString().Replace("'", "''") : null;

                    if (this.connCC.State == ConnectionState.Closed)
                    {
                        this.connCC.Open();
                    }
                    this.tranConnCC = this.connCC.BeginTransaction();
                    this.intReturnValue1 = IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLUpdateAgreement(this.strSchoolID, this.strPassword), this.connCC, this.tranConnCC);
                    //this.intReturnValue1 = CCLib.Common.DataAccess.ExecuteDbWithIntResult(this.GetCCSQLUpdateAgreement(this.strSchoolID, this.strPassword));
                    if (this.intReturnValue1 > 0)
                    {
                        this.intReturnValue2 = this.wstest.ExecuteNoQuery(this.GetSLXSQLUpdateAgreement(strAdminID), this.strConnectionStringToSLX);
                        //this.intReturnValue2 = CCLib.Common.DataAccess.ExecuteDbWithIntResult(this.GetSLXSQLUpdateAgreement(strAdminID));
                        //this.intReturnValue2 = CCLib.Common.DataAccess.ExecuteNonQuery(this.GetSLXSQLUpdateAgreement(strAdminID));
                        if (this.intReturnValue2 > 0)
                        {
                            this.tranConnCC.Commit();
                            this.ReleaseDBObjects();
                        }
                        else
                        {
                            this.tranConnCC.Rollback();
                            this.ReleaseDBObjects();
                            Response.Redirect(strDefaultHomepage);
                        }

                    }
                    else
                    {
                        this.tranConnCC.Rollback();
                        this.ReleaseDBObjects();
                        Response.Redirect(strDefaultHomepage);
                    }

                    if ((bool)drAdminInfo["UseSSL"])
                        Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + "/School/Home.aspx");
                    else
                        Response.Redirect(strDefaultHomepage);

                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Check Login
            CheckRegionAdminSession();
            #endregion Check Login

            this.strSchoolName = "";
            this.strSchoolID = CCLib.Common.Strings.GetQueryString("ID");

            if (this.strSchoolID != "")
            {
                DataTable dtSchoolInfo = CCLib.Common.DataAccess.GetDataTable("select institutionname, username, password from userinfo where schoolid=" + this.strSchoolID);
                this.strSchoolName = dtSchoolInfo.Rows[0][0].ToString();
                lblSchlUsername.Text = dtSchoolInfo.Rows[0]["Username"].ToString();
                lblSchlPwd.Text = dtSchoolInfo.Rows[0]["Password"].ToString();

                strCol = CCLib.Common.Strings.GetQueryString("col");
                strOrder = CCLib.Common.Strings.GetQueryString("storder");

                if (strCol == "")
                    strCol = "3";

                this.strSQL = "select pa.firstname, pa.lastname,pa.AdminPassword,pas.securityname_en,pa.AdminId from portfolioadmin as pa inner join portfolioadminsecurity as pas on pa.securitylevel=pas.securitylevel and pas.PortTypeID=" + PortTypeID + " where pa.schoolid=" + this.strSchoolID + " order by " + strCol + " " + strOrder;
                this.dtSchoolAdmin = CCLib.Common.DataAccess.GetDataTable(this.strSQL);
                rptDetails.DataSource = this.dtSchoolAdmin;
                rptDetails.DataBind();

                if (strOrder == "")
                    strNextStOrder = "desc";
                else
                    strNextStOrder = "";

                this.strAdminID = CCLib.Common.Strings.GetQueryString("aID");
            }

            if ((this.strAdminID != "") & (this.strSchoolID != ""))
            {

                this.strConnectionStringToSLX = WebConfigurationManager.AppSettings["strConSLX"];
                this.strConnectionStringToCC = WebConfigurationManager.AppSettings["strConLocal"];

                this.cnnCC = new SqlConnection(this.strConnectionStringToCC);

                if (this.cnnCC.State == ConnectionState.Closed)
                {
                    this.cnnCC.Open();
                }
                this.trsCC = this.cnnCC.BeginTransaction();

                this.intReturnValue1 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLDeleteAdminPassword(this.strAdminID), this.cnnCC, this.trsCC);
                this.intReturnValue2 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLDeleteAdvisorAssignments(this.strAdminID), this.cnnCC, this.trsCC);

                if ((this.intReturnValue1 > 0) & (this.intReturnValue2 > 0))
                {

                    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
                    System.Net.ServicePointManager.CertificatePolicy = new CareerCruisingWeb.CCLib.SLXIntegration.TrustAllCertificatePolicy();
                    this.wsSLXIntegration = new WSCCIntegrationWithSLX.IntegrationWithSLX();
                    this.userCredential = new System.Net.NetworkCredential("WSCCTOSLX", "Next_20");
                    this.wsSLXIntegration.Credentials = userCredential;
                    this.wsSLXIntegration.PreAuthenticate = true;

                    object objHistoryID = this.wsSLXIntegration.GetNewSLXID("History", this.strConnectionStringToSLX);
                    string strHistoryID = objHistoryID != null ? objHistoryID.ToString() : null;
                    this.objContactID = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectContactID(this.strAdminID), this.strConnectionStringToSLX);
                    this.strContactID = this.objContactID != null ? this.objContactID.ToString() : null;
                    this.objAccountID = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectAccountID(this.strSchoolID), this.strConnectionStringToSLX);
                    this.strAccountID = this.objAccountID != null ? this.objAccountID.ToString() : null;
                    this.objAccount = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectAccount(this.strSchoolID), this.strConnectionStringToSLX);
                    this.strAccount = this.objAccount != null ? this.objAccount.ToString().Replace("'", "''") : null;
                    object objContactName = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectContactName(this.strContactID), this.strConnectionStringToSLX);
                    string strContactName = objContactName != null ? objContactName.ToString().Replace("'", "''") : null;
                    string strLogType = "262148";      //Type: 262148 -- "Note"
                    string strDescription = "Admin password deleted";
                    DataRow drRegionAdminInfo = (DataRow)Session["RegionAdminInfo"];
                    string strloggedInUsername = drRegionAdminInfo["FirstName"].ToString() + " " + drRegionAdminInfo["LastName"].ToString();

                    this.intReturnValue3 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLLogDeletion(strHistoryID, strContactID, strContactName, strLogType, strDescription, strAccountID, strAccount, strloggedInUsername), this.strConnectionStringToSLX);
                    if (this.intReturnValue3 > 0)
                    {
                        this.intReturnValue4 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLDeleteAdminPassword(strAdminID), this.strConnectionStringToSLX);
                    }

                    if ((this.intReturnValue3 > 0) & (this.intReturnValue4 > 0))
                    {

                        this.trsCC.Commit();
                        this.ReleaseObjects();
                        TrackChanges();
                        Response.Redirect("SchoolAdminDetails.aspx?ID=" + this.strSchoolID);

                    }
                    else
                    {

                        this.trsCC.Rollback();
                        this.ReleaseObjects();
                        Response.Write(CCLib.Common.Forms.JavaScriptNotify("The advisor has failed to delete. Plesae try again."));

                    }
                }
                else
                {

                    this.trsCC.Rollback();
                    this.ReleaseObjects();
                    Response.Write(CCLib.Common.Forms.JavaScriptNotify("The advisor has failed to delete. Plesae try again."));

                }
            }

            #region Properties For The Region Base Class

            TitleBar = "Manage Accounts";
            SubTitleBar = PortTypeSettings["SchoolAdminName"].ToString();

            #endregion Properties For The Region Base Class
        }
Example #9
0
        private void ReleaseObjects()
        {
            this.trsCC = null;

            if (this.cnnCC.State == ConnectionState.Open)
            {
                this.cnnCC.Close();
            }
            //this.cnnCC = null;

            this.userCredential = null;
            this.wsSLXIntegration = null;
            this.objContactID = null;
            this.dtAdmin = null;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Check Login
            CheckStateAdminSession();
            #endregion Check Login

            strRegionID = CCLib.Common.Strings.GetQueryString("rid");
            strSchoolID = CCLib.Common.Strings.GetQueryString("sid");
            strAdminID = CCLib.Common.Strings.GetQueryString("aid");
            strType = CCLib.Common.Strings.GetFormString("Type");

            strConnectionStringToCC = WebConfigurationManager.AppSettings["strConLocal"];
            cnnCC = new SqlConnection(this.strConnectionStringToCC);

            if (Page.IsPostBack)
            {
                if (strType == "Edit")
                {
                    strPwd = CCLib.Common.Strings.GetFormString("pwd").Replace("'", "''");
                    if (this.CheckForPwdConflict(this.strPwd, this.strAdminID, this.strSchoolID))
                    {
                        Response.Write(CCLib.Common.Forms.JavaScriptNotify("The advisor could not be updated due to a password conflict, please change the password and try again."));
                        this.InitializeValues();
                        this.ReleaseObjects();
                    }
                    else
                    {
                        this.strFname = CareerCruisingWeb.CCLib.Common.Strings.ConvertStringToTitleCase(CCLib.Common.Strings.FormatUserInput(CCLib.Common.Strings.GetFormString("fname")));
                        this.strLname = CareerCruisingWeb.CCLib.Common.Strings.ConvertStringToTitleCase(CCLib.Common.Strings.FormatUserInput(CCLib.Common.Strings.GetFormString("lname")));
                        this.strEmail = CCLib.Common.Strings.FormatUserInput(CCLib.Common.Strings.GetFormString("email"));
                        this.strDisplayName = CCLib.Common.Strings.FormatUserInput(CCLib.Common.Strings.GetFormString("DisplayName"));
                        this.strSecurityLevel = CCLib.Common.Strings.GetFormString("drpSecurityLevel");

                        this.strConnectionStringToSLX = WebConfigurationManager.AppSettings["strConSLX"];

                        if (this.cnnCC.State == ConnectionState.Closed)
                            this.cnnCC.Open();

                        this.trsCC = this.cnnCC.BeginTransaction();
                        this.intReturnValue1 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLUpdateAdminPassword(this.strFname, this.strLname, this.strEmail, this.strPwd, this.strSecurityLevel, this.strAdminID), this.cnnCC, this.trsCC);
                        this.intReturnValue6 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLUpdateAdminName(this.strFname, this.strLname, this.strAdminID, this.strDisplayName), this.cnnCC, this.trsCC);
                        if ((this.intReturnValue1 > 0)&(this.intReturnValue6>0))
                        {
                            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
                            System.Net.ServicePointManager.CertificatePolicy = new CareerCruisingWeb.CCLib.SLXIntegration.TrustAllCertificatePolicy();
                            this.wsSLXIntegration = new WSCCIntegrationWithSLX.IntegrationWithSLX();
                            this.userCredential = new System.Net.NetworkCredential("WSCCTOSLX", "Next_20");
                            this.wsSLXIntegration.Credentials = userCredential;
                            this.wsSLXIntegration.PreAuthenticate = true;

                            this.strLicenseType = CCLib.Common.DataAccess.GetValue("select LicenseType from userinfo where schoolID=" + strSchoolID).ToString();
                            this.strSecurityLevelText = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.GetSecurityLevelText(strSecurityLevel, true, strLicenseType);
                            this.objContactID = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectContactID(strAdminID), this.strConnectionStringToSLX);
                            this.strContactID = this.objContactID != null ? this.objContactID.ToString() : null;

                            if (this.wsSLXIntegration.CheckExists(this.GetSLXSQLEmailExists(strEmail, this.strContactID), this.strConnectionStringToSLX, true))
                            {
                                this.strEmail = null;
                            }

                            this.intReturnValue2 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLUpdateContact(this.strFname, this.strLname, this.strEmail, this.strContactID), this.strConnectionStringToSLX);
                            if (this.intReturnValue2 > 0)
                            {
                                this.intReturnValue3 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLUpdateAdminPassword(this.strPwd, this.strSecurityLevel, this.strSecurityLevelText, this.strAdminID), this.strConnectionStringToSLX);
                            }

                            if ((this.intReturnValue2 > 0) & (this.intReturnValue3 > 0))
                            {
                                this.trsCC.Commit();
                                this.ReleaseObjects();
                                TrackChanges();
                                Response.Redirect("AccountsDistrictSchoolAdvisorList.aspx?rid=" + strRegionID + "&sid=" + strSchoolID);
                            }
                            else
                            {
                                this.trsCC.Rollback();
                                Response.Write(CCLib.Common.Forms.JavaScriptNotify("The advisor has failed to update. Plesae try again."));
                                this.InitializeValues();
                                this.ReleaseObjects();
                            }
                        }
                        else
                        {
                            this.trsCC.Rollback();
                            Response.Write(CCLib.Common.Forms.JavaScriptNotify("The advisor has failed to update. Plesae try again."));
                            this.InitializeValues();
                            this.ReleaseObjects();
                        }
                    }
                }
            }
            else
            {
                this.InitializeValues();
                this.ReleaseObjects();
            }

            #region Properties For The Region Base Class
            TitleBar = "Manage Accounts";
            SubTitleBar = GetPortText(9308, false) + " Accounts";
            #endregion Properties For The Region Base Class
        }
Example #11
0
        private void ReleaseObjects()
        {
            this.trsCC = null;

            if (this.cnnCC.State == ConnectionState.Open)
            {
                this.cnnCC.Close();
            }
            //this.cnnCC = null;

            this.userCredential = null;
            this.wsSLXIntegration = null;
            this.objContactID = null;
            this.objAccountID = null;
            this.objAccount = null;
            this.objAddressID = null;
            this.objLicenseType = null;
        }
Example #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            strGUID = (Request.ServerVariables["REQUEST_METHOD"] == "POST") ? CCLib.Common.Strings.GetFormString("guid") : CCLib.Common.Strings.GetQueryString("guid");
            strReturnUrl = (Request.ServerVariables["REQUEST_METHOD"] == "POST") ? CCLib.Common.Strings.GetFormString("returnurl") : CCLib.Common.Strings.GetQueryString("returnurl");
            strTargetUrl = (Request.ServerVariables["REQUEST_METHOD"] == "POST") ? CCLib.Common.Strings.GetFormString("targeturl") : CCLib.Common.Strings.GetQueryString("targeturl");
            strTargetUrl = (strTargetUrl == "") ? "/Individual/Home.aspx" : strTargetUrl;

            DataTable dtbAdminInfo = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable("select p.*,u.Username as SchoolUserName,u.Password as SchoolPassword,u.PortTypeID from Port_Admin_FFA p inner join Userinfo u on p.schoolid=u.schoolid where SecureUniqueID='" + strGUID + "'");

            if (dtbAdminInfo.Rows.Count == 0)//invalid GUID
                Response.Redirect("/Default.aspx");
            else if (dtbAdminInfo.Rows.Count != 0 && dtbAdminInfo.Rows[0]["AdminID"].ToString() != "")//redirect associated admin user
            {
                AutoLoginUser(dtbAdminInfo.Rows[0]["AdminID"].ToString());
            }
            else//admin user not associated yet, create one
            {
                strPassword = RandomString().Substring(10, 10);

                while (CheckForPwdConflict(strPassword, dtbAdminInfo.Rows[0]["SchoolID"].ToString()))
                    strPassword = RandomString().Substring(10, 10);

                if (dtbAdminInfo.Rows[0]["IsNetworkCDOContact"].ToString() == "True")
                    intIsNetworkCDOContact = 1;

                #region SLX

                this.strSchoolID = dtbAdminInfo.Rows[0]["SchoolID"].ToString();
                this.strSLXEmail = CCLib.Common.Strings.FormatUserInput(dtbAdminInfo.Rows[0]["EmailAddress"].ToString());
                this.strEmail = CCLib.Common.Strings.FormatUserInput(dtbAdminInfo.Rows[0]["EmailAddress"].ToString());
                this.strFname = CCLib.Common.Strings.ConvertStringToTitleCase(CCLib.Common.Strings.FormatUserInput(dtbAdminInfo.Rows[0]["FirstName"].ToString()));
                this.strLname = CCLib.Common.Strings.ConvertStringToTitleCase(CCLib.Common.Strings.FormatUserInput(dtbAdminInfo.Rows[0]["LastName"].ToString()));
                this.strDisplayName = this.strFname+" "+this.strLname;
                this.strType = "Add";
                this.strSecurityLevel = "400";

                this.strConnectionStringToSLX = WebConfigurationManager.AppSettings["strConSLX"];
               this.strConnectionStringToCC = WebConfigurationManager.AppSettings["strConLocal"];
               this.cnnCC = new SqlConnection(this.strConnectionStringToCC);

               this.strPwd = strPassword;

                this.strLicenseType = CCLib.Common.DataAccess.GetValue("select LicenseType from userinfo where schoolID=" + this.strSchoolID).ToString();
                this.strSecurityLevelText = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.GetSecurityLevelText(this.strSecurityLevel, true, this.strLicenseType);

                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
                System.Net.ServicePointManager.CertificatePolicy = new CareerCruisingWeb.CCLib.SLXIntegration.TrustAllCertificatePolicy();
                this.wsSLXIntegration = new WSCCIntegrationWithSLX.IntegrationWithSLX();
                this.userCredential = new System.Net.NetworkCredential("WSCCTOSLX", "Next_20");
                this.wsSLXIntegration.Credentials = userCredential;
                this.wsSLXIntegration.PreAuthenticate = true;

                if ((this.wsSLXIntegration.GetRecordCount(this.GetSLXSQLContactExists(this.strFname, this.strLname, this.strSchoolID), this.strConnectionStringToSLX, true) == 1) & (!CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.CheckExists(this.GetCCSQLAdminIDExists(this.strFname, this.strLname, this.strSchoolID), this.strConnectionStringToCC)))
                {

                    this.objContactID = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLContactExists(this.strFname, this.strLname, this.strSchoolID), this.strConnectionStringToSLX);
                    this.strContactID = this.objContactID != null ? this.objContactID.ToString() : null;

                    if (this.wsSLXIntegration.CheckExists(this.GetSLXSQLEmailExists(strEmail, strContactID), this.strConnectionStringToSLX, true))
                    {
                        this.strSLXEmail = null;
                    }

                    if (this.cnnCC.State == ConnectionState.Closed)
                    {
                        this.cnnCC.Open();
                    }

                    this.trsCC = this.cnnCC.BeginTransaction();

                    this.intReturnValue1 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLInsertAdminPassword(this.strPwd, this.strFname, this.strLname, this.strEmail, this.strSecurityLevel, this.strSchoolID,this.intIsNetworkCDOContact), this.cnnCC, this.trsCC);

                    if (this.intReturnValue1 > 0)
                    {
                        this.objAdminID = SqlHelper.ExecuteScalar(this.trsCC, CommandType.Text, this.GetCCSQLSelectAdminID(this.strPwd, this.strSchoolID));
                        this.strAdminID = this.objAdminID != null ? this.objAdminID.ToString() : null;
                        this.intReturnValue6 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLInsertAdminName(this.strFname, this.strLname, this.strSchoolID, this.strDisplayName) + ";update Port_Admin_FFA set AdminID=" + this.strAdminID + " where SecureUniqueID='" + strGUID + "'", this.cnnCC, this.trsCC);
                    }

                    if ((this.intReturnValue1 > 0) & (this.intReturnValue6 > 0))
                    {
                        this.objAdminID = SqlHelper.ExecuteScalar(this.trsCC, CommandType.Text, this.GetCCSQLSelectAdminID(this.strPwd, this.strSchoolID));
                        this.strAdminID = this.objAdminID != null ? this.objAdminID.ToString() : null;

                        this.intReturnValue2 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLUpdateContactEmail(this.strContactID, strEmail), this.strConnectionStringToSLX);

                        if (this.intReturnValue2 > 0)
                        {
                            this.intReturnValue3 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLInsertAdminPassword(this.strContactID, this.strPwd, this.strSecurityLevel, this.strAdminID, this.strSecurityLevelText), this.strConnectionStringToSLX);
                        }

                        if ((this.intReturnValue2 > 0) & (this.intReturnValue3 > 0))
                        {
                            this.trsCC.Commit();
                            this.ReleaseObjects();

                            TrackChanges(strAdminID);

                            if (CCLib.Common.Strings.GetFormString("chkEmail").ToString() == "on")
                                SendEmailToNewAdvisor(strFname, strEmail, strSchoolID);

                            AutoLoginUser(this.strAdminID);
                            //Response.Write(CCLib.Common.Forms.JavaScriptNotify("The new advisor has been added."));
                        }
                        else
                        {
                            this.trsCC.Rollback();
                            this.ReleaseObjects();
                            Response.Write(CCLib.Common.Forms.JavaScriptNotify("The new advisor has failed to add. Plesae try again."));
                        }
                    }
                    else
                    {
                        this.trsCC.Rollback();
                        this.ReleaseObjects();
                        this.Response.Write(CCLib.Common.Forms.JavaScriptNotify("The new advisor has failed to add. Plesae try again."));
                    }
                }
                else
                {

                    if (this.cnnCC.State == ConnectionState.Closed)
                    {
                        this.cnnCC.Open();
                    }

                    this.trsCC = this.cnnCC.BeginTransaction();

                    if (this.wsSLXIntegration.CheckExists(this.GetSLXSQLEmailExists(strSLXEmail), this.strConnectionStringToSLX, true))
                    {
                        this.strSLXEmail = null;
                    }

                    this.intReturnValue1 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLInsertAdminPassword(this.strPwd, this.strFname, this.strLname, this.strEmail, this.strSecurityLevel, this.strSchoolID,this.intIsNetworkCDOContact), this.cnnCC, this.trsCC);

                    if (this.intReturnValue1 > 0)
                    {
                        this.objAdminID = SqlHelper.ExecuteScalar(this.trsCC, CommandType.Text, this.GetCCSQLSelectAdminID(this.strPwd, this.strSchoolID));
                        this.strAdminID = this.objAdminID != null ? this.objAdminID.ToString() : null;
                        this.intReturnValue6 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLInsertAdminName(this.strFname, this.strLname, this.strSchoolID, this.strDisplayName) + ";update Port_Admin_FFA set AdminID=" + this.strAdminID + " where SecureUniqueID='" + strGUID + "'", this.cnnCC, this.trsCC);
                    }

                    if ((this.intReturnValue1 > 0) & (this.intReturnValue6 > 0))
                    {
                        this.objContactID = this.wsSLXIntegration.GetNewSLXID("Contact", this.strConnectionStringToSLX);
                        this.strContactID = this.objContactID != null ? this.objContactID.ToString() : null;

                        this.strSecCodeID = "SYST00000001";

                        if ((this.strLicenseType == "Licensed") | (this.strLicenseType == "Ontario") | (this.strLicenseType == "Kentucky"))
                        {
                            this.booIsLOK = true;
                        }
                        else
                        {
                            this.booIsLOK = false;
                        }

                        this.objAccountID = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectAccountID(this.strSchoolID), this.strConnectionStringToSLX);
                        this.strAccountID = this.objAccountID != null ? this.objAccountID.ToString() : null;
                        this.objAccount = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectAccount(this.strSchoolID), this.strConnectionStringToSLX);
                        this.strAccount = this.objAccount != null ? CCLib.Common.Strings.FormatUserInput(this.objAccount.ToString()) : null;
                        this.objAddressID = this.wsSLXIntegration.GetNewSLXID("Address", this.strConnectionStringToSLX);
                        this.strAddressID = this.objAddressID != null ? this.objAddressID.ToString() : null;

                        this.intReturnValue2 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLInsertContact(this.strContactID, this.strAccountID, this.strAccount, this.strFname, this.strLname, this.strSLXEmail, this.strSecCodeID, this.strAddressID), this.strConnectionStringToSLX);
                        if (this.intReturnValue2 > 0)
                        {
                            this.intReturnValue3 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLSetReceiveNewsLetter(this.strContactID, booIsLOK), this.strConnectionStringToSLX);
                            if (this.intReturnValue3 > 0)
                            {
                                this.intReturnValue4 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLInsertAddress(this.strAddressID, this.strContactID), this.strConnectionStringToSLX);
                                if (this.intReturnValue4 > 0)
                                {
                                    this.intReturnValue5 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLInsertAdminPassword(this.strContactID, this.strPwd, this.strSecurityLevel, this.strAdminID, this.strSecurityLevelText), this.strConnectionStringToSLX);
                                }
                            }
                        }

                        if ((this.intReturnValue2 > 0) & (this.intReturnValue3 > 0) & (this.intReturnValue4 > 0) & (this.intReturnValue5 > 0))
                        {
                            this.trsCC.Commit();
                            this.ReleaseObjects();

                            TrackChanges(strAdminID);

                            if (CCLib.Common.Strings.GetFormString("chkEmail").ToString() == "on")
                                SendEmailToNewAdvisor(strFname, strEmail, strSchoolID);

                            AutoLoginUser(this.strAdminID);
                            //Response.Write(CCLib.Common.Forms.JavaScriptNotify("The new advisor has been added."));
                            //Response.Redirect("schooladmindetails.aspx?ID=" + strSchoolID);
                        }
                        else
                        {
                            this.trsCC.Rollback();
                            this.ReleaseObjects();
                            Response.Write(CCLib.Common.Forms.JavaScriptNotify("The new advisor has failed to add. Plesae try again."));
                        }
                    }
                    else
                    {
                        this.trsCC.Rollback();
                        this.ReleaseObjects();
                        Response.Write(CCLib.Common.Forms.JavaScriptNotify("The new advisor has failed to add. Plesae try again."));
                    }
                }

                #endregion SLX

            }//form post
        }
Example #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Check Login

            CheckRegionAdminSession();

            #endregion Check Login

            this.strSchoolID = CCLib.Common.Strings.GetFormString("drpSchool");

            if(this.strSchoolID=="")
                this.strSchoolID = CCLib.Common.Strings.GetQueryString("sID");

            GetRegionSchoolList(this.drpSchool);

            if (this.strSchoolID != "")
            {
                if (this.drpSchool.Items.FindByValue(strSchoolID).ToString() != "")
                {
                    ListItem lst1 = this.drpSchool.Items.FindByValue(strSchoolID);
                    lst1.Selected = true;
                }
            }

            this.strSLXEmail = CCLib.Common.Strings.FormatUserInput(CCLib.Common.Strings.GetFormString("email").ToString());
            this.strEmail = CCLib.Common.Strings.FormatUserInput(CCLib.Common.Strings.GetFormString("email").ToString());
            this.strFname = CCLib.Common.Strings.ConvertStringToTitleCase(CCLib.Common.Strings.FormatUserInput(CCLib.Common.Strings.GetFormString("fname").ToString()));
            this.strLname = CCLib.Common.Strings.ConvertStringToTitleCase(CCLib.Common.Strings.FormatUserInput(CCLib.Common.Strings.GetFormString("lname").ToString()));
            this.strDisplayName = CCLib.Common.Strings.FormatUserInput(CCLib.Common.Strings.GetFormString("DisplayName"));
            this.strType = CCLib.Common.Strings.GetFormString("Type");
            this.strSecurityLevel = CCLib.Common.Strings.GetFormString("drpSecurityLevel");
            GetAdminSecurityList(this.drpSecurityLevel);

            if (Page.IsPostBack)
            {
               this.strConnectionStringToSLX = WebConfigurationManager.AppSettings["strConSLX"];
               this.strConnectionStringToCC = WebConfigurationManager.AppSettings["strConLocal"];
               this.cnnCC = new SqlConnection(this.strConnectionStringToCC);

               if (this.strType == "Add")
               {

                   this.strPwd = CCLib.Common.Strings.GetFormString("pwd").Replace("'", "''");

                   if (this.CheckForPwdConflict(this.strPwd, this.strSchoolID))
                   {
                       Response.Write(CCLib.Common.Forms.JavaScriptNotify("An administrator already exists with that password. Please choose a different password."));
                       this.ReleaseObjects();
                   }
                   else
                   {

                       if (this.strSchoolID != "")
                       {
                           if (this.drpSchool.Items.FindByValue(strSchoolID).ToString() != "")
                           {
                               ListItem lst1 = this.drpSchool.Items.FindByValue(strSchoolID);
                               lst1.Selected = true;
                           }
                       }

                       this.strLicenseType = CCLib.Common.DataAccess.GetValue("select LicenseType from userinfo where schoolID=" + this.strSchoolID).ToString();
                       this.strSecurityLevelText = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.GetSecurityLevelText(this.strSecurityLevel, true, this.strLicenseType);

                       System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
                       System.Net.ServicePointManager.CertificatePolicy = new CareerCruisingWeb.CCLib.SLXIntegration.TrustAllCertificatePolicy();
                       this.wsSLXIntegration = new WSCCIntegrationWithSLX.IntegrationWithSLX();
                       this.userCredential = new System.Net.NetworkCredential("WSCCTOSLX", "Next_20");
                       this.wsSLXIntegration.Credentials = userCredential;
                       this.wsSLXIntegration.PreAuthenticate = true;

                       if ((this.wsSLXIntegration.GetRecordCount(this.GetSLXSQLContactExists(this.strFname, this.strLname, this.strSchoolID), this.strConnectionStringToSLX, true) == 1) & (!CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.CheckExists(this.GetCCSQLAdminIDExists(this.strFname, this.strLname, this.strSchoolID), this.strConnectionStringToCC)))
                       {

                           this.objContactID = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLContactExists(this.strFname, this.strLname, this.strSchoolID), this.strConnectionStringToSLX);
                           this.strContactID = this.objContactID != null ? this.objContactID.ToString() : null;

                           if (this.wsSLXIntegration.CheckExists(this.GetSLXSQLEmailExists(strEmail, strContactID), this.strConnectionStringToSLX, true))
                           {
                               this.strSLXEmail = null;
                           }

                           if (this.cnnCC.State == ConnectionState.Closed)
                           {
                              this.cnnCC.Open();
                           }

                           this.trsCC = this.cnnCC.BeginTransaction();

                           this.intReturnValue1 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLInsertAdminPassword(this.strPwd, this.strFname, this.strLname, this.strEmail, this.strSecurityLevel, this.strSchoolID), this.cnnCC, this.trsCC);

                           if (this.intReturnValue1 > 0)
                           {
                               this.objAdminID = SqlHelper.ExecuteScalar(this.trsCC, CommandType.Text, this.GetCCSQLSelectAdminID(this.strPwd, this.strSchoolID));
                               this.strAdminID = this.objAdminID != null ? this.objAdminID.ToString() : null;
                               this.intReturnValue6 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLInsertAdminName(this.strFname, this.strLname, this.strSchoolID, this.strDisplayName), this.cnnCC, this.trsCC);
                           }

                           if ((this.intReturnValue1 > 0) & (this.intReturnValue6 > 0))
                           {
                               this.objAdminID = SqlHelper.ExecuteScalar(this.trsCC, CommandType.Text, this.GetCCSQLSelectAdminID(this.strPwd, this.strSchoolID));
                               this.strAdminID = this.objAdminID != null ? this.objAdminID.ToString() : null;

                               this.intReturnValue2 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLUpdateContactEmail(this.strContactID, strEmail), this.strConnectionStringToSLX);

                               if (this.intReturnValue2 > 0)
                               {
                                   this.intReturnValue3 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLInsertAdminPassword(this.strContactID, this.strPwd, this.strSecurityLevel, this.strAdminID, this.strSecurityLevelText), this.strConnectionStringToSLX);
                               }

                               if ((this.intReturnValue2 > 0) & (this.intReturnValue3 > 0))
                               {
                                   this.trsCC.Commit();
                                   this.ReleaseObjects();

                                   TrackChanges();

                                   if (CCLib.Common.Strings.GetFormString("chkEmail").ToString() == "on")
                                       SendEmailToNewAdvisor(strFname, strEmail, strSchoolID);

                                   Response.Write(CCLib.Common.Forms.JavaScriptNotify("The new advisor has been added."));
                               }
                               else
                               {
                                   this.trsCC.Rollback();
                                   this.ReleaseObjects();
                                   Response.Write(CCLib.Common.Forms.JavaScriptNotify("The new advisor has failed to add. Plesae try again."));
                               }
                           }
                           else
                           {
                               this.trsCC.Rollback();
                               this.ReleaseObjects();
                               this.Response.Write(CCLib.Common.Forms.JavaScriptNotify("The new advisor has failed to add. Plesae try again."));
                           }
                       }
                       else
                       {

                           if (this.cnnCC.State == ConnectionState.Closed)
                           {
                               this.cnnCC.Open();
                           }

                           this.trsCC = this.cnnCC.BeginTransaction();

                           if (this.wsSLXIntegration.CheckExists(this.GetSLXSQLEmailExists(strSLXEmail), this.strConnectionStringToSLX, true))
                           {
                               this.strSLXEmail = null;
                           }

                           this.intReturnValue1 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLInsertAdminPassword(this.strPwd, this.strFname, this.strLname, this.strEmail, this.strSecurityLevel, this.strSchoolID), this.cnnCC, this.trsCC);

                           if (this.intReturnValue1 > 0)
                           {
                               this.objAdminID = SqlHelper.ExecuteScalar(this.trsCC, CommandType.Text, this.GetCCSQLSelectAdminID(this.strPwd, this.strSchoolID));
                               this.strAdminID = this.objAdminID != null ? this.objAdminID.ToString() : null;
                               this.intReturnValue6 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLInsertAdminName(this.strFname, this.strLname, this.strSchoolID, this.strDisplayName), this.cnnCC, this.trsCC);
                           }

                           if ((this.intReturnValue1 > 0) & (this.intReturnValue6 > 0))
                           {
                               this.objContactID = this.wsSLXIntegration.GetNewSLXID("Contact", this.strConnectionStringToSLX);
                               this.strContactID = this.objContactID != null ? this.objContactID.ToString() : null;
                               //this.objAdminID = SqlHelper.ExecuteScalar(this.trsCC, CommandType.Text, this.GetCCSQLSelectAdminID(this.strPwd, this.strSchoolID));
                               //this.strAdminID = this.objAdminID != null ? this.objAdminID.ToString() : null;
                               this.strSecCodeID = "SYST00000001";

                               //if ((this.strLicenseType == "Licensed") | (this.strLicenseType == "Ontario") | (this.strLicenseType == "Kentucky"))
                               //{
                                   this.booIsLOK = true;
                               //}
                               //else
                               //{
                               //    this.booIsLOK = false;
                               //}

                               this.objAccountID = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectAccountID(this.strSchoolID), this.strConnectionStringToSLX);
                               this.strAccountID = this.objAccountID != null ? this.objAccountID.ToString() : null;
                               this.objAccount = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectAccount(this.strSchoolID), this.strConnectionStringToSLX);
                               this.strAccount = this.objAccount != null ? CCLib.Common.Strings.FormatUserInput(this.objAccount.ToString()) : null;
                               this.objAddressID = this.wsSLXIntegration.GetNewSLXID("Address", this.strConnectionStringToSLX);
                               this.strAddressID = this.objAddressID != null ? this.objAddressID.ToString() : null;

                               this.intReturnValue2 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLInsertContact(this.strContactID, this.strAccountID, this.strAccount, this.strFname, this.strLname, this.strSLXEmail, this.strSecCodeID, this.strAddressID), this.strConnectionStringToSLX);
                               if (this.intReturnValue2 > 0)
                               {
                                   this.intReturnValue3 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLSetReceiveNewsLetter(this.strContactID, booIsLOK), this.strConnectionStringToSLX);
                                   if (this.intReturnValue3 > 0)
                                   {
                                       this.intReturnValue4 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLInsertAddress(this.strAddressID, this.strContactID), this.strConnectionStringToSLX);
                                       if (this.intReturnValue4 > 0)
                                       {
                                           this.intReturnValue5 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLInsertAdminPassword(this.strContactID, this.strPwd, this.strSecurityLevel, this.strAdminID, this.strSecurityLevelText), this.strConnectionStringToSLX);
                                       }
                                   }
                               }

                               if ((this.intReturnValue2 > 0) & (this.intReturnValue3 > 0) & (this.intReturnValue4 > 0) & (this.intReturnValue5 > 0))
                               {
                                   this.trsCC.Commit();
                                   this.ReleaseObjects();

                                   TrackChanges();

                                   if (CCLib.Common.Strings.GetFormString("chkEmail").ToString() == "on")
                                       SendEmailToNewAdvisor(strFname, strEmail, strSchoolID);

                                   Response.Write(CCLib.Common.Forms.JavaScriptNotify("The new advisor has been added."));
                                   //Response.Redirect("schooladmindetails.aspx?ID=" + strSchoolID);
                               }
                               else
                               {
                                   this.trsCC.Rollback();
                                   this.ReleaseObjects();
                                   Response.Write(CCLib.Common.Forms.JavaScriptNotify("The new advisor has failed to add. Plesae try again."));
                               }
                           }
                           else
                           {
                               this.trsCC.Rollback();
                               this.ReleaseObjects();
                               Response.Write(CCLib.Common.Forms.JavaScriptNotify("The new advisor has failed to add. Plesae try again."));
                           }
                      }
                   }
               }
            }

            #region Properties For The Region Base Class

            TitleBar = "Manage Accounts";
            SubTitleBar = "School Administration System";

            #endregion Properties For The Region Base Class
        }
Example #14
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string strEmail;
            string strConnectionStringToSLX;
            string strConnectionStringToCC;
            object objContactID;
            string strContactID;
            int intReturnValue1;
            int intReturnValue2;
            SqlTransaction tranConnCC;
            SqlConnection connCC;
            WSCCIntegrationWithSLX.IntegrationWithSLX wstest;

            strConnectionStringToSLX = WebConfigurationManager.AppSettings["strConSLX"];
            strConnectionStringToCC = WebConfigurationManager.AppSettings["strConLocal"];

            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
            System.Net.ServicePointManager.CertificatePolicy = new CareerCruisingWeb.CCLib.SLXIntegration.TrustAllCertificatePolicy();
            wstest = new WSCCIntegrationWithSLX.IntegrationWithSLX();
            System.Net.NetworkCredential userCredential = new System.Net.NetworkCredential("WSCCTOSLX", "Next_20");
            wstest.Credentials = userCredential;
            wstest.PreAuthenticate = true;

            connCC = new SqlConnection(strConnectionStringToCC);

            objContactID = wstest.GetValueFromSLX(GetSLXSQLSelectContactID(AdminInfo["AdminID"].ToString()), strConnectionStringToSLX);
            strContactID = objContactID != null ? objContactID.ToString() : null;

            strEmail = txtEmail.Value;
            if (wstest.CheckExists(GetSLXSQLEmailExists(strEmail, strContactID), strConnectionStringToSLX, true))
            {
                strEmail = null;
            }

            if (connCC.State == ConnectionState.Closed)
            {
                connCC.Open();
            }

            tranConnCC = connCC.BeginTransaction();

            intReturnValue1 = IntegrationWithSLX.ExecuteNoQuery("UPDATE PortfolioAdmin SET Email='" + txtEmail.Value + "' WHERE AdminID=" + AdminInfo["AdminID"].ToString(), connCC, tranConnCC);

            if (intReturnValue1 > 0)
            {
                intReturnValue2 = wstest.ExecuteNoQuery("UPDATE CONTACT SET EMAIL ='" + strEmail + "' WHERE CONTACTID ='" + strContactID + "'", strConnectionStringToSLX);

                if (intReturnValue2 > 0)
                {
                    tranConnCC.Commit();
                }
                else
                {
                    tranConnCC.Rollback();
                    Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8250)));
                }
            }
            else
            {
                tranConnCC.Rollback();
                Response.Write(CCLib.Common.Forms.JavaScriptNotify(TextCode(8250)));
            }

            //CCLib.Common.DataAccess.ExecuteNonQuery("UPDATE PortfolioAdmin SET Email='" + txtEmail.Value + "' WHERE AdminID=" + AdminInfo["AdminID"].ToString());
            divEmail.Visible = false;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Check Login
            CheckStateAdminSession();
            #endregion Check Login

            #region Initialize Values and Form Execution

            divAdd.Visible = false;
            divEdit.Visible = false;

            strRegionID = CCLib.Common.Strings.GetQueryString("rid");
            strRegionName = CCLib.Common.DataAccess.GetValue("select RegionName from RRSRegions where RegionID = '" + strRegionID + "'").ToString();

            if (Page.IsPostBack)
            {
                strType = CCLib.Common.Strings.GetFormString("Type");

                this.strConnectionStringToSLX = WebConfigurationManager.AppSettings["strConSLX"];
                this.strConnectionStringToCC = WebConfigurationManager.AppSettings["strConLocal"];

                if (strType == "Add")
                {
                    if (this.CheckForPwdConflict(CCLib.Common.Strings.FormatUserInput(this.txtPwd.Value), this.strRegionID))
                    {
                        divAdd.Visible = true;
                        Response.Write(CCLib.Common.Forms.JavaScriptNotify("A RRS user already exists with that password. Please choose a different password."));
                    }
                    else
                    {
                        this.strFirstName = CCLib.Common.Strings.FormatUserInput(this.txtFirstName.Value);
                        this.strLastName = CCLib.Common.Strings.FormatUserInput(this.txtLastName.Value);
                        this.strEmail = CCLib.Common.Strings.FormatUserInput(this.txtEmail.Value);
                        this.strPassword = CCLib.Common.Strings.FormatUserInput(this.txtPwd.Value);
                        this.strSecurityLevel = this.selectLevel.Value;

                        System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
                        System.Net.ServicePointManager.CertificatePolicy = new CareerCruisingWeb.CCLib.SLXIntegration.TrustAllCertificatePolicy();
                        this.wsSLXIntegration = new WSCCIntegrationWithSLX.IntegrationWithSLX();
                        this.userCredential = new System.Net.NetworkCredential("WSCCTOSLX", "Next_20");
                        this.wsSLXIntegration.Credentials = userCredential;
                        this.wsSLXIntegration.PreAuthenticate = true;

                        this.cnnCC = new SqlConnection(this.strConnectionStringToCC);
                        if (this.cnnCC.State == ConnectionState.Closed)
                        {
                            this.cnnCC.Open();
                        }
                        this.trsCC = this.cnnCC.BeginTransaction();

                        this.intReturnValue1 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLInsertRRSUsers(this.strPassword, this.strFirstName,this.strLastName, this.strEmail, this.strSecurityLevel, this.strRegionID),this.cnnCC, this.trsCC);

                        if (this.intReturnValue1 > 0)
                        {
                           this.strSecCodeID = "SYST00000001";
                           this.strSecurityText = this.GetSecurityText(this.strSecurityLevel);
                           this.strContactName = this.strFirstName + " " + this.strLastName;
                           this.strLogType = "262148";      //Type: 262148 -- "Note"
                           this.strDescription = "RRS Account Added";
                           this.strNote = CreateNoteForAddNew(this.strFirstName, this.strLastName, this.strEmail, this.strSecurityText, this.strPassword);
                           this.objDistrictUserID = SqlHelper.ExecuteScalar(this.trsCC, CommandType.Text, this.GetCCSQLSelectDistrictUserID(this.strPassword, this.strRegionID));
                           this.strDistrictUserID = this.objDistrictUserID != null ? this.objDistrictUserID.ToString() : null;
                           this.objContactID = this.wsSLXIntegration.GetNewSLXID("Contact", this.strConnectionStringToSLX);
                           this.strContactID = this.objContactID != null ? this.objContactID.ToString() : null;
                           this.objAccountID = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectAccountID(this.strRegionID), this.strConnectionStringToSLX);
                           this.strAccountID = this.objAccountID != null ? this.objAccountID.ToString() : null;
                           this.objLicenseType = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectLicenseType(this.strAccountID), this.strConnectionStringToSLX);
                           this.strLicenseType = this.objLicenseType != null ? this.objLicenseType.ToString() : "";
                           if ((this.strLicenseType == "Licensed") | (this.strLicenseType == "Ontario") | (this.strLicenseType == "Kentucky"))
                           {
                               this.booIsLOK = true;
                           }
                           else
                           {
                               this.booIsLOK = false;
                           }
                           this.objAccount = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectAccount(this.strRegionID), this.strConnectionStringToSLX);
                           this.strAccount = this.objAccount != null ? CCLib.Common.Strings.FormatUserInput(this.objAccount.ToString()) : null;
                           this.objAddressID = this.wsSLXIntegration.GetNewSLXID("Address", this.strConnectionStringToSLX);this.strAddressID = this.objAddressID != null ? this.objAddressID.ToString() : null;
                           this.strAddressID = this.objAddressID != null ? this.objAddressID.ToString() : null;
                           this.objHistoryID = this.wsSLXIntegration.GetNewSLXID("History", this.strConnectionStringToSLX);
                           this.strHistoryID = this.objHistoryID != null ? this.objHistoryID.ToString() : null;

                           this.intReturnValue2 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLInsertContact(this.strContactID, this.strAccountID, this.strAccount, this.strFirstName, this.strLastName, this.strSecCodeID, this.strAddressID), this.strConnectionStringToSLX);
                           if (this.intReturnValue2 > 0)
                           {
                              this.intReturnValue3 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLSetReceiveNewsLetter(this.strContactID, booIsLOK), this.strConnectionStringToSLX);
                              if (this.intReturnValue3 > 0)
                              {
                                 this.intReturnValue4 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLInsertAddress(this.strAddressID, this.strContactID), this.strConnectionStringToSLX);
                                 if (this.intReturnValue4 > 0)
                                 {
                                     this.intReturnValue5 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLLogHistory(this.strHistoryID, this.strContactID, this.strContactName, this.strLogType,this.strDescription, this.strAccountID, this.strAccount, this.strNote),this.strConnectionStringToSLX);
                                     if (this.intReturnValue5 > 0)
                                     {
                                         this.intReturnValue6 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLInsertConRRSUsers(this.strContactID, this.strPassword, this.strSecurityLevel,this.strSecurityText, this.strEmail, this.strDistrictUserID),this.strConnectionStringToSLX);
                                     }
                                 }
                              }
                           }

                           if ((this.intReturnValue2 > 0) & (this.intReturnValue3 > 0) & (this.intReturnValue4 > 0) & (this.intReturnValue5 > 0) & (this.intReturnValue6 > 0))
                           {
                               this.trsCC.Commit();
                               this.ReleaseObjects();
                               Page.ClientScript.RegisterStartupScript(typeof(string), "alertScript", "alert('The new advisor has been added.');window.open('AccountsDistrictAdvisorList.aspx?rid=" + strRegionID + "','_parent')", true);
                           }
                           else
                           {
                               this.trsCC.Rollback();
                               divAdd.Visible = true;
                               this.ReleaseObjects();
                               Response.Write(CCLib.Common.Forms.JavaScriptNotify("The new advisor has failed to add. Plesae try again."));
                           }
                        }
                        else
                        {
                            this.trsCC.Rollback();
                            divAdd.Visible = true;
                            this.ReleaseObjects();
                            Response.Write(CCLib.Common.Forms.JavaScriptNotify("The new advisor has failed to add. Plesae try again."));
                        }
                    }
                }

                if (strType == "Edit")
                {
                    this.strPassword = CCLib.Common.Strings.FormatUserInput(this.txtPwdE.Value);
                    this.strID = CCLib.Common.Strings.GetFormString("ID");

                    if (this.CheckForPwdConflict(this.strPassword, this.strRegionID, this.strID))
                    {
                        divEdit.Visible = true;
                        Response.Write(CCLib.Common.Forms.JavaScriptNotify("A RRS user already exists with that password. Please choose a different password."));
                    }
                    else
                    {
                        this.booIfEdit = false;
                        this.strNote = "";
                        this.strID = CCLib.Common.Strings.GetFormString("ID");
                        this.dtOriginalAdmin = CCLib.Common.DataAccess.GetDataTable(this.GetCCSQLSelectRRSUsers(this.strID));
                        if (this.txtFirstNameE.Value.Trim() != this.dtOriginalAdmin.Rows[0]["FirstName"].ToString())
                        {
                            this.booIfEdit = true;
                            this.strNote = this.strNote + this.dtOriginalAdmin.Rows[0]["FirstName"].ToString() + " changed to " + this.txtFirstNameE.Value.ToString().Trim() + " -- ";
                        }

                        if (this.txtLastNameE.Value.Trim() != this.dtOriginalAdmin.Rows[0]["LastName"].ToString())
                        {
                            this.booIfEdit = true;
                            this.strNote = this.strNote + this.dtOriginalAdmin.Rows[0]["LastName"].ToString() + " changed to " + this.txtLastNameE.Value.ToString().Trim() + " -- ";
                        }

                        if (this.txtEmailE.Value.Trim() != this.dtOriginalAdmin.Rows[0]["EmailAddress"].ToString())
                        {
                            this.booIfEdit = true;
                            this.strNote = this.strNote + this.dtOriginalAdmin.Rows[0]["EmailAddress"].ToString() + " changed to " + this.txtEmailE.Value.ToString().Trim() + " -- ";
                        }

                        if (this.selectLevelE.Value != this.dtOriginalAdmin.Rows[0]["SecurityLevel"].ToString())
                        {
                            this.booIfEdit = true;
                            this.strNote = this.strNote + this.GetSecurityText(this.dtOriginalAdmin.Rows[0]["SecurityLevel"].ToString()) + " changed to " + this.GetSecurityText(this.selectLevelE.Value.ToString()) + " -- ";
                        }

                        if (this.txtPwdE.Value.Trim() != this.dtOriginalAdmin.Rows[0]["Password"].ToString())
                        {
                            this.booIfEdit = true;
                            this.strNote = this.strNote + this.dtOriginalAdmin.Rows[0]["Password"].ToString() + " changed to " + this.txtPwdE.Value.ToString() + " -- ";
                        }

                        if (this.booIfEdit)
                        {
                            this.strFirstName = CCLib.Common.Strings.FormatUserInput(this.txtFirstNameE.Value);
                            this.strLastName = CCLib.Common.Strings.FormatUserInput(this.txtLastNameE.Value);
                            this.strEmail = CCLib.Common.Strings.FormatUserInput(this.txtEmailE.Value);
                            this.strSecurityLevel = this.selectLevelE.Value;

                            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;
                            System.Net.ServicePointManager.CertificatePolicy = new CareerCruisingWeb.CCLib.SLXIntegration.TrustAllCertificatePolicy();
                            this.wsSLXIntegration = new WSCCIntegrationWithSLX.IntegrationWithSLX();
                            this.userCredential = new System.Net.NetworkCredential("WSCCTOSLX", "Next_20");
                            this.wsSLXIntegration.Credentials = userCredential;
                            this.wsSLXIntegration.PreAuthenticate = true;

                            this.cnnCC = new SqlConnection(this.strConnectionStringToCC);
                            if (this.cnnCC.State == ConnectionState.Closed)
                            {
                                this.cnnCC.Open();
                            }
                            this.trsCC = this.cnnCC.BeginTransaction();

                            this.intReturnValue1 = CareerCruisingWeb.CCLib.SLXIntegration.IntegrationWithSLX.ExecuteNoQuery(this.GetCCSQLUpdateRRSUsers(this.strFirstName, this.strLastName, this.strEmail, this.strPassword, this.strSecurityLevel, this.strID), this.cnnCC, this.trsCC);

                            if (this.intReturnValue1 > 0)
                            {
                                this.objHistoryID = this.wsSLXIntegration.GetNewSLXID("History", this.strConnectionStringToSLX);
                                this.strHistoryID = this.objHistoryID != null ? this.objHistoryID.ToString() : null;
                                this.objContactID = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectContactID(this.strID), this.strConnectionStringToSLX);
                                this.strContactID = this.objContactID != null ? this.objContactID.ToString() : null;
                                this.objAccountID = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectAccountID(this.strRegionID), this.strConnectionStringToSLX);
                                this.strAccountID = this.objAccountID != null ? this.objAccountID.ToString() : null;
                                this.objAccount = this.wsSLXIntegration.GetValueFromSLX(this.GetSLXSQLSelectAccount(this.strRegionID), this.strConnectionStringToSLX);
                                this.strAccount = this.objAccount != null ? CCLib.Common.Strings.FormatUserInput(this.objAccount.ToString()) : null;
                                this.strContactName = this.strFirstName + " " + this.strLastName;
                                this.strLogType = "262148";      //Type: 262148 -- "Note"
                                this.strDescription = "RRS Account Updated";

                                this.intReturnValue2 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLLogHistory(this.strHistoryID, this.strContactID, this.strContactName, this.strLogType, this.strDescription, this.strAccountID, this.strAccount, this.strNote), this.strConnectionStringToSLX);
                                if (this.intReturnValue2 > 0)
                                {
                                    this.intReturnValue3 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLUpdateContact(this.strFirstName, this.strLastName, this.strContactID), this.strConnectionStringToSLX);
                                }

                                if (this.intReturnValue3 > 0)
                                {
                                    this.intReturnValue4 = this.wsSLXIntegration.ExecuteNoQuery(this.GetSLXSQLUpdateConRRSUsers(this.strPassword, this.strSecurityLevel, this.GetSecurityText(this.strSecurityLevel), this.strEmail, this.strID), this.strConnectionStringToSLX);
                                }

                                if ((this.intReturnValue2 > 0) & (this.intReturnValue3 > 0) & (this.intReturnValue4 > 0))
                                {
                                    this.trsCC.Commit();
                                    this.ReleaseObjects();
                                    Response.Redirect("AccountsDistrictAdvisorList.aspx?rid=" + strRegionID);
                                }
                                else
                                {
                                    this.trsCC.Rollback();
                                    this.ReleaseObjects();
                                    divEdit.Visible = true;
                                    Response.Write(CCLib.Common.Forms.JavaScriptNotify("The RRS user has failed to update. Plesae try again."));
                                }
                            }
                            else
                            {
                                this.trsCC.Rollback();
                                this.ReleaseObjects();
                                divEdit.Visible = true;
                                Response.Write(CCLib.Common.Forms.JavaScriptNotify("The RRS user has failed to update. Plesae try again."));
                            }
                        }
                    }
                }
            }
            else
            {
                strType = CCLib.Common.Strings.GetQueryString("Type");
                strID = CCLib.Common.Strings.GetQueryString("ID");
                if (strType == "Add")
                    divAdd.Visible = true;
                if (strType == "Edit")
                {
                    divEdit.Visible = true;
                    strSQL = "select U.RegionID,U.FirstName,U.LastName,U.EmailAddress,U.Password,U.SecurityLevel ";
                    strSQL += " from RRSUsers as U join RRSRegions as R on U.RegionID = R.RegionID where U.DistrictUserID = " + strID;
                    dtAdmin = CCLib.Common.DataAccess.GetDataTable(strSQL);
                    txtFirstNameE.Value = dtAdmin.Rows[0]["FirstName"].ToString();
                    txtLastNameE.Value = dtAdmin.Rows[0]["Lastname"].ToString();
                    txtEmailE.Value = dtAdmin.Rows[0]["EmailAddress"].ToString();
                    txtPwdE.Value = dtAdmin.Rows[0]["Password"].ToString();
                    if (dtAdmin.Rows[0]["SecurityLevel"].ToString() == "100")
                        selectLevelE.SelectedIndex = 0;
                    else
                        selectLevelE.SelectedIndex = 1;
                }
            }
            #endregion Initialize Values and Form Execution

            #region Properties For The State Base Class
            TitleBar = "Manage Accounts";
            SubTitleBar = GetPortText(9309, false) + " Accounts";
            #endregion Properties For The State Base Class
        }