示例#1
0
 public ActionResult MeetingsForDateRange(DateTime dt1, DateTime dt2, OrgSearchModel m)
 {
     var orgs = string.Join(",", m.FetchOrgs().Select(oo => oo.OrganizationId));
     var cn = new SqlConnection(Util.ConnectionString);
     cn.Open();
     var q = cn.Query("MeetingsForDateRange", new
     {
         orgs,
         startdate = dt1,
         enddate = dt2,
     }, commandType: CommandType.StoredProcedure, commandTimeout: 600);
     var entity = (IDictionary<string, object>) q.First();
     var cols = entity.Keys.Cast<string>().ToList();
     var ep = new ExcelPackage();
     var ws = ep.Workbook.Worksheets.Add("Sheet1");
     int row = 1;
     for (var i = 0; i < cols.Count; i++)
         ws.Cells[row, i+1].Value = cols[i];
     row++;
     foreach (var r in q)
     {
         var rr = (IDictionary<string, object>) r;
         for (var i = 0; i < cols.Count; i++)
             ws.Cells[row, i+1].Value = rr[cols[i]];
         row++;
     }
     ws.Cells[ws.Dimension.Address].AutoFitColumns();
     return new EpplusResult(ep, "MeetingsForDateRange.xlsx");
 }
 public static EpplusResult Result(OrgSearchModel m)
 {
     var q = List(m);
     var cols = typeof(MissionTripTotal).GetProperties();
     var count = q.Count;
     var ep = new ExcelPackage();
     var ws = ep.Workbook.Worksheets.Add("Sheet1");
     if (count == 0)
     {
         ws.Cells["A1"].Value = "nothing to report";
         return new EpplusResult(ep, "MissionTripFunding.xlsx");
     }
     ws.Cells["A2"].LoadFromCollection(q);
     var range = ws.Cells[1, 1, count + 1, cols.Length];
     var table = ws.Tables.Add(range, "Trips");
     table.TableStyle = TableStyles.Light9;
     table.ShowFilter = false;
     for (var i = 0; i < cols.Length; i++)
     {
         var col = i + 1;
         var name = cols[i].Name;
         table.Columns[i].Name = name;
         var colrange = ws.Cells[1, col, count + 2, col];
     }
     ws.Cells[ws.Dimension.Address].AutoFitColumns();
     return new EpplusResult(ep, "MissionTripFunding.xlsx");
 }
 public static List<MissionTripTotal> List(OrgSearchModel m)
 {
     var orgids = string.Join(",", m.FetchOrgs().Select(mm => mm.OrganizationId));
     var q = from t in DbUtil.Db.ViewMissionTripTotals
             join i in DbUtil.Db.SplitInts(orgids) on t.OrganizationId equals i.ValueX
             orderby t.OrganizationId, t.SortOrder
             select t;
     return q.ToList();
 }
示例#4
0
 public ActionResult MeetingsAttendance(DateTime? dt1, DateTime? dt2, OrgSearchModel m)
 {
     var dt = ChurchAttendanceModel.MostRecentAttendedSunday();
     if (!dt1.HasValue)
         dt1 = new DateTime(dt.Year, 1, 1);
     if (!dt2.HasValue)
         dt2 = dt;
     var m2 = new AttendanceDetailModel(dt1.Value, dt2, m);
     return m2.FetchMeetings().ToDataTable().ToExcel("MeetingsExport.xlsx");
 }
示例#5
0
 public ActionResult AttendanceDetail(string Dt1, string Dt2, OrgSearchModel m)
 {
     var dt1 = Dt1.ToDate();
     if (!dt1.HasValue)
         dt1 = ChurchAttendanceModel.MostRecentAttendedSunday();
     var dt2 = Dt2.ToDate();
     if (!dt2.HasValue)
         dt2 = dt1.Value.AddDays(1);
     var m2 = new AttendanceDetailModel(dt1.Value, dt2, m);
     return View(m2);
 }
示例#6
0
 public ActionResult EnrollmentControl2a(OrgSearchModel m)
 {
     return(View(m));
 }
