Пример #1
0
        protected void btnShowComplianceRules_Click(object sender, System.EventArgs e)
        {
            panelReport.Visible       = true;
            panelReportParams.Visible = false;

            Hashtable parameters = this.rvReport.Parameters;

            parameters["organisationID"] = UserContext.UserData.OrgID;
            parameters["AdminUserID"]    = UserContext.UserID;

            //1.Gather criteria
            // Get the selected units
            // string  strParentUnits  = String.Join(",",this.trvUnitsSelector.GetSelectedValues());
            string[] selectUnits;
            selectUnits = trvUnitPath.GetSelectedValues();
            //Double check
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();
            selectUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
            string strParentUnits = String.Join(",", selectUnits);

            parameters["unitIDs"] = strParentUnits;

            if (chkIncludeInactiveUnits.Checked)
            {
                parameters["IncludeInactive"] = 1;
            }
            else
            {
                parameters["IncludeInactive"] = 0;
            }

            parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
            parameters["langInterfaceName"] = "Report.UnitComplianceReport";
        }
Пример #2
0
        private void ShowReport()
        {
            //2. Add criteria to the report viewer
            Hashtable parameters = this.rvReport.Parameters;

            string[] selectUnits;
            selectUnits = trvUnitPath.GetSelectedValues();
            //Double check
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();
            selectUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
            string strParentUnits = String.Join(",", selectUnits);

            parameters["unitIDs"]           = strParentUnits;
            parameters["organisationID"]    = UserContext.UserData.OrgID;
            parameters["adminUserID"]       = UserContext.UserID;
            parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
            parameters["langInterfaceName"] = "Report.CPDReport";
            parameters["profileid"]         = this.cboProfile.SelectedValue == ""?"-1":this.cboProfile.SelectedValue;
            parameters["profileperiodid"]   = this.cboPeriod.SelectedValue == ""?"-1":this.cboPeriod.SelectedValue;
            parameters["UserFirstName"]     = this.txtFirstName.Text;
            parameters["UserLastName"]      = this.txtLastName.Text;
            parameters["userName"]          = this.txtUserName.Text;
            parameters["shortfallusers"]    = this.chbShortFallUsers.Checked?1:0;
            // report title for the CPD Report
            int intOrganisationID = UserContext.UserData.OrgID;

            BusinessServices.Profile objProfile = new BusinessServices.Profile();
            parameters["rptReportTitle"] = objProfile.getCPDReportTitle(intOrganisationID);
        }
Пример #3
0
        private void ShowReport()
        {
            //1.Gather criteria
            // Get the selected units
            // string  strParentUnits  = String.Join(",",this.trvUnitsSelector.GetSelectedValues());
            string[] selectUnits;
            selectUnits = trvUnitsSelector.GetSelectedValues();
            //Double check
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();
            selectUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
            string strParentUnits = String.Join(",", selectUnits);

            // Get the selected course and Complete / Incomplete status
            int intCourseID = Convert.ToInt32(cboCourse.SelectedValue);

            // Gather date parts for historic date
            DateTime dtEffective;

            if ((this.lstEffectiveDay.SelectedValue.Length > 0) && (this.lstEffectiveMonth.SelectedValue.Length > 0) && (this.lstEffectiveYear.SelectedValue.Length > 0))
            {
                dtEffective = new DateTime(int.Parse(this.lstEffectiveYear.SelectedValue), int.Parse(this.lstEffectiveMonth.SelectedValue), int.Parse(this.lstEffectiveDay.SelectedValue));
            }
            else
            {
                dtEffective = DateTime.Today;
            }

            if (this.optReportType.SelectedValue == "Table")
            {
                this.rvReport.ReportPath = this.rvReport.ReportPath;
            }
            else
            {
                this.rvReport.ReportPath = this.rvReport.ReportPath + this.optReportType.SelectedValue;
            }

            int intClassificationID = 0;

            if (this.cboCustomClassification.SelectedIndex > 0)
            {
                intClassificationID = int.Parse(cboCustomClassification.SelectedValue);
            }

            //2. Add criteria to the report viewer
            Hashtable parameters = this.rvReport.Parameters;

            parameters["organisationID"] = UserContext.UserData.OrgID;
            parameters["adminUserID"]    = UserContext.UserID;

            parameters["unitIDs"]   = strParentUnits;
            parameters["courseIDs"] = intCourseID;
            if (dtEffective != DateTime.Today)
            {
                parameters["effectiveDate"] = dtEffective.ToString("dd/MMM/yyyy");
            }

            parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
            parameters["langInterfaceName"] = "Report.Summary";
            parameters["classificationID"]  = intClassificationID;
        }
