Exemple #1
0
        protected void DeleteSelectedReports()
        {
            foreach (KeyValuePair <int, int> keyvalue in SelectedForDelete)
            {
                BusinessServices.Report objReport = new BusinessServices.Report();
                objReport.DeleteReportInactive(keyvalue.Key, keyvalue.Value);
            }

            //LoadPeriodicReportsList();

            SelectedForDelete = null;
        }
Exemple #2
0
        protected void DeleteSelectedReports()
        {
            foreach (int scheduleId in SelectedForDelete)
            {
                BusinessServices.Report objReport = new BusinessServices.Report();
                objReport.DeleteReport(scheduleId);
            }

            LoadPeriodicReportsList();

            SelectedForDelete = null;
        }
Exemple #3
0
        private void ReassignSelectedReports()
        {
            BusinessServices.Report report = new BusinessServices.Report();
            BusinessServices.User   user   = new BusinessServices.User();
            if ((Username != null) && (Username != ""))
            {
                int UserID = user.GetIdFromUsername(Username);
                foreach (KeyValuePair <int, int> keyvalue in SelectedForReassign)
                {
                    report.ReassignReportInactive(keyvalue.Key, UserID, keyvalue.Value);
                }
            }
            else if (InactivatedUsernames.Count > 0)
            {
                foreach (string Uname in InactivatedUsernames)
                {
                    int UserID = user.GetIdFromUsername(Uname);
                    foreach (KeyValuePair <int, int> keyvalue in SelectedForReassign)
                    {
                        report.ReassignReportInactive(keyvalue.Key, UserID, keyvalue.Value);
                    }
                }

                InactivatedUsernames = null;
            }
            else if (InactivatedEmails.Count > 0)
            {
                foreach (string email in InactivatedEmails)
                {
                    int UserID = user.GetIdFromEmail(email);
                    foreach (KeyValuePair <int, int> keyvalue in SelectedForReassign)
                    {
                        report.ReassignReportInactive(keyvalue.Key, UserID, keyvalue.Value);
                    }
                }

                InactivatedEmails = null;
            }

            //LoadPeriodicReportsList();

            SelectedForReassign = null;
        }
Exemple #4
0
        protected void Save_OnClick(object sender, EventArgs e)
        {
            string strUser = Request.Form["gvradio"];

            if (strUser == null)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "select", "<script language='javascript'>confirm('A user must be selected'); </script>");
                return;
            }

            Int32.TryParse(strUser, out selectedUser);

            bool isOnInactivate = false;

            if (Request.QueryString["isoninactivate"] != null)
            {
                Boolean.TryParse(Request.QueryString["isoninactivate"].ToString(), out isOnInactivate);
            }

            if (isOnInactivate)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "close", "<script language='javascript'>opener.focus();opener.location.href = opener.location + '&reassignuser="******"&fromreassignpage=true'; self.close();</script>");
            }
            else
            {
                BusinessServices.Report report = new BusinessServices.Report();
                //if (this.scheduleId > 0)
                //{
                //    report.ReassignReport(this.scheduleId, selectedUser);
                //    ClientScript.RegisterStartupScript(this.GetType(), "close", "<script language='javascript'>opener.focus();opener.location.href = opener.location + '&fromreassignpage=true'; self.close();</script>");
                //}
                //else
                //{
                foreach (int schId in ScheduleIds)
                {
                    report.ReassignReport(schId, selectedUser);
                }
                ScheduleIds = null;
                ClientScript.RegisterStartupScript(this.GetType(), "close", "<script language='javascript'>opener.focus();opener.location.href = opener.location + '?fromreassignpage=true'; self.close();</script>");
                //}
            }
        }
Exemple #5
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);
        }