示例#7
0
 public ActionResult EmailAttendanceNotices(OrgSearchModel m)
 {
     m.SendNotices();
     return(Content("ok"));
 }
示例#8
0
 public OrgSearchInfo(OrgSearchModel m)
 {
     this.CopyPropertiesFrom(m);
 }
示例#9
0
 public ActionResult SGMap(OrgSearchModel m)
 {
     return Redirect("/Sgmap/Index/" + m.DivisionId);
 }
示例#10
0
 public ActionResult Count(OrgSearchModel m)
 {
     return(Content(m.FetchOrgs().Count().ToString()));
 }
示例#11
0
 public static EpplusResult List(OrgSearchModel m)
 {
     var orgids = string.Join(",", m.FetchOrgs().Select(mm => mm.OrganizationId));
     return Result(SenderGifts(orgids));
 }
示例#12
0
 public ActionResult RecentAbsents(OrgSearchModel m)
 {
     var cn = new SqlConnection(Util.ConnectionString);
     cn.Open();
     var q = cn.Query("RecentAbsentsSP2", new
     {
         name = m.Name,
         prog = m.ProgramId,
         div = m.DivisionId,
         campus = m.CampusId,
         sched = m.ScheduleId,
         status = m.StatusId,
         onlinereg = m.OnlineReg,
         orgtypeid = m.TypeId
     }, commandType: CommandType.StoredProcedure, commandTimeout: 600);
     return View(q);
 }
        public ActionResult Index(OrgSearchModel osm)
        {
            var model = new RepairTransactionsOrgs(osm);

            return(View(model));
        }
示例#14
0
 public ClassListResult(OrgSearchModel m)
 {
     model = m;
 }
示例#15
0
 public RosterListResult(OrgSearchModel m)
 {
     model = m;
 }
示例#16
0
 public ActionResult RecentAbsents(OrgSearchModel m)
 {
     var orgs = string.Join(",", m.FetchOrgs().Select(oo => oo.OrganizationId));
     var cn = new SqlConnection(Util.ConnectionString);
     cn.Open();
     var q = cn.Query("RecentAbsentsSP2", new { orgs }, commandType: CommandType.StoredProcedure, commandTimeout: 600);
     return View(q);
 }
示例#17
0
 public OrgLeadersResult(OrgSearchModel m)
 {
     model = m;
 }
示例#18
0
 public ActionResult Results(OrgSearchModel m)
 {
     UpdateModel(m.Pager);
     SaveToSession(m);
     return(View(m));
 }
示例#19
0
        public ActionResult Index(OrgSearchModel m)
        {
            var model = new OrgSearchDrop(m);

            return(View(model));
        }
示例#20
0
 public ActionResult MissionTripFunding(OrgSearchModel m)
 {
     return(View(MissionTripFundingModel.List(m)));
 }
示例#21
0
 public ActionResult ClassList(OrgSearchModel m)
 {
     return(new ClassListResult(m));
 }
示例#22
0
 public ActionResult Roster1(OrgSearchModel m)
 {
     return(new RosterResult(m));
 }
示例#23
0
 public ActionResult OrgLeaders(OrgSearchModel m)
 {
     return(new OrgLeadersResult(m));
 }
示例#24
0
 public ActionResult MissionTripSenders(OrgSearchModel m)
 {
     return MissionTripSendersModel.List(m);
 }
示例#25
0
 public ActionResult SGMap(OrgSearchModel m)
 {
     return(Redirect("/Sgmap/Index/" + m.DivisionId));
 }
示例#26
0
 public ActionResult Rollsheets(NewMeetingInfo mi, OrgSearchModel m)
 {
     return new RollsheetResult
     {
         OrgSearchModel = m,
         NewMeetingInfo = mi
     };
 }
示例#27
0
        public ActionResult IncompleteRegistrations(OrgSearchModel orgsearch, int?days)
        {
            var m = new IncompleteRegistrations(orgsearch, days);

            return(View("IncompleteRegistrations", m));
        }