Пример #4
0
        private void ShowReport()
        {
            //1.Gather criteria
            // Get the selected units
            // string  strParentUnits  = String.Join(",",this.trvUnitsSelector.GetSelectedValues());
            string[] selectUnits;
            string   strCourses = "";

            selectUnits = trvUnitsSelector.GetSelectedValues();

            //Double check
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();
            selectUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
            string strParentUnits = String.Join(",", selectUnits);

            // Get the selected courses
            for (int intIndex = 0; intIndex != this.lstCourses.Items.Count; intIndex++)
            {
                if (this.lstCourses.Items[intIndex].Selected)
                {
                    if (intIndex == 0)
                    {
                        strCourses += this.lstCourses.Items[intIndex].Value;
                    }
                    else
                    {
                        strCourses += "," + this.lstCourses.Items[intIndex].Value;
                    }
                }
            }

            int intClassificationID = 0;

            if (this.cboCustomClassification.SelectedIndex > 0)
            {
                intClassificationID = int.Parse(this.cboCustomClassification.SelectedValue);
            }

            //2. Add criteria to the report viewer
            Hashtable parameters = this.rvReport.Parameters;

            parameters["organisationID"]    = UserContext.UserData.OrgID;
            parameters["adminUserID"]       = UserContext.UserID;
            parameters["unitIDs"]           = strParentUnits;
            parameters["courseIDs"]         = strCourses;
            parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
            parameters["langInterfaceName"] = "Report.Progress";
            parameters["classificationID"]  = intClassificationID;
            if (chkIncludeInactiveUsers.Checked)
            {
                parameters["IncludeInactive"] = 1;
            }
            else
            {
                parameters["IncludeInactive"] = 0;
            }
        }
Пример #5
0
        private void ShowReport()
        {
            //1.Gather criteria
            // Get the selected units
            // string  strParentUnits  = String.Join(",",this.trvUnitsSelector.GetSelectedValues());
            string[] selectUnits;
            selectUnits = trvUnitsSelector.GetSelectedValues();
            //Double check
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();
            selectUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
            string strParentUnits = String.Join(",", selectUnits);

            // Get the selected course
            int intCourseID = Convert.ToInt32(cboCourse.SelectedValue);

            // Gather date parts for trend date
            DateTime dtEffective;
            DateTime dtEffectiveTo;

            if ((this.lstEffectiveDay.SelectedValue.Length > 0) && (this.lstEffectiveMonth.SelectedValue.Length > 0) && (this.lstEffectiveYear.SelectedValue.Length > 0))
            {
                dtEffective = new DateTime(int.Parse(this.lstEffectiveYear.SelectedValue), int.Parse(this.lstEffectiveMonth.SelectedValue), int.Parse(this.lstEffectiveDay.SelectedValue));
            }
            else
            {            // The user select 'To Date' only
                // Set the from date to a past date to cover all the record has been created
                dtEffective = new DateTime(1997, 1, 1);
            }



            if ((this.lstEffectiveToDay.SelectedValue.Length > 0) && (this.lstEffectiveToMonth.SelectedValue.Length > 0) && (this.lstEffectiveToYear.SelectedValue.Length > 0))
            {
                dtEffectiveTo = new DateTime(int.Parse(this.lstEffectiveToYear.SelectedValue), int.Parse(this.lstEffectiveToMonth.SelectedValue), int.Parse(this.lstEffectiveToDay.SelectedValue));
            }
            else
            {
                dtEffectiveTo = DateTime.Today;
            }

            //2. Add criteria to the report viewer
            Hashtable parameters = this.rvReport.Parameters;

            parameters["organisationID"] = UserContext.UserData.OrgID;
            parameters["adminUserID"]    = UserContext.UserID;

            parameters["unitIDs"]   = strParentUnits;
            parameters["courseIDs"] = intCourseID;
            parameters["FromDate"]  = dtEffective;
            parameters["ToDate"]    = dtEffectiveTo;

            parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
            parameters["langInterfaceName"] = "Report.Trend";
        }