示例#28
0
        public ActionResult OrgContactee(int id)
        {
            ViewBag.ContactId = id;

            var m = new OrgSearchModel();
            return View("SearchOrganization", m);
        }
示例#29
0
 public ActionResult SelectOrg(OrgSearchModel m, int cid, int oid)
 {
     // TODO Reimplement with new paradigm
     return(null);
 }
示例#30
0
        public ActionResult OrgIds(OrgSearchModel m)
        {
            var orgs = m.FetchOrgs();

            return(Content(string.Join(",", orgs.Select(oo => oo.OrganizationId))));
        }
示例#31
0
        public ActionResult ResOrgContacteeResultsults(OrgSearchModel m, int id)
        {
            ViewBag.ContactId = id;

            DbUtil.Db.SetNoLock();
            ModelState.Clear();
            return View("ResultsOrganization", m);
        }
示例#32
0
        public ActionResult DisplayAttendanceNotices(OrgSearchModel m)
        {
            var leaders = m.NoticesToSend();

            return(View(leaders));
        }
示例#33
0
 public ActionResult MissionTripFunding(OrgSearchModel m)
 {
     return MissionTripFundingModel.Result(m);
 }
示例#34
0
 public ActionResult Results(OrgSearchModel m)
 {
     Session[STR_OrgSearch] = new OrgSearchInfo(m);
     return(View(m));
 }
示例#35
0
 public ActionResult ClassList(string org, OrgSearchModel m)
 {
     return new ClassListResult(m) { orgid = org == "curr" ? DbUtil.Db.CurrentOrg.Id : null };
 }
示例#36
0
        public ActionResult EnrollmentControl2b(string na, string j)
        {
            var m = OrgSearchModel.DecodedJson(j);

            return(View(EnrollmentControlModel.List(m, na)));
        }
示例#37
0
 public ActionResult EnrollmentControl2(OrgSearchModel m)
 {
     return View(m);
 }
示例#38
0
 public ActionResult MissionTripSenders(OrgSearchModel m)
 {
     return(MissionTripSendersModel.List(m));
 }
示例#39
0
        public ActionResult MeetingsForMonth(DateTime dt1, OrgSearchModel m)
        {
            var orgs = string.Join(",", m.FetchOrgs().Select(oo => oo.OrganizationId));
            ViewBag.Month = dt1.ToString("MMMM yyyy");
            dt1 = new DateTime(dt1.Year, dt1.Month, 1);
            var dt2 = dt1.AddMonths(1).AddDays(-1);
            var hasmeetings = DbUtil.Db.MeetingsDataForDateRange(orgs, dt1, dt2).AsEnumerable().Any();
            if (!hasmeetings)
                return RedirectShowError("No meetings to show");

            var cn = new SqlConnection(Util.ConnectionString);
            cn.Open();
            var q = cn.Query("MeetingsForDateRange", new
            {
                orgs,
                startdate = dt1,
                enddate = dt2,
            }, commandType: CommandType.StoredProcedure, commandTimeout: 600);
            return View(q);
        }
示例#40
0
 public ActionResult OrgDayStats(DateTime? dt, OrgSearchModel m)
 {
     if(!dt.HasValue)
         dt = ChurchAttendanceModel.MostRecentAttendedSunday();
     var orgs = string.Join(",", m.FetchOrgs().Select(oo => oo.OrganizationId));
     var q = DbUtil.Db.OrgDayStats(orgs, dt);
     return q.ToDataTable().ToExcel("OrgDatStats.xlsx");
 }
示例#41
0
 public ActionResult SelectOrg(OrgSearchModel m, int cid, int oid)
 {
     // TODO Reimplement with new paradigm
     return null;
 }
示例#42
0
        public ActionResult DefaultMeetingDate(int id)
        {
            var dt = OrgSearchModel.DefaultMeetingDate(id);

            return(Json(new { date = dt.Date.ToShortDateString(), time = dt.ToShortTimeString() }));
        }
示例#43
0
 public ActionResult ExportExcel(OrgSearchModel m)
 {
     return(m.OrganizationExcelList());
 }
示例#44
0
        public ActionResult EnrollmentControl(bool? excel, bool? usecurrenttag, OrgSearchModel m)
        {
            if (excel != true)
                return new EnrollmentControlResult { OrgSearch = m, UseCurrentTag = usecurrenttag ?? false };

            var d = (from p in EnrollmentControlModel.List(m, usecurrenttag: usecurrenttag ?? false)
                     orderby p.Name
                     select p).ToDataTable();
            return d.ToExcel("EnrollmentControl.xlsx");
        }
示例#45
0
 public ActionResult ExportMembersExcel(OrgSearchModel m)
 {
     return(m.OrgsMemberList());
 }
示例#46
0
 public ActionResult EnrollmentControl2a(OrgSearchModel m)
 {
     var json = m.EncodedJson();
     var mm = OrgSearchModel.DecodedJson(json);
     return RedirectToAction("EnrollmentControl2a", new { json });
 }
示例#47
0
 public ActionResult RegOptions(OrgSearchModel m)
 {
     return(m.RegOptionsList());
 }
示例#48
0
 public ActionResult MissionTripFunding(OrgSearchModel m)
 {
     return View(MissionTripFundingModel.List(m));
 }
示例#49
0
 public ActionResult RegQuestionsUsage(OrgSearchModel m)
 {
     return(m.RegQuestionsUsage());
 }
示例#50
0
 public ActionResult OrgLeaders(string org, OrgSearchModel m)
 {
     return new OrgLeadersResult(m) { orgid = org == "curr" ? DbUtil.Db.CurrentOrg.Id : null };
 }
示例#51
0
 public ActionResult RegSettingUsages(OrgSearchModel m)
 {
     return(m.RegSettingUsages());
 }
示例#52
0
 public ActionResult Rollsheet(string dt, int? bygroup, string sgprefix,
     bool? altnames, string highlight, OrgSearchModel m)
 {
     DateTime? dt2 = dt.ToDate();
     if (!dt2.HasValue)
         return Message("no date");
     var mi = new NewMeetingInfo()
     {
         ByGroup = bygroup > 0,
         GroupFilterPrefix = sgprefix,
         UseAltNames = altnames == true,
         HighlightGroup = highlight,
         MeetingDate = dt2.Value
     };
     return new RollsheetResult
     {
         OrgSearchModel = m,
         NewMeetingInfo = mi
     };
 }
示例#53
0
 public ActionResult RegSettingsXml(OrgSearchModel m)
 {
     Response.ContentType = "text/xml";
     m.RegSettingsXml(Response.OutputStream);
     return(new EmptyResult());
 }
示例#54
0
 public ActionResult Roster1(OrgSearchModel m)
 {
     return new RosterResult(m);
 }
示例#55
0
 public ActionResult RegMessages(OrgSearchModel m, Settings.Messages messages)
 {
     Response.ContentType = "text/xml";
     m.RegMessagesXml(Response.OutputStream, messages);
     return(new EmptyResult());
 }
示例#56
0
 public ActionResult ShirtSizes(string org, OrgSearchModel m)
 {
     var orgid = org == "curr" ? DbUtil.Db.CurrentOrg.Id : null;
     var orgs = orgid.HasValue
         ? OrgSearchModel.FetchOrgs(orgid.Value)
         : m.FetchOrgs();
     var q = from om in DbUtil.Db.OrganizationMembers
             join o in orgs on om.OrganizationId equals o.OrganizationId
             where o.OrganizationId == orgid || (orgid ?? 0) == 0
             group 1 by om.ShirtSize
             into g
             select new ShirtSizeInfo
             {
                 Size = g.Key,
                 Count = g.Count(),
             };
     return View(q);
 }
示例#57
0
 public ActionResult Test(string id)
 {
     return Content("ok");
     var m = new OrgSearchModel()
     {
     };
     var leaders = m.NoticesToSend();
     return Content(leaders.First().Value);
 }