Пример #6
0
        /// <summary>
        /// Called when the Generate button is clicked, gathers information from the form and generates report
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnGenerate_Click(object sender, System.EventArgs e)
        {
            string[] astrUnits;                 // Array of units
            string   strCourses = "";           // String containing courses in csv format
            int      intCustomClassificationID; // Int containing the Custom Classification ID
            DateTime dtEffective     = new DateTime(1);
            int      intInclInactive = 0;
            int      intDay;
            int      intMonth;
            int      intYear;

            // units
            astrUnits = this.trvUnitsSelector.GetSelectedValues();
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();
            astrUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, astrUnits);
            string strUnits = String.Join(",", astrUnits);

            // courses
            for (int intIndex = 0; intIndex != this.lstCourses.Items.Count; intIndex++)
            {
                if (this.lstCourses.Items[intIndex].Selected)
                {
                    strCourses += this.lstCourses.Items[intIndex].Value + ",";
                }
            }
            for (int intIndex = 0; intIndex != this.lstPastCourses.Items.Count; intIndex++)
            {
                if (this.lstPastCourses.Items[intIndex].Selected)
                {
                    strCourses += this.lstPastCourses.Items[intIndex].Value + ",";
                }
            }
            if (strCourses.Length > 0)
            {
                strCourses = strCourses.Substring(0, strCourses.Length - 1);
            }

            // effective date
            switch ((int)ViewState[cm_strAdminReportTypeParameterName])
            {
            case (int)AdminReportType.Current:
            {
                dtEffective = System.DateTime.Today;
                break;
            }

            case (int)AdminReportType.Historic:
            {
                // Gather date parts for Effective Day
                intDay      = Convert.ToInt16(this.lstEffectiveDay.SelectedValue);
                intMonth    = Convert.ToInt16(this.lstEffectiveMonth.SelectedValue);
                intYear     = Convert.ToInt16(this.lstEffectiveYear.SelectedValue);
                dtEffective = new DateTime(intYear, intMonth, intDay);
                if (dtEffective.CompareTo(System.DateTime.Today) >= 1)
                {
                    // You cant report historically on the future
                    throw  new ArgumentOutOfRangeException();
                }
                if (this.chbInclInactiveUser.Checked)
                {
                    intInclInactive = 1;
                }
                break;
            }
            }

            // custom classification
            if (this.cboCustomClassification.Items.Count == 0)
            {
                intCustomClassificationID = 0;
            }
            else
            {
                intCustomClassificationID = int.Parse(this.cboCustomClassification.SelectedValue);
            }

            // report parameters
            Hashtable parameters;

            if (this.radGroupBy.SelectedValue.ToString() == "UNIT_USER")
            {
                parameters = this.rvReport.Parameters;
            }
            else
            {
                parameters = this.rvReportByCourse.Parameters;
            }
            parameters["organisationID"]   = UserContext.UserData.OrgID;
            parameters["unitIDs"]          = strUnits;
            parameters["courseIDs"]        = strCourses;
            parameters["UserFirstName"]    = this.txtFirstName.Text;
            parameters["UserLastName"]     = this.txtLastName.Text;
            parameters["userName"]         = this.txtUserName.Text;
            parameters["userEmail"]        = this.txtEmail.Text;
            parameters["effectiveDate"]    = dtEffective;
            parameters["adminUserID"]      = UserContext.UserID;
            parameters["classificationID"] = intCustomClassificationID;
            parameters["groupBy"]          = this.radGroupBy.SelectedValue.ToString();
            parameters["sortBy"]           = this.lstWithinUserSort.SelectedValue.ToString();
            parameters["inclInactive"]     = intInclInactive;
            parameters["serverURL"]        = Request.Url.Host;

            // lang parameters
            parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
            parameters["langInterfaceName"] = "Report.Administration";

            // switch the placeholders
            this.panelSearchCriteria.Visible = false;
            if (this.radGroupBy.SelectedValue.ToString() == "UNIT_USER")
            {
                this.panelReportResults.Visible         = true;
                this.panelReportResultsByCourse.Visible = false;
            }
            else
            {
                this.panelReportResultsByCourse.Visible = true;
                this.panelReportResults.Visible         = false;
            }
        }         // btnGenerate_Click
Пример #7
0
        private void ShowReport()
        {
            //1.Gather criteria
            // Get the selected units
            // string  strParentUnits  = String.Join(",",this.trvUnitsSelector.GetSelectedValues());
            string[] selectUnits;
            string   strCourses = "";

            selectUnits = trvUnitsSelector.GetSelectedValues();

            DateTime dtEffective;
            DateTime dtEffectiveTo;

            //Double check
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();
            selectUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
            string strParentUnits = String.Join(",", selectUnits);

            // Get the selected courses
            for (int intIndex = 0; intIndex != this.lstCourses.Items.Count; intIndex++)
            {
                if (this.lstCourses.Items[intIndex].Selected)
                {
                    if (intIndex == 0)
                    {
                        strCourses += this.lstCourses.Items[intIndex].Value;
                    }
                    else
                    {
                        strCourses += "," + this.lstCourses.Items[intIndex].Value;
                    }
                }
            }

            // Gather date parts for historic date
            if ((this.lstEffectiveDay.SelectedValue.Length > 0) && (this.lstEffectiveMonth.SelectedValue.Length > 0) && (this.lstEffectiveYear.SelectedValue.Length > 0))
            {
                dtEffective = new DateTime(int.Parse(this.lstEffectiveYear.SelectedValue), int.Parse(this.lstEffectiveMonth.SelectedValue), int.Parse(this.lstEffectiveDay.SelectedValue));
            }
            else
            {            // The user select 'To Date' only
                // Set the from date to a past date to cover all the record has been created
                dtEffective = new DateTime(1997, 1, 1);
            }



            if ((this.lstEffectiveToDay.SelectedValue.Length > 0) && (this.lstEffectiveToMonth.SelectedValue.Length > 0) && (this.lstEffectiveToYear.SelectedValue.Length > 0))
            {
                dtEffectiveTo = new DateTime(int.Parse(this.lstEffectiveToYear.SelectedValue), int.Parse(this.lstEffectiveToMonth.SelectedValue), int.Parse(this.lstEffectiveToDay.SelectedValue));
            }
            else
            {
                dtEffectiveTo = DateTime.Today;
            }

            int intClassificationID = 0;

            if (this.cboCustomClassification.SelectedIndex > 0)
            {
                intClassificationID = int.Parse(this.cboCustomClassification.SelectedValue);
            }

            //2. Add criteria to the report viewer
            Hashtable parameters = this.rvReport.Parameters;

            parameters["organisationID"]    = UserContext.UserData.OrgID;
            parameters["adminUserID"]       = UserContext.UserID;
            parameters["unitIDs"]           = strParentUnits;
            parameters["courseIDs"]         = strCourses;
            parameters["failCounter"]       = int.Parse(this.txtFailCounter.Text);
            parameters["dateFrom"]          = dtEffective.ToString("s");
            parameters["dateTo"]            = dtEffectiveTo.ToString("yyyy-MM-dd");
            parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
            parameters["langInterfaceName"] = "Report.AtRisk";
            parameters["classificationID"]  = intClassificationID;
        }
Пример #8
0
        /// <summary>
        /// Get Pagination Data
        /// </summary>
        /// <returns></returns>
        private DataView GetPaginationData()
        {
            // Customize, and return DataView
            // conduct search based on criteria
            Report objReport = new Report();

            string[] astrUnits;
            string   strUnits;
            string   strCourse;

            strCourse = "";
            strUnits  = "";
            DataTable dtbResults = new DataTable();

            this.lblError.Text    = "";
            this.lblError.Visible = false;
            try
            {
                BusinessServices.Unit objUnit = new  BusinessServices.Unit();
                astrUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, this.trvUnitsSelector.GetSelectedValues());
                // Convert array back to a csv string.
                foreach (string strUnit in astrUnits)
                {
                    strUnits += strUnit + ",";
                }
                if (astrUnits.Length > 0)
                {
                    strUnits = strUnits.Substring(0, strUnits.Length - 1);
                }
                else
                {
                    strUnits = null;
                }
                strCourse = cboCourses.SelectedValue;
                if (strCourse.Length > 0)
                {
                    dtbResults = objReport.GetTrendReport(UserContext.UserData.OrgID, strUnits, Convert.ToInt32(strCourse));
                    if (dtbResults.Rows.Count == 0)
                    {
                        this.lblError.Text   += ResourceManager.GetString("lblError.NoUser");                    //"No users found";
                        this.lblError.Visible = true;
                    }
                    else
                    {
                        this.plhSearchCriteria.Visible = false;
                        this.plhReportResults.Visible  = true;

                        BusinessServices.User objUser = new BusinessServices.User();
                        DataTable             dtbUser = objUser.GetUser(UserContext.UserID);
                        if (dtbUser.Rows.Count > 0)
                        {
                            // Display Report Criteria
                            this.ucCriteria.Criteria.Add(ResourceManager.GetString("Reportrunby"), dtbUser.Rows[0]["LastName"].ToString() + ", " + dtbUser.Rows[0]["FirstName"].ToString());
                            this.ucCriteria.Criteria.Add(ResourceManager.GetString("Reportrunat"), DateTime.Now.ToString("dd/MM/yyyy") + " " + DateTime.Now.ToLongTimeString());
                        }
                        if (trvUnitsSelector.GetSelectedValues().Length == 0)
                        {
                            this.ucCriteria.AddUnits(null);
                        }
                        else
                        {
                            this.ucCriteria.AddUnits(strUnits);
                        }
                        this.ucCriteria.AddCourses(strCourse);
                        this.ucCriteria.Render();

                        BusinessServices.Course objCourse = new Course();
                        DataTable dtbCourseDetails        = objCourse.GetCourse(Int32.Parse(strCourse), UserContext.UserData.OrgID);

                        this.lblPageTitle.Text    = String.Format(ResourceManager.GetString("lblPageTitle.1"), dtbCourseDetails.Rows[0]["Name"].ToString());//"Trend Report - " + dtbCourseDetails.Rows[0]["Name"].ToString();
                        plhSearchCriteria.Visible = false;
                        plhReportResults.Visible  = true;
                        lblError.Visible          = false;
                    }
                }
                else
                {
                    lblError.Visible = true;
                    lblError.Text    = ResourceManager.GetString("lblError.OnCourse");                 //"You must select at least one course.";
                }
            }
            catch (Exception Ex)
            {
                ErrorLog Error = new ErrorLog(Ex, ErrorLevel.Medium, "TrendReport.aspx", "btnGenerate_Click", "");
                throw (Ex);
            }
            return(dtbResults.DefaultView);
        }
Пример #9
0
        /// <summary>
        /// Compiles the list of users to which the email should be sent,
        /// and attempts to send it to that list + anyone on the CC list
        /// + the current user.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSendEmail_Click(object sender, System.EventArgs e)
        {
            string strUnitIDs = "";
            string strUserIDs = "";

            lblError.Text = "";

            try
            {
                // Get selected units
                BusinessServices.Unit objUnit = new  BusinessServices.Unit();
                string[] astrUnitIDs          = astrUnitIDs = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, trvUnitsSelector.GetSelectedValues());
                foreach (string strUnit in astrUnitIDs)
                {
                    strUnitIDs += strUnit + ",";
                }
                if (strUnitIDs.Length > 0)
                {
                    strUnitIDs = strUnitIDs.Substring(0, strUnitIDs.Length - 1);
                }

                // Get users
                DataTable dtbResults = new Email().GetUsersToEmail(UserContext.UserData.OrgID, strUnitIDs);
                foreach (DataRow drwUser in dtbResults.Rows)
                {
                    strUserIDs += drwUser.ItemArray[0].ToString() + ",";
                }
                if (strUserIDs.Length > 0)
                {
                    strUserIDs = strUserIDs.Substring(0, strUserIDs.Length - 1);
                }

                // Validate that the user has a valid recipient, subject and body.
                if (strUserIDs.Length > 0 && this.txtEmailSubject.Text.Length > 0 && this.txtEmailBody.Text.Length > 0)
                {
                    // Config
                    BusinessServices.AppConfig objAppConfig = new BusinessServices.AppConfig();
                    DataTable dtbAppConfig = objAppConfig.GetList();
                    this.lblError.Text = "";

                    // Email setup
                    BusinessServices.User objUser = new BusinessServices.User();
                    DataTable             dtbCurrentUserDetails = objUser.GetUser(UserContext.UserID);
                    string strEmailFromName         = dtbCurrentUserDetails.Rows[0]["FirstName"].ToString() + " " + dtbCurrentUserDetails.Rows[0]["LastName"].ToString();
                    string strEmailFromEmail        = dtbCurrentUserDetails.Rows[0]["Email"].ToString();
                    string strEmailSubject          = this.txtEmailSubject.Text;
                    string strUsers                 = "\n\nSent To:";
                    BusinessServices.Email objEmail = new BusinessServices.Email();

                    // target users
                    string    strEmailToName    = "";
                    string    strEmailToEmail   = "";
                    DataTable dtbEmailAddresses = objUser.GetEmails(strUserIDs);
                    foreach (DataRow drwEmailAddress in dtbEmailAddresses.Rows)
                    {
                        strEmailToEmail = drwEmailAddress.ItemArray[3].ToString();
                        strEmailToName  = drwEmailAddress.ItemArray[0].ToString() + " " + drwEmailAddress.ItemArray[1].ToString();
                        int intUserId = Int32.Parse(drwEmailAddress.ItemArray[1].ToString());
                        objEmail.SetEmailBody(this.txtEmailBody.Text, intUserId, "", "", "", "", "", "", "", "");
                        strEmailSubject = objEmail.emailHeaderSub(strEmailSubject);
                        objEmail.SendEmail(strEmailToEmail, strEmailToName, strEmailFromEmail, strEmailFromName, null, null, strEmailSubject, ApplicationSettings.MailServer, UserContext.UserData.OrgID, intUserId);

                        // accumulate user list to append to current user email
                        strUsers += "\n\t" + strEmailToName;
                    }

                    // CC list.
                    string strEmailCCName = "";
                    strUsers += "\n\nCC:";
                    foreach (string addr in this.txtCC.Text.Split(new char[] { ',', ';' }))
                    {
                        string strEmailCCEmail = addr.Trim();
                        if (strEmailCCEmail != "")
                        {
                            try
                            {
                                objEmail.SendEmail(strEmailCCEmail, strEmailCCName, strEmailFromEmail, strEmailFromName, null, null, strEmailSubject, ApplicationSettings.MailServer, UserContext.UserData.OrgID, 0);
                                strUsers += "\n\t" + strEmailCCEmail;
                            }
                            catch (Exception)
                            {
                                objEmail.setCCSendError(strEmailCCEmail);
                                objEmail.SendEmail(strEmailFromEmail, strEmailFromName, strEmailFromEmail, strEmailFromName, null, null, "Error sending mail to CC recipient", ApplicationSettings.MailServer, UserContext.UserData.OrgID, UserContext.UserID);
                            }
                        }
                    }

                    // copy to Current user
                    objEmail.setUserCopyEmailBody(this.txtEmailBody.Text + strUsers);
                    objEmail.SendEmail(strEmailFromEmail, strEmailFromName, strEmailFromEmail, strEmailFromName, null, null, strEmailSubject, ApplicationSettings.MailServer, UserContext.UserData.OrgID, UserContext.UserID);

                    this.plhEditEmail.Visible = false;
                    this.plhComplete.Visible  = true;
                }
                else
                {
                    lblError.Text          = ResourceManager.GetString("lblError.OneRecip");         //"To send an email you must have at least one recipient, an email subject and an email body.";
                    this.lblError.CssClass = "WarningMessage";
                }
            }
            catch (Exception ex)
            {
                //Catch and throw error
                ErrorLog objError = new ErrorLog(ex, ErrorLevel.High, "EmailUsers.aspx.cs", "btnSendEmail_Click", "General error occurred attempting to send email");
                throw (ex);
            }
        }
Пример #10
0
        protected void btnSubmitReport_Click(object sender, System.EventArgs e)
        {
            panelReport.Visible       = true;
            panelReportParams.Visible = false;

            string[] selectUnits;
            string   strCourses = "", strAllCourses = "";

            selectUnits = trvUnitPath.GetSelectedValues();

            // Get the selected courses
            for (int intIndex = 0; intIndex != this.courseList.Items.Count; intIndex++)
            {
                if (this.courseList.Items[intIndex].Selected)
                {
                    if (intIndex == 0)
                    {
                        strCourses += this.courseList.Items[intIndex].Value;
                    }
                    else
                    {
                        strCourses += "," + this.courseList.Items[intIndex].Value;
                    }
                }

                // append the all courses string
                if (intIndex == 0)
                {
                    strAllCourses += this.courseList.Items[intIndex].Value;
                }
                else
                {
                    strAllCourses += "," + this.courseList.Items[intIndex].Value;
                }
            }

            if (strCourses.Length == 0)
            {
                strCourses = strAllCourses;
            }



            int intIncludeIncative = 0;

            if (chkIncludeInactiveUsers.Checked)
            {
                intIncludeIncative = 1;
            }

            BusinessServices.Unit objUnit = new BusinessServices.Unit();
            selectUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
            string strParentUnits = String.Join(",", selectUnits);


            Hashtable parameters = this.rvReport.Parameters;

            parameters["organisationID"] = UserContext.UserData.OrgID;
            parameters["adminUserID"]    = UserContext.UserID;
            parameters["effectiveDate"]  = DateTime.Now.Date;

            parameters["unitIDs"]   = strParentUnits;
            parameters["courseIDs"] = strCourses;

            parameters["IncludeInactive"]   = intIncludeIncative;
            parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
            parameters["langInterfaceName"] = "Report.EbookDownload";
        }
Пример #11
0
        private void ShowReport()
        {
            //1.Gather criteria
            // Get the selected units
            // string  strParentUnits  = String.Join(",",this.trvUnitsSelector.GetSelectedValues());
            string[] selectUnits;
            selectUnits = trvUnitsSelector.GetSelectedValues();
            //Double check
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();
            selectUnits = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
            string strParentUnits = String.Join(",", selectUnits);

            // Get the selected course and Complete / Incomplete status
            int intCourseID = Convert.ToInt32(cboCourse.SelectedValue);
            //bool bolStatus = Convert.ToBoolean(optStatus.SelectedValue);

            // Gather date parts for historic date
            DateTime dtEffective;

            if ((this.lstEffectiveDay.SelectedValue.Length > 0) && (this.lstEffectiveMonth.SelectedValue.Length > 0) && (this.lstEffectiveYear.SelectedValue.Length > 0))
            {
                dtEffective = new DateTime(int.Parse(this.lstEffectiveYear.SelectedValue), int.Parse(this.lstEffectiveMonth.SelectedValue), int.Parse(this.lstEffectiveDay.SelectedValue));
            }
            else
            {
                dtEffective = DateTime.Today;
            }

            //2. Add criteria to the report viewer
            if (this.optStatus.SelectedValue != "Details")
            {
                //Running standard reports with complete/incomplete criteria
                bool bolStatus = Convert.ToBoolean(optStatus.SelectedValue);

                this.rvReport.ReportPath = this.rvReport.ReportPath;

                Hashtable parameters = this.rvReport.Parameters;
                parameters["organisationID"] = UserContext.UserData.OrgID;
                parameters["adminUserID"]    = UserContext.UserID;

                parameters["unitIDs"]    = strParentUnits;
                parameters["courseIDs"]  = intCourseID;
                parameters["CourseName"] = cboCourse.SelectedItem.ToString();
                parameters["completed"]  = bolStatus;

                if (dtEffective != DateTime.Today)
                {
                    parameters["effectiveDate"] = dtEffective.ToString("s");
                }

                parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
                parameters["langInterfaceName"] = "Report.CompletedUser";
            }
            else
            {
                //Running incomplete users report with the module details for each user
                this.rvReport.ReportPath = this.rvReport.ReportPath + this.optStatus.SelectedValue;

                Hashtable parameters = this.rvReport.Parameters;
                parameters["organisationID"] = UserContext.UserData.OrgID;
                parameters["adminUserID"]    = UserContext.UserID;

                parameters["unitIDs"]    = strParentUnits;
                parameters["courseIDs"]  = intCourseID;
                parameters["CourseName"] = cboCourse.SelectedItem.ToString();

                if (dtEffective != DateTime.Today)
                {
                    parameters["effectiveDate"] = dtEffective.ToString("s");
                }

                parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
                parameters["langInterfaceName"] = "Report.IncompleteUserWithDetails";
            }

            //if (dtEffective!= DateTime.Today)
            //{
            //	parameters["effectiveDate"] =  dtEffective.ToString("s");
            //}
            //parameters["langCode"] = Request.Cookies["currentCulture"].Value;
            //parameters["langInterfaceName"] = "Report.CompletedUser";
        }
Пример #12
0
        /// <summary>
        /// Get Pagination Data
        /// </summary>
        /// <returns> DataView with all users that are not organisation administrators.</returns>
        private DataView GetPaginationData()
        {
            // Get the selected units
            // string  strParentUnits  = String.Join(",",this.trvUnitsSelector.GetSelectedValues());
            BusinessServices.Unit objUnit = new  BusinessServices.Unit();
            string strParentUnits         = String.Join(",", objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, trvUnitsSelector.GetSelectedValues()));

            if (strParentUnits.Length == 0)
            {
                strParentUnits = null;
            }

            // Get the selected course and Complete / Incomplete status
            int  intCourseID = Convert.ToInt32(cboCourse.SelectedValue);
            bool bolStatus   = Convert.ToBoolean(optStatus.SelectedValue);

            // Gather date parts for historic date
            DateTime dtEffective;

            if ((this.lstEffectiveDay.SelectedValue.Length > 0) && (this.lstEffectiveMonth.SelectedValue.Length > 0) && (this.lstEffectiveYear.SelectedValue.Length > 0))
            {
                dtEffective = new DateTime(int.Parse(this.lstEffectiveYear.SelectedValue), int.Parse(this.lstEffectiveMonth.SelectedValue), int.Parse(this.lstEffectiveDay.SelectedValue));
                if (dtEffective.CompareTo(System.DateTime.Today) >= 1)
                {
                    // Can't provide a historic date in the future
                    throw new ArgumentOutOfRangeException();
                }
            }
            else
            {
                dtEffective = DateTime.MinValue;
            }

            // Execute the report
            BusinessServices.Report objReport = new BusinessServices.Report();
            DataTable dtblReport = objReport.GetCompletedUsersReport(UserContext.UserData.OrgID, strParentUnits, intCourseID, dtEffective, bolStatus);

            if (dtblReport.Rows.Count == 0)
            {
                this.lblError.Visible  = true;
                this.lblError.Text    += ResourceManager.GetString("lblError.NoUsers"); //"No users found.";
                this.lblError.CssClass = "FeedbackMessage";
            }
            else
            {
                BusinessServices.User objUser = new BusinessServices.User();
                DataTable             dtbUser = objUser.GetUser(UserContext.UserID);
                if (dtbUser.Rows.Count > 0)
                {
                    // Display Report Criteria
                    this.ucCriteria.Criteria.Add(ResourceManager.GetString("ReportRunBy"), dtbUser.Rows[0]["LastName"].ToString() + ", " + dtbUser.Rows[0]["FirstName"].ToString());
                    this.ucCriteria.Criteria.Add(ResourceManager.GetString("ReportRunAt"), DateTime.Now.ToString("dd/MM/yyyy") + " " + DateTime.Now.ToLongTimeString());
                }
                if (trvUnitsSelector.GetSelectedValues().Length == 0)
                {
                    this.ucCriteria.AddUnits(null);
                }
                else
                {
                    this.ucCriteria.AddUnits(strParentUnits);
                }
                this.ucCriteria.AddCourses(intCourseID.ToString());
                if (bolStatus)
                {
                    this.ucCriteria.Criteria.Add(ResourceManager.GetString("cmnStatus"), ResourceManager.GetString("optStatus.1"));
                }
                else
                {
                    this.ucCriteria.Criteria.Add(ResourceManager.GetString("cmnStatus"), ResourceManager.GetString("optStatus.2"));
                }
                if (dtEffective != DateTime.MinValue)
                {
                    this.ucCriteria.Criteria.Add(ResourceManager.GetString("EffectiveDate"), dtEffective.ToString("dd/MM/yyyy"));
                }
                else
                {
                    this.ucCriteria.Criteria.Add(ResourceManager.GetString("EffectiveDate"), DateTime.Now.ToString("dd/MM/yyyy"));
                }
                this.ucCriteria.Render();
            }
            //Customize, and return DataView
            return(dtblReport.DefaultView);
        }
Пример #13
0
        private void ShowReport()
        {
            //1.Gather criteria

            // Get the selected units
            // string  strParentUnits  = String.Join(",",this.trvUnitsSelector.GetSelectedValues());
            string[] selectUnits;
            selectUnits = trvUnitsSelector.GetSelectedValues();
            string strUnits = "0";

            if (selectUnits.Length > 0)
            {
                strUnits = String.Join(",", selectUnits);
            }
            else if (selectUnits.Length == 0)
            {
                // Get all the parent units.  Only Needed for this Report, if the selected units is empty - then select all parents.
                BusinessServices.Unit objUnit = new  BusinessServices.Unit();
                string[] selectParentUnits    = objUnit.ReturnAdministrableUnitsByUserID(UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
                //string  strParentUnits  = String.Join(",",selectParentUnits);
                strUnits = String.Join(",", selectParentUnits);
            }


            // Get the selected Policy Acceptance Status
            //			int intCourseID = Convert.ToInt32(cboCourse.SelectedValue);
            string strAcceptance = radAcceptance.SelectedValue.ToString();

            // Get the selected Policies
            string strPolicies = string.Empty;             //"0";

            for (int intIndex = 0; intIndex != this.lstPolicy.Items.Count; intIndex++)
            {
                if (this.lstPolicy.Items[intIndex].Selected)
                {
                    if (intIndex == 0)
                    {
                        strPolicies += this.lstPolicy.Items[intIndex].Value;
                    }
                    else
                    {
                        strPolicies += "," + this.lstPolicy.Items[intIndex].Value;
                    }
                }
            }

            DateTime dtEffective;
            DateTime dtEffectiveTo;

            // Gather date parts for date range
            if ((this.lstEffectiveDay.SelectedValue.Length > 0) && (this.lstEffectiveMonth.SelectedValue.Length > 0) && (this.lstEffectiveYear.SelectedValue.Length > 0))
            {
                dtEffective = new DateTime(int.Parse(this.lstEffectiveYear.SelectedValue), int.Parse(this.lstEffectiveMonth.SelectedValue), int.Parse(this.lstEffectiveDay.SelectedValue));
            }
            else
            {            // The user select 'To Date' only
                // Set the from date to a past date to cover all the record has been created
                dtEffective = new DateTime(1997, 1, 1);
            }


            if ((this.lstEffectiveToDay.SelectedValue.Length > 0) && (this.lstEffectiveToMonth.SelectedValue.Length > 0) && (this.lstEffectiveToYear.SelectedValue.Length > 0))
            {
                dtEffectiveTo = new DateTime(int.Parse(this.lstEffectiveToYear.SelectedValue), int.Parse(this.lstEffectiveToMonth.SelectedValue), int.Parse(this.lstEffectiveToDay.SelectedValue));
                dtEffectiveTo = dtEffectiveTo.AddDays(1);
            }
            else
            {
                dtEffectiveTo = DateTime.Today.AddDays(1);
            }

            string lstrInclInactiveUser = "";

            if (this.chbInclInactiveUser.Checked)
            {
                lstrInclInactiveUser = "******";
            }
            else
            {
                lstrInclInactiveUser = "******";
            }


            //2. Add criteria to the report viewer
            Hashtable parameters = this.rvReport.Parameters;

            parameters["organisationID"]   = UserContext.UserData.OrgID;
            parameters["adminUserID"]      = UserContext.UserID;
            parameters["unitIDs"]          = strUnits;     //strParentUnits;
            parameters["policyIDs"]        = strPolicies;
            parameters["dateFrom"]         = dtEffective.ToString("s");
            parameters["dateTo"]           = dtEffectiveTo.ToString("s");
            parameters["acceptanceStatus"] = strAcceptance;
            parameters["IncludeInactive"]  = lstrInclInactiveUser;

            parameters["langCode"]          = Request.Cookies["currentCulture"].Value;
            parameters["langInterfaceName"] = "Report.Policies";
        }
Пример #14
0
		private void ShowDataPage(int currentPageIndex)
		{
			try
			{
				BusinessServices.Profile objProfile = new BusinessServices.Profile();
				int intProfileID = Int32.Parse(cboProfile.SelectedValue.ToString());

				string[] selectUnits;
				selectUnits = trvUnitPath.GetSelectedValues();
				//Double check
				BusinessServices.Unit objUnit = new  BusinessServices.Unit();
				selectUnits = objUnit.ReturnAdministrableUnitsByUserID( UserContext.UserID, UserContext.UserData.OrgID, selectUnits);
				string  strParentUnits  = String.Join(",",selectUnits);

				//1. Get data
				DataView  dvwPagination = objProfile.GetCPDEmailData(intProfileID, strParentUnits);
				
				if ( dvwPagination.Table.Rows.Count==0)
				{
					this.lblError.Text += "<BR>" + ResourceManager.GetString("lblError.NoDataFound");
					this.lblError.CssClass = "FeedbackMessage";
					this.plhSearchCriteria.Visible=false;
					this.plhReportResults.Visible=false;
					this.lblError.Visible=true;
				}
				else
				{
					//1.5 record the user ids to send the emails to
					// Only Populate it the first time
					if (ViewState["UserIDsHaveBeenPopulated"]==null)
					{
						foreach (DataRow drwUser in dvwPagination.Table.Rows)
						{
							this.txtUserIDs.Text += drwUser.ItemArray[1].ToString() + ",";
						}
						// remove trailing comma
						if (this.txtUserIDs.Text.Length > 0)
						{
							this.txtUserIDs.Text = this.txtUserIDs.Text.Substring(0,this.txtUserIDs.Text.Length-1);
						}
						ViewState["UserIDsHaveBeenPopulated"]="Yes";
					}

					//2. Sort Data
					string	strOrderByField, strOrderByDirection;
					strOrderByField =(string)ViewState["OrderByField"];
					strOrderByDirection =(string)ViewState["OrderByDirection"];

					dvwPagination.Sort = strOrderByField + " " + strOrderByDirection;

					//3. Set pagination panel
					int intPageSize;
					intPageSize = ApplicationSettings.PageSize ;
					this.SetPaginationPanel(intPageSize, dvwPagination.Count,ref currentPageIndex);

					//4. Bind Data
					grdPagination.DataSource = dvwPagination;
					grdPagination.PageSize = intPageSize;
					grdPagination.CurrentPageIndex = currentPageIndex;
					grdPagination.DataBind();
				} 
			}
			catch(BusinessServiceException ex)
			{
				this.tblPagination.Visible=false;
				this.lblMessage.Text = ex.Message;
				this.lblMessage.CssClass = "WarningMessage";
			}
		}