diff --git a/Chruch.Net/App_Start/IdentityConfig.cs b/Chruch.Net/App_Start/IdentityConfig.cs index cedffe4..22433da 100644 --- a/Chruch.Net/App_Start/IdentityConfig.cs +++ b/Chruch.Net/App_Start/IdentityConfig.cs @@ -11,8 +11,6 @@ using Microsoft.AspNet.Identity.Owin; using Microsoft.Owin; using Microsoft.Owin.Security; using Chruch.Net.Models; -using Church.Net.DAL.EF; -using Church.Net.Entity; namespace Chruch.Net { @@ -34,78 +32,4 @@ namespace Chruch.Net } } - // 設定此應用程式中使用的應用程式使用者管理員。UserManager 在 ASP.NET Identity 中定義且由應用程式中使用。 - public class ApplicationUserManager : UserManager - { - public ApplicationUserManager(IUserStore store) - : base(store) - { - } - - public static ApplicationUserManager Create(IdentityFactoryOptions options, IOwinContext context) - { - var manager = new ApplicationUserManager(new UserStore(context.Get())); - // 設定使用者名稱的驗證邏輯 - manager.UserValidator = new UserValidator(manager) - { - AllowOnlyAlphanumericUserNames = false, - RequireUniqueEmail = true - }; - - // 設定密碼的驗證邏輯 - manager.PasswordValidator = new PasswordValidator - { - RequiredLength = 6, - RequireNonLetterOrDigit = true, - RequireDigit = true, - RequireLowercase = true, - RequireUppercase = true, - }; - - // 設定使用者鎖定詳細資料 - manager.UserLockoutEnabledByDefault = true; - manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5); - manager.MaxFailedAccessAttemptsBeforeLockout = 5; - - // 註冊雙因素驗證提供者。此應用程式使用手機和電子郵件接收驗證碼以驗證使用者 - // 您可以撰寫專屬提供者,並將它外掛到這裡。 - manager.RegisterTwoFactorProvider("電話代碼", new PhoneNumberTokenProvider - { - MessageFormat = "您的安全碼為 {0}" - }); - manager.RegisterTwoFactorProvider("電子郵件代碼", new EmailTokenProvider - { - Subject = "安全碼", - BodyFormat = "您的安全碼為 {0}" - }); - manager.EmailService = new EmailService(); - manager.SmsService = new SmsService(); - var dataProtectionProvider = options.DataProtectionProvider; - if (dataProtectionProvider != null) - { - manager.UserTokenProvider = - new DataProtectorTokenProvider(dataProtectionProvider.Create("ASP.NET Identity")); - } - return manager; - } - } - - // 設定在此應用程式中使用的應用程式登入管理員。 - public class ApplicationSignInManager : SignInManager - { - public ApplicationSignInManager(ApplicationUserManager userManager, IAuthenticationManager authenticationManager) - : base(userManager, authenticationManager) - { - } - - public override Task CreateUserIdentityAsync(FamilyMember user) - { - return user.GenerateUserIdentityAsync((ApplicationUserManager)UserManager); - } - - public static ApplicationSignInManager Create(IdentityFactoryOptions options, IOwinContext context) - { - return new ApplicationSignInManager(context.GetUserManager(), context.Authentication); - } - } } diff --git a/Chruch.Net/App_Start/Startup.Auth.cs b/Chruch.Net/App_Start/Startup.Auth.cs index 7f02e14..2a45ff5 100644 --- a/Chruch.Net/App_Start/Startup.Auth.cs +++ b/Chruch.Net/App_Start/Startup.Auth.cs @@ -6,8 +6,6 @@ using Microsoft.Owin.Security.Cookies; using Microsoft.Owin.Security.Google; using Owin; using Chruch.Net.Models; -using Church.Net.DAL.EF; -using Church.Net.Entity; using Microsoft.AspNet.Identity.EntityFramework; namespace Chruch.Net @@ -18,26 +16,10 @@ namespace Chruch.Net public void ConfigureAuth(IAppBuilder app) { // 設定資料庫內容、使用者管理員和登入管理員,以針對每個要求使用單一執行個體 - app.CreatePerOwinContext(ChurchNetContext.Create); - app.CreatePerOwinContext(ApplicationUserManager.Create); - app.CreatePerOwinContext(ApplicationSignInManager.Create); // 讓應用程式使用 Cookie 儲存已登入使用者的資訊 // 並使用 Cookie 暫時儲存使用者利用協力廠商登入提供者登入的相關資訊; // 在 Cookie 中設定簽章 - app.UseCookieAuthentication(new CookieAuthenticationOptions - { - AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, - LoginPath = new PathString("/Account/Login"), - Provider = new CookieAuthenticationProvider - { - // 讓應用程式在使用者登入時驗證安全性戳記。 - // 這是您變更密碼或將外部登入新增至帳戶時所使用的安全性功能。 - OnValidateIdentity = SecurityStampValidator.OnValidateIdentity( - validateInterval: TimeSpan.FromDays(300), - regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) - } - }); app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); // 讓應用程式在雙因素驗證程序中驗證第二個因素時暫時儲存使用者資訊。 @@ -72,70 +54,8 @@ namespace Chruch.Net private void CreateRolesandUsers() { - ChurchNetContext context = new ChurchNetContext(); - - var roleManager = new RoleManager(new RoleStore(context)); - var UserManager = new UserManager(new UserStore(context)); - // In Startup iam creating first Admin Role and creating a default Admin User - if (!roleManager.RoleExists("Admin")) - { - - // first we create Admin rool - var role = new Microsoft.AspNet.Identity.EntityFramework.IdentityRole(); - role.Name = "Admin"; - roleManager.Create(role); - - //Here we create a Admin super user who will maintain the website - - var user = new FamilyMember(); - user.UserName = "chris"; - user.Email = "yuanson.chen@gmail.com"; - user.Birthday = new DateTime(1990, 01, 29); - user.DateOfWalkIn = new DateTime(2018, 05, 25); - string userPWD = "6262263816"; - - var chkUser = UserManager.Create(user, userPWD); - - //Add default User to Role Admin - if (chkUser.Succeeded) - { - var result1 = UserManager.AddToRole(user.Id, "Admin"); - - } - } - - // creating Creating Manager role - if (!roleManager.RoleExists("DirectorPastor")) - { - var role = new Microsoft.AspNet.Identity.EntityFramework.IdentityRole(); - role.Name = "DirectorPastor"; - roleManager.Create(role); - } - - if (!roleManager.RoleExists("Pastor")) - { - var role = new Microsoft.AspNet.Identity.EntityFramework.IdentityRole(); - role.Name = "Pastor"; - roleManager.Create(role); - } - - // creating Creating Employee role - if (!roleManager.RoleExists("FamilyMember")) - { - var role = new Microsoft.AspNet.Identity.EntityFramework.IdentityRole(); - role.Name = "FamilyMember"; - roleManager.Create(role); - - } - if (!roleManager.RoleExists("CellGroupLeader")) - { - var role = new Microsoft.AspNet.Identity.EntityFramework.IdentityRole(); - role.Name = "CellGroupLeader"; - roleManager.Create(role); - - } } } } \ No newline at end of file diff --git a/Chruch.Net/Areas/English/Controllers/VocabulariesController.cs b/Chruch.Net/Areas/English/Controllers/VocabulariesController.cs deleted file mode 100644 index c8742df..0000000 --- a/Chruch.Net/Areas/English/Controllers/VocabulariesController.cs +++ /dev/null @@ -1,344 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Entity; -using System.Linq; -using System.Net; -using System.Web; -using System.Web.Mvc; -using Church.Net.DAL.EF; -using Church.Net.Entity; - -namespace Chruch.Net.Areas.English.Controllers -{ - public class VocabulariesController : Controller - { - private ChurchNetContext db = new ChurchNetContext(); - - // GET: English/Vocabularies - public ActionResult Index() - { - var query = db.Vocabulary.Where(v => v.PracticeStage !=Enumeration.PracticeStage.FlashCard); - - return View(query.OrderBy(v => v.PracticeStage).ThenByDescending(v=>v.InsertDate).ToList()); - } - - // GET: English/Vocabularies/Details/5 - public ActionResult Details(int? id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - Vocabulary vocabulary = db.Vocabulary.Find(id); - if (vocabulary == null) - { - return HttpNotFound(); - } - return View(vocabulary); - } - - // GET: English/Vocabularies/Create - public ActionResult Create() - { - return View(); - } - - // POST: English/Vocabularies/Create - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult Create(Vocabulary vocabulary) - { - if (ModelState.IsValid) - { - vocabulary.Word = vocabulary.Word.ToLower(); - vocabulary.Word = vocabulary.Word.Substring(0, 1).ToUpper() + vocabulary.Word.Substring(1, vocabulary.Word.Length - 1); - - vocabulary.InsertDate = DateTime.Now; - vocabulary.PracticeDate = DateTime.Now; - vocabulary.PracticeStage = Enumeration.PracticeStage.Select; - if (vocabulary.PartOfSpeech == Enumeration.PartsOfSpeech.Verbs) - { - vocabulary.VerbPast = vocabulary.Word + "ed"; - vocabulary.VerbParticiple = vocabulary.Word + "ed"; - } - - - db.Vocabulary.Add(vocabulary); - db.SaveChanges(); - return RedirectToAction("Create"); - } - - return View(vocabulary); - } - - - - - - public ActionResult Memorized() - { - Vocabulary vocabulary; - vocabulary = db.Vocabulary.FirstOrDefault(v => v.PracticeDate <= DateTime.Today && (v.PracticeStage == Enumeration.PracticeStage.Select || v.PracticeStage == Enumeration.PracticeStage.Memorized)); - if (vocabulary != null) - { - vocabulary.PracticeTimes = 5; - return View(vocabulary); - } - else - { - return RedirectToAction("Index"); - } - } - - // POST: English/Vocabularies/Create - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - public ActionResult MemorizedNext(int id) - { - Vocabulary vocabulary; - vocabulary = db.Vocabulary.First(v => v.Id == id); - vocabulary.PracticeDate = DateTime.Now; - vocabulary.PracticeStage = Enumeration.PracticeStage.Visualize; - - db.Entry(vocabulary).State = EntityState.Modified; - db.SaveChanges(); - return RedirectToAction("Memorized"); - } - - public ActionResult Visualize() - { - Vocabulary vocabulary; - vocabulary = db.Vocabulary.FirstOrDefault(v => v.PracticeDate <= DateTime.Today && v.PracticeStage ==Enumeration.PracticeStage.Visualize); - if (vocabulary != null) - { - vocabulary.PracticeTimes = 3; - return View(vocabulary); - } - else - { - return RedirectToAction("Index"); - } - } - - // POST: English/Vocabularies/Create - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - public ActionResult VisualizeNext(int id) - { - Vocabulary vocabulary; - vocabulary = db.Vocabulary.First(v => v.Id == id); - vocabulary.PracticeDate = DateTime.Now; - vocabulary.PracticeStage = vocabulary.PracticeStage + 1; - - db.Entry(vocabulary).State = EntityState.Modified; - db.SaveChanges(); - return RedirectToAction("Visualize"); - } - - - public ActionResult Apply() - { - Vocabulary vocabulary; - vocabulary = db.Vocabulary.FirstOrDefault(v => v.PracticeDate <= DateTime.Today && v.PracticeStage==Enumeration.PracticeStage.Apply); - if (vocabulary != null) - { - vocabulary.PracticeTimes = 2; - return View(vocabulary); - } - else - { - return RedirectToAction("Index"); - } - } - - // POST: English/Vocabularies/Create - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - public ActionResult ApplyNext(Vocabulary model) - { - Vocabulary vocabulary; - vocabulary = db.Vocabulary.First(v => v.Id == model.Id); - vocabulary.PracticeDate = DateTime.Now; - vocabulary.PracticeStage = vocabulary.PracticeStage + 1; - vocabulary.PracticeSentence = model.PracticeSentence; - db.Entry(vocabulary).State = EntityState.Modified; - db.SaveChanges(); - return RedirectToAction("Apply"); - } - - - public ActionResult Review() - { - Vocabulary vocabulary; - vocabulary = db.Vocabulary.FirstOrDefault(v => v.PracticeDate <= DateTime.Today && v.PracticeStage == Enumeration.PracticeStage.Review); - if (vocabulary != null) - { - vocabulary.PracticeTimes = 1; - return View(vocabulary); - } - else - { - return RedirectToAction("Index"); - } - } - - // POST: English/Vocabularies/Create - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - public ActionResult ReviewNext(int id) - { - Vocabulary vocabulary; - vocabulary = db.Vocabulary.First(v => v.Id == id); - vocabulary.PracticeDate = DateTime.Now; - vocabulary.PracticeStage = vocabulary.PracticeStage + 1; - - db.Entry(vocabulary).State = EntityState.Modified; - db.SaveChanges(); - return RedirectToAction("Review"); - } - public ActionResult ReviewRepracticeNext(int id) - { - Vocabulary vocabulary; - vocabulary = db.Vocabulary.First(v => v.Id == id); - vocabulary.PracticeDate = DateTime.Now; - vocabulary.PracticeStage = Enumeration.PracticeStage.Select; - - db.Entry(vocabulary).State = EntityState.Modified; - db.SaveChanges(); - return RedirectToAction("Review"); - } - // GET: English/Vocabularies/Edit/5 - public ActionResult Edit(int? id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - Vocabulary vocabulary = db.Vocabulary.Find(id); - if (vocabulary == null) - { - return HttpNotFound(); - } - return View(vocabulary); - } - - // POST: English/Vocabularies/Edit/5 - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult Edit(Vocabulary vocabulary) - { - if (ModelState.IsValid) - { - vocabulary.Word = vocabulary.Word.ToLower(); - vocabulary.Word = vocabulary.Word.Substring(0, 1).ToUpper() + vocabulary.Word.Substring(1, vocabulary.Word.Length - 1); - db.Entry(vocabulary).State = EntityState.Modified; - db.SaveChanges(); - return RedirectToAction("Index"); - } - return View(vocabulary); - } - - // GET: English/Vocabularies/Delete/5 - public ActionResult Delete(int? id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - Vocabulary vocabulary = db.Vocabulary.Find(id); - if (vocabulary == null) - { - return HttpNotFound(); - } - return View(vocabulary); - } - - // POST: English/Vocabularies/Delete/5 - [HttpPost, ActionName("Delete")] - [ValidateAntiForgeryToken] - public ActionResult DeleteConfirmed(int id) - { - Vocabulary vocabulary = db.Vocabulary.Find(id); - db.Vocabulary.Remove(vocabulary); - db.SaveChanges(); - return RedirectToAction("Index"); - } - - - - - public ActionResult FlashCard() - { - Vocabulary vocabulary; - vocabulary = db.Vocabulary.OrderBy(v=>v.FlashCardTimes).FirstOrDefault(v => v.PracticeStage == Enumeration.PracticeStage.FlashCard); - if (vocabulary != null) - { - return View(vocabulary); - } - else - { - return RedirectToAction("Index"); - } - } - - public ActionResult FlashCardNext(int id) - { - Vocabulary vocabulary; - vocabulary = db.Vocabulary.First(v => v.Id == id); - vocabulary.PracticeDate = DateTime.Now; - vocabulary.FlashCardTimes +=1; - db.Entry(vocabulary).State = EntityState.Modified; - db.SaveChanges(); - return RedirectToAction("FlashCard"); - } - - public ActionResult FlashCardForgot(int id) - { - Vocabulary vocabulary; - vocabulary = db.Vocabulary.First(v => v.Id == id); - vocabulary.PracticeDate = DateTime.Now; - vocabulary.FlashCardTimes =0; - vocabulary.PracticeStage = Enumeration.PracticeStage.Select; - db.Entry(vocabulary).State = EntityState.Modified; - db.SaveChanges(); - return RedirectToAction("FlashCard"); - } - - public ActionResult UpdateDB() - { - - - - db.Vocabulary.Where(v => v.PracticeMemorized == false).ToList().ForEach(v => v.PracticeStage = Enumeration.PracticeStage.Memorized); - db.Vocabulary.Where(v => v.PracticeMemorized == true && v.PracticeVisualize == false).ToList().ForEach(v => v.PracticeStage = Enumeration.PracticeStage.Visualize); - db.Vocabulary.Where(v => v.PracticeMemorized == true && v.PracticeVisualize == true && v.PracticeApply == false).ToList().ForEach(v => v.PracticeStage = Enumeration.PracticeStage.Apply); - - db.SaveChanges(); - - return RedirectToAction("Index"); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - db.Dispose(); - } - base.Dispose(disposing); - } - - protected override void OnActionExecuted(System.Web.Mvc.ActionExecutedContext filterContext) - { - ViewBag.P_Select = db.Vocabulary.Count(v => v.PracticeStage == Enumeration.PracticeStage.Select ); - ViewBag.P_Memorized = db.Vocabulary.Count(v => v.PracticeStage == Enumeration.PracticeStage.Memorized && v.PracticeDate < DateTime.Today); - ViewBag.P_Visualize = db.Vocabulary.Count(v => v.PracticeStage == Enumeration.PracticeStage.Visualize && v.PracticeDate < DateTime.Today); - ViewBag.P_Apply = db.Vocabulary.Count(v => v.PracticeStage == Enumeration.PracticeStage.Apply && v.PracticeDate < DateTime.Today); - ViewBag.P_Review = db.Vocabulary.Count(v => v.PracticeStage == Enumeration.PracticeStage.Review && v.PracticeDate < DateTime.Today); - } - } -} diff --git a/Chruch.Net/Areas/English/EnglishAreaRegistration.cs b/Chruch.Net/Areas/English/EnglishAreaRegistration.cs deleted file mode 100644 index d1e469b..0000000 --- a/Chruch.Net/Areas/English/EnglishAreaRegistration.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Web.Mvc; - -namespace Chruch.Net.Areas.English -{ - public class EnglishAreaRegistration : AreaRegistration - { - public override string AreaName - { - get - { - return "English"; - } - } - - public override void RegisterArea(AreaRegistrationContext context) - { - context.MapRoute( - "English_default", - "English/{controller}/{action}/{id}", - new { controller= "Vocabularies", action = "Index", id = UrlParameter.Optional } - ); - } - } -} \ No newline at end of file diff --git a/Chruch.Net/Areas/English/Views/Shared/_Layout.cshtml b/Chruch.Net/Areas/English/Views/Shared/_Layout.cshtml deleted file mode 100644 index e90e062..0000000 --- a/Chruch.Net/Areas/English/Views/Shared/_Layout.cshtml +++ /dev/null @@ -1,705 +0,0 @@ - - - - - @ViewBag.Title - English Vocalbulary - @Scripts.Render("~/bundles/modernizr") - - - - - - - - - - @Styles.Render("~/Content/bootstrap") - @Styles.Render("~/Content/DashboardCss") - - - - - - @Scripts.Render("~/bundles/jquery") - -
-
- - -
-
- -

Activity

-
- -
- - Transactions -
- - -
- -
- -
-
-
-
- - -
- -
-
-
-
- - -
- -
-
-
-
- -
- - -
-
My accounts
-
-
- -
-
Credit Card
-
$12.240
-
-
-
- -
-
Debit Card
-
$228.110
-
-
-
- -
-
Savings Account
-
$128.248.000
-
-
- - -
-
Transactions
- -
-
-
- -
-
- $240.00 -

Addiction When Gambling Becomes

-
- - 5 Min ago - -
-
- - -
-
-
- -
-
- $126.00 -

Make Myspace Your

-
- - 25 Nov 2017 - -
-
- - -
-
-
- -
-
- $560.00 -

Writing A Good Headline

-
- - 22 Nov 2017 - -
-
- - -
-
-
- -
-
- $6.00 -

Buying Used Electronic Equipment

-
- - 13 Oct 2017 - -
-
- - -
-
-
- -
-
- $320.00 -

Gambling Becomes A Problem

-
- - 27 Jul 2017 - -
-
- - -
-
-
- -
-
- $28.00 -

Baby Monitor Technology

-
- - 05 Mar 2017 - -
-
- - -
-
-
- -
-
- $490.00 -

Adwords Keyword Research For Beginners

-
- - 09 Feb 2017 - -
-
- - -
-
-
- -
-
- $14.20 -

A Good Autoresponder

-
- - 09 Feb 2017 - -
-
- -
- -
- -
-
- - -
-
- - - - -
-
- -
- @*
-
-
-
-

@ViewBag.title

-
- - @*
-
    -
  • - Home - / -
  • -
  • - Pages - / -
  • -
  • - About Us -
  • -
-
-
-
-
*@ -
- - @RenderBody() -
- - - -
-
-
- - - - - - @Scripts.Render("~/bundles/jqueryval") - - @Scripts.Render("~/bundles/common") - @Scripts.Render("~/bundles/bootstrap") - @Scripts.Render("~/bundles/Dashboard") - - - - - @RenderSection("scripts", required: false) - - \ No newline at end of file diff --git a/Chruch.Net/Areas/English/Views/Shared/_SpellPractice.cshtml b/Chruch.Net/Areas/English/Views/Shared/_SpellPractice.cshtml deleted file mode 100644 index 18b6115..0000000 --- a/Chruch.Net/Areas/English/Views/Shared/_SpellPractice.cshtml +++ /dev/null @@ -1,110 +0,0 @@ -@model Church.Net.Entity.Vocabulary - - - -
- - @Model.PartOfSpeech.ToString() - - -

- @Model.MaskedWord - - @if (Model.PartOfSpeech == Church.Net.Entity.Enumeration.PartsOfSpeech.VerbsUnRegular) - { - @Html.Raw("
" + Model.MaskedVerbPast + " ; " + Model.MaskedVerbParticiple) - } -

-

-

- @Model.DefinitionEn - -

-
-
-
-
- - -
-
-

- -

-
- - - - \ No newline at end of file diff --git a/Chruch.Net/Areas/English/Views/Vocabularies/Apply.cshtml b/Chruch.Net/Areas/English/Views/Vocabularies/Apply.cshtml deleted file mode 100644 index 82a2c24..0000000 --- a/Chruch.Net/Areas/English/Views/Vocabularies/Apply.cshtml +++ /dev/null @@ -1,93 +0,0 @@ -@model Church.Net.Entity.Vocabulary - -@{ - ViewBag.title = "Apply"; -} - - -
-
-
- - - @Html.Partial("~/Areas/English/Views/Shared/_SpellPractice.cshtml", Model) - - -
- @using (Html.BeginForm("ApplyNext")) - { - - - - } - - -
- @Html.ActionLink("Back to List", "Index") -
- -
- -
- - - -@section scripts{ - -} - diff --git a/Chruch.Net/Areas/English/Views/Vocabularies/Create.cshtml b/Chruch.Net/Areas/English/Views/Vocabularies/Create.cshtml deleted file mode 100644 index 7816d31..0000000 --- a/Chruch.Net/Areas/English/Views/Vocabularies/Create.cshtml +++ /dev/null @@ -1,187 +0,0 @@ -@model Church.Net.Entity.Vocabulary - -@{ - ViewBag.title="Select Word"; -} - -@using (Html.BeginForm()) -{ - @Html.AntiForgeryToken() -
-
- @Html.ValidationSummary(true, "", new { @class = "text-danger" }) -
- -
- @Html.LabelFor(model => model.PartOfSpeech, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - - @Html.EnumDropDownListFor(model => model.PartOfSpeech, htmlAttributes: new { @class = "w-100 u-select-v2 u-shadow-v19 g-brd-none g-color-black g-color-primary--hover g-bg-white text-left g-rounded-30 g-pl-30 g-py-12", @onchange = "PartOfSpeechChanged(value)" }) - @Html.ValidationMessageFor(model => model.PartOfSpeech, "", new { @class = "form-control-feedback d-block g-bg-red g-color-white g-font-size-12 g-px-14 mt-0" }) -
-
-
- - -
- @Html.LabelFor(model => model.Word, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - - @Html.EditorFor(model => model.Word, new { htmlAttributes = new { @class = "form-control u-shadow-v19 g-brd-none g-bg-white g-font-size-16 g-rounded-30 g-px-30 g-py-13 g-mb-30" } }) - @Html.ValidationMessageFor(model => model.Word, "", new { @class = "form-control-feedback d-block g-bg-red g-color-white g-font-size-12 g-px-14 mt-0" }) -
- -
- - -
-
- @Html.LabelFor(model => model.NounPlural, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - - @Html.EditorFor(model => model.NounPlural, new { htmlAttributes = new { @class = "form-control u-shadow-v19 g-brd-none g-bg-white g-font-size-16 g-rounded-30 g-px-30 g-py-13 g-mb-30" } }) - @Html.ValidationMessageFor(model => model.NounPlural, "", new { @class = "form-control-feedback d-block g-bg-red g-color-white g-font-size-12 g-px-14 mt-0" }) -
- -
- - - -
- -
-
- - -
- @Html.LabelFor(model => model.DefinitionEn, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - - @Html.EditorFor(model => model.DefinitionEn, new { htmlAttributes = new { @class = "form-control u-shadow-v19 g-brd-none g-bg-white g-font-size-16 g-rounded-30 g-px-30 g-py-13 g-mb-30", @multiLine = "true" } }) - @Html.ValidationMessageFor(model => model.DefinitionEn, "", new { @class = "form-control-feedback d-block g-bg-red g-color-white g-font-size-12 g-px-14 mt-0" }) -
- - -
- @Html.LabelFor(model => model.DefinitionCh, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - - @Html.EditorFor(model => model.DefinitionCh, new { htmlAttributes = new { @class = "form-control u-shadow-v19 g-brd-none g-bg-white g-font-size-16 g-rounded-30 g-px-30 g-py-13 g-mb-30" } }) - @Html.ValidationMessageFor(model => model.DefinitionCh, "", new { @class = "form-control-feedback d-block g-bg-red g-color-white g-font-size-12 g-px-14 mt-0" }) -
- -
-
- - -
- @Html.LabelFor(model => model.ImagesUrl, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - - @Html.EditorFor(model => model.ImagesUrl, new { htmlAttributes = new { @class = "form-control u-shadow-v19 g-brd-none g-bg-white g-font-size-16 g-rounded-30 g-px-30 g-py-13 g-mb-30" } }) - @Html.ValidationMessageFor(model => model.ImagesUrl, "", new { @class = "form-control-feedback d-block g-bg-red g-color-white g-font-size-12 g-px-14 mt-0" }) -
- -
- -
- -
- - - - - - -
-
- -
-
-
- - -
- @Html.ActionLink("Back to List", "Index") -
- -
-} -@section scripts{ - -} \ No newline at end of file diff --git a/Chruch.Net/Areas/English/Views/Vocabularies/Delete.cshtml b/Chruch.Net/Areas/English/Views/Vocabularies/Delete.cshtml deleted file mode 100644 index 5f1d325..0000000 --- a/Chruch.Net/Areas/English/Views/Vocabularies/Delete.cshtml +++ /dev/null @@ -1,149 +0,0 @@ -@model Church.Net.Entity.Vocabulary - -@{ - Layout = null; -} - - - - - - - Delete - - -
-

- Are you sure you want to DELETE this? -

-
- -
-
-
-
- @Html.LabelFor(model => model.Word, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- - -
- @Html.LabelFor(model => model.NounPlural, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- - -
- @Html.LabelFor(model => model.VerbPast, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- - -
- @Html.LabelFor(model => model.VerbParticiple, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- - -
- @Html.LabelFor(model => model.PartOfSpeech, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- - -
- @Html.LabelFor(model => model.ImagesUrl, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- - -
- @Html.LabelFor(model => model.PracticeDate, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- - -
- @Html.LabelFor(model => model.PracticeSelect, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- - -
- @Html.LabelFor(model => model.PracticeMemorized, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- - -
- @Html.LabelFor(model => model.PracticeVisualize, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- - -
- @Html.LabelFor(model => model.PracticeApply, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- - -
- @Html.LabelFor(model => model.PracticeReview, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- - -
- @Html.LabelFor(model => model.PracticeSentence, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- - -
- - -
- -
- @using (Html.BeginForm()) - { -
- - @Html.AntiForgeryToken() - Back to List - - -
- } -
-
-
-
- - diff --git a/Chruch.Net/Areas/English/Views/Vocabularies/Details.cshtml b/Chruch.Net/Areas/English/Views/Vocabularies/Details.cshtml deleted file mode 100644 index f522807..0000000 --- a/Chruch.Net/Areas/English/Views/Vocabularies/Details.cshtml +++ /dev/null @@ -1,138 +0,0 @@ -@model Church.Net.Entity.Vocabulary - -@{ - Layout = null; -} - - - - - - - Details - - -
-

- Detail of Details -

-
- -
-
-
-
- @Html.LabelFor(model => model.Word, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- -
- @Html.LabelFor(model => model.NounPlural, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- -
- @Html.LabelFor(model => model.VerbPast, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- -
- @Html.LabelFor(model => model.VerbParticiple, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- -
- @Html.LabelFor(model => model.PartOfSpeech, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- -
- @Html.LabelFor(model => model.ImagesUrl, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- -
- @Html.LabelFor(model => model.PracticeDate, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- -
- @Html.LabelFor(model => model.PracticeSelect, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- -
- @Html.LabelFor(model => model.PracticeMemorized, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- -
- @Html.LabelFor(model => model.PracticeVisualize, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- -
- @Html.LabelFor(model => model.PracticeApply, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- -
- @Html.LabelFor(model => model.PracticeReview, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- -
- @Html.LabelFor(model => model.PracticeSentence, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - -
- -
- - - - -
- -
- @using (Html.BeginForm()) - { -
- - @Html.AntiForgeryToken() - Back to List - Edit - -
- } -
-
-
-
- - diff --git a/Chruch.Net/Areas/English/Views/Vocabularies/Edit.cshtml b/Chruch.Net/Areas/English/Views/Vocabularies/Edit.cshtml deleted file mode 100644 index b752444..0000000 --- a/Chruch.Net/Areas/English/Views/Vocabularies/Edit.cshtml +++ /dev/null @@ -1,180 +0,0 @@ -@model Church.Net.Entity.Vocabulary - -@{ - ViewBag.title = "Edit Word"; -} - -@using (Html.BeginForm()) -{ - @Html.AntiForgeryToken() -
-
- @Html.ValidationSummary(true, "", new { @class = "text-danger" }) - @Html.HiddenFor(model => model.Id) - @Html.HiddenFor(model => model.PracticeDate) - @Html.HiddenFor(model => model.PracticeStage) - @Html.HiddenFor(model => model.FlashCardTimes) - @Html.HiddenFor(model => model.InsertDate) -
- -
- @Html.LabelFor(model => model.PartOfSpeech, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - - @Html.EnumDropDownListFor(model => model.PartOfSpeech, htmlAttributes: new { @class = "w-100 u-select-v2 u-shadow-v19 g-brd-none g-color-black g-color-primary--hover g-bg-white text-left g-rounded-30 g-pl-30 g-py-12", @onchange = "PartOfSpeechChanged(value)" }) - @Html.ValidationMessageFor(model => model.PartOfSpeech, "", new { @class = "form-control-feedback d-block g-bg-red g-color-white g-font-size-12 g-px-14 mt-0" }) -
-
-
- - -
- @Html.LabelFor(model => model.Word, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - - @Html.EditorFor(model => model.Word, new { htmlAttributes = new { @class = "form-control u-shadow-v19 g-brd-none g-bg-white g-font-size-16 g-rounded-30 g-px-30 g-py-13 g-mb-30" } }) - @Html.ValidationMessageFor(model => model.Word, "", new { @class = "form-control-feedback d-block g-bg-red g-color-white g-font-size-12 g-px-14 mt-0" }) -
- -
- -
-
- @Html.LabelFor(model => model.NounPlural, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - - @Html.EditorFor(model => model.NounPlural, new { htmlAttributes = new { @class = "form-control u-shadow-v19 g-brd-none g-bg-white g-font-size-16 g-rounded-30 g-px-30 g-py-13 g-mb-30" } }) - @Html.ValidationMessageFor(model => model.NounPlural, "", new { @class = "form-control-feedback d-block g-bg-red g-color-white g-font-size-12 g-px-14 mt-0" }) -
- -
- - - -
- -
-
- - -
- @Html.LabelFor(model => model.DefinitionEn, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - - @Html.EditorFor(model => model.DefinitionEn, new { htmlAttributes = new { @class = "form-control u-shadow-v19 g-brd-none g-bg-white g-font-size-16 g-rounded-30 g-px-30 g-py-13 g-mb-30", @multiLine = "true" } }) - @Html.ValidationMessageFor(model => model.DefinitionEn, "", new { @class = "form-control-feedback d-block g-bg-red g-color-white g-font-size-12 g-px-14 mt-0" }) -
- - -
- @Html.LabelFor(model => model.DefinitionCh, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - - @Html.EditorFor(model => model.DefinitionCh, new { htmlAttributes = new { @class = "form-control u-shadow-v19 g-brd-none g-bg-white g-font-size-16 g-rounded-30 g-px-30 g-py-13 g-mb-30" } }) - @Html.ValidationMessageFor(model => model.DefinitionCh, "", new { @class = "form-control-feedback d-block g-bg-red g-color-white g-font-size-12 g-px-14 mt-0" }) -
- -
-
- - -
- @Html.LabelFor(model => model.ImagesUrl, htmlAttributes: new { @class = "g-font-weight-500 g-font-size-15 g-pl-30" }) - - @Html.EditorFor(model => model.ImagesUrl, new { htmlAttributes = new { @class = "form-control u-shadow-v19 g-brd-none g-bg-white g-font-size-16 g-rounded-30 g-px-30 g-py-13 g-mb-30" } }) - @Html.ValidationMessageFor(model => model.ImagesUrl, "", new { @class = "form-control-feedback d-block g-bg-red g-color-white g-font-size-12 g-px-14 mt-0" }) -
- -
- - -
- -
- - - - - - -
-
- -
-
-
- - -
- @Html.ActionLink("Back to List", "Index") -
- -
-} -@section scripts{ - -} \ No newline at end of file diff --git a/Chruch.Net/Areas/English/Views/Vocabularies/FlashCard.cshtml b/Chruch.Net/Areas/English/Views/Vocabularies/FlashCard.cshtml deleted file mode 100644 index 2fbde71..0000000 --- a/Chruch.Net/Areas/English/Views/Vocabularies/FlashCard.cshtml +++ /dev/null @@ -1,64 +0,0 @@ -@model Church.Net.Entity.Vocabulary -@{ - ViewBag.Title = "FlashCard"; -} -@using (Html.BeginForm("FlashCardNext")) -{ - -} -
- - @Model.PartOfSpeech.ToString() - - -

- @Model.Word - - @if (Model.PartOfSpeech == Church.Net.Entity.Enumeration.PartsOfSpeech.VerbsUnRegular) - { - @Html.Raw("
" + Model.MaskedVerbPast + " ; " + Model.MaskedVerbParticiple) - } -

-

-

- @Model.DefinitionEn - -

-
-
-
-
- - -
-
-

- -

-
- - - -
-
- - @**@ - -
-
- - \ No newline at end of file diff --git a/Chruch.Net/Areas/English/Views/Vocabularies/Index.cshtml b/Chruch.Net/Areas/English/Views/Vocabularies/Index.cshtml deleted file mode 100644 index 5a403d6..0000000 --- a/Chruch.Net/Areas/English/Views/Vocabularies/Index.cshtml +++ /dev/null @@ -1,168 +0,0 @@ -@model IEnumerable - - -
-
-
-

@ViewBag.Title

-
- -
- -
- - -
-
- Type: - -
- - -
-
- -
- Position: - -
- - -
-
- -
- -
-
- - -
-
-
- - - - - - - - - - - - - - - - - - - - - @foreach (var item in Model) - { - - - - - - *@ - - - - - - - - - - - - } - - -
-
- @Html.DisplayNameFor(model => model.PracticeDate) - -
-
-
- @Html.DisplayNameFor(model => model.Word) - - -
-
-
- @Html.DisplayNameFor(model => model.ImagesUrl) - -
-
-
- Definition -
-
- @Html.DisplayFor(modelItem => item.PracticeDate) -
- @item.PracticeStage.ToString() - - @*
- @Html.DisplayFor(modelItem => item.PracticeSelect) - - @Html.DisplayFor(modelItem => item.PracticeMemorized) - - @Html.DisplayFor(modelItem => item.PracticeVisualize) - - @Html.DisplayFor(modelItem => item.PracticeApply) - - @Html.DisplayFor(modelItem => item.PracticeReview) - - @Html.DisplayFor(modelItem => item.PartOfSpeech) -

@Html.DisplayFor(modelItem => item.Word)

- @if (item.PartOfSpeech == Church.Net.Entity.Enumeration.PartsOfSpeech.Nouns) - { - @Html.DisplayFor(modelItem => item.NounPlural) - -} -else if (item.PartOfSpeech == Church.Net.Entity.Enumeration.PartsOfSpeech.VerbsUnRegular) -{ - - @Html.Raw(item.VerbPast);@Html.Raw(item.VerbParticiple) -} - - -
- - - @Html.Raw(item.DefinitionEn) -
- @Html.Raw(item.DefinitionCh) -
-
- - - - - - - -
-
-
diff --git a/Chruch.Net/Areas/English/Views/Vocabularies/Memorized.cshtml b/Chruch.Net/Areas/English/Views/Vocabularies/Memorized.cshtml deleted file mode 100644 index ea878f4..0000000 --- a/Chruch.Net/Areas/English/Views/Vocabularies/Memorized.cshtml +++ /dev/null @@ -1,44 +0,0 @@ -@model Church.Net.Entity.Vocabulary - -@{ - ViewBag.title = "Memorized"; -} - - -
-
-
- - - @Html.Partial("~/Areas/English/Views/Shared/_SpellPractice.cshtml", Model) - - -
- - - -
- - -
- @Html.ActionLink("Back to List", "Index") -
- -
- - - - -@section scripts{ - -} \ No newline at end of file diff --git a/Chruch.Net/Areas/English/Views/Vocabularies/Review.cshtml b/Chruch.Net/Areas/English/Views/Vocabularies/Review.cshtml deleted file mode 100644 index ec4e4b5..0000000 --- a/Chruch.Net/Areas/English/Views/Vocabularies/Review.cshtml +++ /dev/null @@ -1,47 +0,0 @@ -@model Church.Net.Entity.Vocabulary - -@{ - ViewBag.title = "Review"; -} - - -
-
-
- - - @Html.Partial("~/Areas/English/Views/Shared/_SpellPractice.cshtml", Model) - - -
- - - -
- - -
- @Html.ActionLink("Back to List", "Index") -
- -
- - - - -@section scripts{ - -} \ No newline at end of file diff --git a/Chruch.Net/Areas/English/Views/Vocabularies/Visualize.cshtml b/Chruch.Net/Areas/English/Views/Vocabularies/Visualize.cshtml deleted file mode 100644 index fff2c29..0000000 --- a/Chruch.Net/Areas/English/Views/Vocabularies/Visualize.cshtml +++ /dev/null @@ -1,44 +0,0 @@ -@model Church.Net.Entity.Vocabulary - -@{ - ViewBag.title = "Visualize"; -} - - -
-
-
- - - @Html.Partial("~/Areas/English/Views/Shared/_SpellPractice.cshtml", Model) - - -
- - - -
- - -
- @Html.ActionLink("Back to List", "Index") -
- -
- - - - -@section scripts{ - -} \ No newline at end of file diff --git a/Chruch.Net/Areas/English/Views/_ViewStart.cshtml b/Chruch.Net/Areas/English/Views/_ViewStart.cshtml deleted file mode 100644 index 2e2d18b..0000000 --- a/Chruch.Net/Areas/English/Views/_ViewStart.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@{ - Layout = "~/Areas/English/Views/Shared/_Layout.cshtml"; -} \ No newline at end of file diff --git a/Chruch.Net/Areas/English/Views/web.config b/Chruch.Net/Areas/English/Views/web.config deleted file mode 100644 index 2acfe16..0000000 --- a/Chruch.Net/Areas/English/Views/web.config +++ /dev/null @@ -1,36 +0,0 @@ - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Chruch.Net/Areas/dashboard/Controllers/FamilyMembersController.cs b/Chruch.Net/Areas/dashboard/Controllers/FamilyMembersController.cs deleted file mode 100644 index e178f40..0000000 --- a/Chruch.Net/Areas/dashboard/Controllers/FamilyMembersController.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Entity; -using System.Linq; -using System.Net; -using System.Web; -using System.Web.Mvc; -using Church.Net.DAL.EF; -using Church.Net.Entity; - -namespace Chruch.Net.Areas.dashboard.Controllers -{ - public class FamilyMembersController : Controller - { - private ChurchNetContext db = new ChurchNetContext(); - - // GET: dashboard/FamilyMembers - public ActionResult Index() - { - var familyMembers = db.Users.Include(f => f.Career); - return View(familyMembers.ToList()); - } - - // GET: dashboard/FamilyMembers/Details/5 - public ActionResult Details(string id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - FamilyMember familyMember = db.Users.Find(id); - if (familyMember == null) - { - return HttpNotFound(); - } - return View(familyMember); - } - - // GET: dashboard/FamilyMembers/Create - public ActionResult Create() - { - ViewBag.CareerId = new SelectList(db.Careers, "CareerId", "Name"); - return View(); - } - - // POST: dashboard/FamilyMembers/Create - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult Create([Bind(Include = "Id,FirstName,LastName,Gender,Birthday,Married,Baptized,DateOfBaptized,DateOfWalkIn,Address,ComunityAppId,CareerId,ProfileImage,Email,EmailConfirmed,PasswordHash,SecurityStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEndDateUtc,LockoutEnabled,AccessFailedCount,UserName")] FamilyMember familyMember) - { - if (ModelState.IsValid) - { - db.Users.Add(familyMember); - db.SaveChanges(); - return RedirectToAction("Index"); - } - - ViewBag.CareerId = new SelectList(db.Careers, "CareerId", "Name", familyMember.CareerId); - return View(familyMember); - } - - // GET: dashboard/FamilyMembers/Edit/5 - public ActionResult Edit(string id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - FamilyMember familyMember = db.Users.Find(id); - if (familyMember == null) - { - return HttpNotFound(); - } - ViewBag.CareerId = new SelectList(db.Careers, "CareerId", "Name", familyMember.CareerId); - return View(familyMember); - } - - // POST: dashboard/FamilyMembers/Edit/5 - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,Gender,Birthday,Married,Baptized,DateOfBaptized,DateOfWalkIn,Address,ComunityAppId,CareerId,ProfileImage,Email,EmailConfirmed,PasswordHash,SecurityStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEndDateUtc,LockoutEnabled,AccessFailedCount,UserName")] FamilyMember familyMember) - { - if (ModelState.IsValid) - { - db.Entry(familyMember).State = EntityState.Modified; - db.SaveChanges(); - return RedirectToAction("Index"); - } - ViewBag.CareerId = new SelectList(db.Careers, "CareerId", "Name", familyMember.CareerId); - return View(familyMember); - } - - // GET: dashboard/FamilyMembers/Delete/5 - public ActionResult Delete(string id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - FamilyMember familyMember = db.Users.Find(id); - if (familyMember == null) - { - return HttpNotFound(); - } - return View(familyMember); - } - - // POST: dashboard/FamilyMembers/Delete/5 - [HttpPost, ActionName("Delete")] - [ValidateAntiForgeryToken] - public ActionResult DeleteConfirmed(string id) - { - FamilyMember familyMember = db.Users.Find(id); - db.Users.Remove(familyMember); - db.SaveChanges(); - return RedirectToAction("Index"); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - db.Dispose(); - } - base.Dispose(disposing); - } - } -} diff --git a/Chruch.Net/Areas/dashboard/Controllers/HappinessBESTsController.cs b/Chruch.Net/Areas/dashboard/Controllers/HappinessBESTsController.cs deleted file mode 100644 index 5391446..0000000 --- a/Chruch.Net/Areas/dashboard/Controllers/HappinessBESTsController.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Entity; -using System.Linq; -using System.Net; -using System.Web; -using System.Web.Mvc; -using Church.Net.DAL.EF; -using Church.Net.Entity; - -namespace Chruch.Net.Areas.dashboard.Controllers -{ - public class HappinessBESTsController : Controller - { - private ChurchNetContext db = new ChurchNetContext(); - - // GET: dashboard/HappinessBESTs - public ActionResult Index(string groupId) - { - var happinessBESTs = db.HappinessBESTs.Include(h => h.HappinessGroup).Where(h=>h.GroupId==groupId); - return View(happinessBESTs.ToList()); - } - - // GET: dashboard/HappinessBESTs/Details/5 - public ActionResult Details(string id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - HappinessBEST happinessBEST = db.HappinessBESTs.Find(id); - if (happinessBEST == null) - { - return HttpNotFound(); - } - return View(happinessBEST); - } - - // GET: dashboard/HappinessBESTs/Create - public ActionResult Create(string id) - { - ViewBag.GroupId = new SelectList(db.HappinessGroups, "GroupId", "Name", id); - HappinessBEST happinessBEST = new HappinessBEST(); - happinessBEST.BestId = Church.Net.Utility.Format.Get33BaseGuid(); - happinessBEST.GroupId = id; - return View(happinessBEST); - } - - // POST: dashboard/HappinessBESTs/Create - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult Create([Bind(Include = "BestId,GroupId,Name,Email,Phone")] HappinessBEST happinessBEST) - { - if (ModelState.IsValid) - { - db.HappinessBESTs.Add(happinessBEST); - db.SaveChanges(); - return RedirectToAction("Details", "HappinessGroups", new { id= happinessBEST.GroupId}); - } - - ViewBag.GroupId = new SelectList(db.HappinessGroups, "GroupId", "Name", happinessBEST.GroupId); - return View(happinessBEST); - } - - // GET: dashboard/HappinessBESTs/Edit/5 - public ActionResult Edit(string id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - HappinessBEST happinessBEST = db.HappinessBESTs.Find(id); - if (happinessBEST == null) - { - return HttpNotFound(); - } - ViewBag.GroupId = new SelectList(db.HappinessGroups, "GroupId", "Name", happinessBEST.GroupId); - return View(happinessBEST); - } - - // POST: dashboard/HappinessBESTs/Edit/5 - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult Edit([Bind(Include = "BestId,GroupId,Name,Email,Phone")] HappinessBEST happinessBEST) - { - if (ModelState.IsValid) - { - db.Entry(happinessBEST).State = EntityState.Modified; - db.SaveChanges(); - return RedirectToAction("Index"); - } - ViewBag.GroupId = new SelectList(db.HappinessGroups, "GroupId", "Name", happinessBEST.GroupId); - return View(happinessBEST); - } - - // GET: dashboard/HappinessBESTs/Delete/5 - public ActionResult Delete(string id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - HappinessBEST happinessBEST = db.HappinessBESTs.Find(id); - if (happinessBEST == null) - { - return HttpNotFound(); - } - return View(happinessBEST); - } - - // POST: dashboard/HappinessBESTs/Delete/5 - [HttpPost, ActionName("Delete")] - [ValidateAntiForgeryToken] - public ActionResult DeleteConfirmed(string id) - { - HappinessBEST happinessBEST = db.HappinessBESTs.Find(id); - db.HappinessBESTs.Remove(happinessBEST); - db.SaveChanges(); - return RedirectToAction("Index"); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - db.Dispose(); - } - base.Dispose(disposing); - } - } -} diff --git a/Chruch.Net/Areas/dashboard/Controllers/HappinessGroupsController.cs b/Chruch.Net/Areas/dashboard/Controllers/HappinessGroupsController.cs deleted file mode 100644 index c192efb..0000000 --- a/Chruch.Net/Areas/dashboard/Controllers/HappinessGroupsController.cs +++ /dev/null @@ -1,159 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Entity; -using System.Linq; -using System.Net; -using System.Web; -using System.Web.Mvc; -using Church.Net.DAL.EF; -using Church.Net.Entity; - -namespace Chruch.Net.Areas.dashboard.Controllers -{ - public class HappinessGroupsController : Controller - { - private ChurchNetContext db = new ChurchNetContext(); - - // GET: dashboard/HappinessGroups - public ActionResult Index() - { - return View(db.HappinessGroups.ToList()); - } - - // GET: dashboard/HappinessGroups/Details/5 - public ActionResult Details(string id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - HappinessGroup happinessGroup = db.HappinessGroups.Find(id); - if (happinessGroup == null) - { - return HttpNotFound(); - } - return View(happinessGroup); - } - - // GET: dashboard/HappinessGroups/Create - public ActionResult Create() - { - HappinessGroup happinessGroup = new HappinessGroup(); - happinessGroup.GroupId = Church.Net.Utility.Format.Get33BaseGuid(); - happinessGroup.BeginTime = new DateTime(2019, 11, 01, 16, 00, 0); - return View(happinessGroup); - } - - // POST: dashboard/HappinessGroups/Create - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult Create([Bind(Include = "GroupId,Name,BeginTime,Address,CityAndZipCode,InvitationText")] HappinessGroup happinessGroup) - { - - if (ModelState.IsValid) - { - db.HappinessGroups.Add(happinessGroup); - for (int i = 1; i <= 8; i++) - { - - HappinessWeek week = new HappinessWeek(); - week.SEQ = i; - week.Address = happinessGroup.Address; - week.Date = happinessGroup.BeginTime.AddDays((i - 1) * 7); - week.InvitationText = happinessGroup.InvitationText; - week.GroupId = happinessGroup.GroupId; - week.WeekId = Church.Net.Utility.Format.Get33BaseGuid(); - db.HappinessWeeks.Add(week); - } - - - db.SaveChanges(); - return RedirectToAction("Index"); - } - - return View(happinessGroup); - } - - // GET: dashboard/HappinessGroups/Edit/5 - public ActionResult Edit(string id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - HappinessGroup happinessGroup = db.HappinessGroups.Find(id); - if (happinessGroup == null) - { - return HttpNotFound(); - } - return View(happinessGroup); - } - - // POST: dashboard/HappinessGroups/Edit/5 - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult Edit([Bind(Include = "GroupId,Name,BeginTime,Address,CityAndZipCode,InvitationText")] HappinessGroup happinessGroup) - { - if (ModelState.IsValid) - { - - db.Entry(happinessGroup).State = EntityState.Modified; - - List weeks = db.HappinessWeeks.Where(h => h.GroupId == happinessGroup.GroupId).ToList(); - foreach (var item in weeks) - { - item.Address = happinessGroup.Address; - item.CityAndZipCode = happinessGroup.CityAndZipCode; - item.InvitationText = happinessGroup.InvitationText; - - item.Date = happinessGroup.BeginTime.AddDays((item.SEQ - 1) * 7); - db.Entry(item).State = EntityState.Modified; - } - - db.SaveChanges(); - return RedirectToAction("Index"); - } - return View(happinessGroup); - } - - // GET: dashboard/HappinessGroups/Delete/5 - public ActionResult Delete(string id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - HappinessGroup happinessGroup = db.HappinessGroups.Find(id); - if (happinessGroup == null) - { - return HttpNotFound(); - } - return View(happinessGroup); - } - - // POST: dashboard/HappinessGroups/Delete/5 - [HttpPost, ActionName("Delete")] - [ValidateAntiForgeryToken] - public ActionResult DeleteConfirmed(string id) - { - HappinessGroup happinessGroup = db.HappinessGroups.Find(id); - db.HappinessGroups.Remove(happinessGroup); - db.SaveChanges(); - return RedirectToAction("Index"); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - db.Dispose(); - } - base.Dispose(disposing); - } - } -} diff --git a/Chruch.Net/Areas/dashboard/Controllers/NewVisitorsController.cs b/Chruch.Net/Areas/dashboard/Controllers/NewVisitorsController.cs deleted file mode 100644 index 8a7dafa..0000000 --- a/Chruch.Net/Areas/dashboard/Controllers/NewVisitorsController.cs +++ /dev/null @@ -1,160 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Entity; -using System.Linq; -using System.Net; -using System.Text; -using System.Web; -using System.Web.Mvc; -using Church.Net.DAL.EF; -using Church.Net.Entity; - -namespace Chruch.Net.Areas.dashboard.Controllers -{ - public class NewVisitorsController : Controller - { - private ChurchNetContext db = new ChurchNetContext(); - - // GET: dashboard/NewVisitors - public ActionResult Index() - { - var visitors = db.NewVisitors.Include(n => n.Religion); - visitors = visitors.Where(n => n.VisitingDate > new DateTime(2019, 01, 01)); - return View(visitors.OrderBy(n => n.VisitingDate).ToList()); - } - - // GET: dashboard/NewVisitors/Details/5 - public ActionResult Details(string id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - NewVisitor newVisitor = db.NewVisitors.Include(n => n.Religion).FirstOrDefault(n => n.Id == id); - if (newVisitor == null) - { - return HttpNotFound(); - } - return View(newVisitor); - } - - // GET: dashboard/NewVisitors/Create - public ActionResult Create() - { - return View(); - } - - // POST: dashboard/NewVisitors/Create - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult Create([Bind(Include = "Id,FirstName,LastName,Gender,Address,Phone,Email,ComunityAppId,VisitingDate,Note")] NewVisitor newVisitor) - { - if (ModelState.IsValid) - { - db.NewVisitors.Add(newVisitor); - db.SaveChanges(); - return RedirectToAction("Index"); - } - - return View(newVisitor); - } - - // GET: dashboard/NewVisitors/Edit/5 - public ActionResult Edit(string id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - NewVisitor newVisitor = db.NewVisitors.Find(id); - if (newVisitor == null) - { - return HttpNotFound(); - } - ViewBag.ReligionId = new SelectList(db.Religions, "ReligionId", "Name", newVisitor.ReligionId); - return View(newVisitor); - } - - // POST: dashboard/NewVisitors/Edit/5 - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,Gender,Address,Phone,Email,ComunityAppId,VisitingDate,Note,ReligionId")] NewVisitor newVisitor) - { - if (ModelState.IsValid) - { - db.Entry(newVisitor).State = EntityState.Modified; - db.SaveChanges(); - return RedirectToAction("Index"); - } - ViewBag.ReligionId = new SelectList(db.Religions, "ReligionId", "Name", newVisitor.ReligionId); - return View(newVisitor); - } - - // GET: dashboard/NewVisitors/Delete/5 - public ActionResult Delete(string id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - NewVisitor newVisitor = db.NewVisitors.Find(id); - if (newVisitor == null) - { - return HttpNotFound(); - } - return View(newVisitor); - } - - // POST: dashboard/NewVisitors/Delete/5 - [HttpPost, ActionName("Delete")] - [ValidateAntiForgeryToken] - public ActionResult DeleteConfirmed(string id) - { - NewVisitor newVisitor = db.NewVisitors.Find(id); - db.NewVisitors.Remove(newVisitor); - db.SaveChanges(); - if (System.IO.File.Exists(Server.MapPath($"/NewVisitorsPics/{id}.jpg"))) - { - System.IO.File.Delete(Server.MapPath($"/NewVisitorsPics/{id}.jpg")); - } - return RedirectToAction("Index"); - } - - public FileContentResult DownloadCSV() - { - var visitors = db.NewVisitors.Include(n => n.Religion).Where(n => n.VisitingDate > new DateTime(2019, 01, 01)).OrderBy(n => n.VisitingDate).ToList(); - - StringBuilder csv = new StringBuilder(); - - csv.AppendLine("Img,Last Name,First Name,Gender,Phone,Note,首次參加主日時間"); - - foreach (var visitor in visitors) - { - string imgPath = "http://arcadia.nlccoc.org/" +(System.IO.File.Exists(Server.MapPath($"/NewVisitorsPics/{visitor.Id}.jpg")) ? "NewVisitorsPics/" + visitor.Id + ".jpg" : "Images/New Visitor-NonImage.jpg"); - - - - csv.AppendLine($"{imgPath},{visitor.LastName},{visitor.FirstName},{visitor.Gender},{visitor.Phone},{visitor.Note},{visitor.VisitingDate}"); - } - - - - return File(new System.Text.UTF8Encoding().GetBytes(csv.ToString()), "text/csv", "NewVisitors.csv"); - } - - - protected override void Dispose(bool disposing) - { - if (disposing) - { - db.Dispose(); - } - base.Dispose(disposing); - } - } -} diff --git a/Chruch.Net/Areas/dashboard/Controllers/ReligionsController.cs b/Chruch.Net/Areas/dashboard/Controllers/ReligionsController.cs deleted file mode 100644 index 7b44689..0000000 --- a/Chruch.Net/Areas/dashboard/Controllers/ReligionsController.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Entity; -using System.Linq; -using System.Net; -using System.Web; -using System.Web.Mvc; -using Church.Net.DAL.EF; -using Church.Net.Entity; - -namespace Chruch.Net.Areas.dashboard.Controllers -{ - public class ReligionsController : Controller - { - private ChurchNetContext db = new ChurchNetContext(); - - // GET: dashboard/Religions - public ActionResult Index() - { - return View(db.Religions.ToList()); - } - - // GET: dashboard/Religions/Details/5 - public ActionResult Details(int? id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - Religion religion = db.Religions.Find(id); - if (religion == null) - { - return HttpNotFound(); - } - return View(religion); - } - - // GET: dashboard/Religions/Create - public ActionResult Create() - { - return View(); - } - - // POST: dashboard/Religions/Create - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult Create([Bind(Include = "ReligionId,Name")] Religion religion) - { - if (ModelState.IsValid) - { - db.Religions.Add(religion); - db.SaveChanges(); - return RedirectToAction("Index"); - } - - return View(religion); - } - - // GET: dashboard/Religions/Edit/5 - public ActionResult Edit(int? id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - Religion religion = db.Religions.Find(id); - if (religion == null) - { - return HttpNotFound(); - } - return View(religion); - } - - // POST: dashboard/Religions/Edit/5 - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult Edit([Bind(Include = "ReligionId,Name")] Religion religion) - { - if (ModelState.IsValid) - { - db.Entry(religion).State = EntityState.Modified; - db.SaveChanges(); - return RedirectToAction("Index"); - } - return View(religion); - } - - // GET: dashboard/Religions/Delete/5 - public ActionResult Delete(int? id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - Religion religion = db.Religions.Find(id); - if (religion == null) - { - return HttpNotFound(); - } - return View(religion); - } - - // POST: dashboard/Religions/Delete/5 - [HttpPost, ActionName("Delete")] - [ValidateAntiForgeryToken] - public ActionResult DeleteConfirmed(int id) - { - Religion religion = db.Religions.Find(id); - db.Religions.Remove(religion); - db.SaveChanges(); - return RedirectToAction("Index"); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - db.Dispose(); - } - base.Dispose(disposing); - } - } -} diff --git a/Chruch.Net/Areas/dashboard/Controllers/WhoIsSpiesController.cs b/Chruch.Net/Areas/dashboard/Controllers/WhoIsSpiesController.cs deleted file mode 100644 index d367c5b..0000000 --- a/Chruch.Net/Areas/dashboard/Controllers/WhoIsSpiesController.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Entity; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Net; -using System.Web; -using System.Web.Mvc; -using Chruch.Net.Controllers; -using Church.Net.DAL.EF; -using Church.Net.Entity; - -namespace Chruch.Net.Areas.dashboard.Controllers -{ - public class WhoIsSpiesController : Controller - { - private ChurchNetContext db = new ChurchNetContext(); - - // GET: dashboard/WhoIsSpies - public ActionResult Index() - { - return View(db.WhoIsSpy.ToList()); - } - - // GET: dashboard/WhoIsSpies/Details/5 - public ActionResult Details(int? id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - WhoIsSpy whoIsSpy = db.WhoIsSpy.Find(id); - if (whoIsSpy == null) - { - return HttpNotFound(); - } - return View(whoIsSpy); - } - - // GET: dashboard/WhoIsSpies/Create - public ActionResult Create() - { - return View(); - } - - // POST: dashboard/WhoIsSpies/Create - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult Create(WhoIsSpy whoIsSpy) - { - if (ModelState.IsValid) - { - db.WhoIsSpy.Add(whoIsSpy); - db.SaveChanges(); - - - SaveImageFromRequest("Answer1Image", Server.MapPath("~/Images/IceBreak/WhoIsSpy/"), whoIsSpy.Answer1Image); - SaveImageFromRequest("Answer2Image", Server.MapPath("~/Images/IceBreak/WhoIsSpy/"), whoIsSpy.Answer2Image); - - return RedirectToAction("Index"); - } - - return View(whoIsSpy); - } - - // GET: dashboard/WhoIsSpies/Edit/5 - public ActionResult Edit(int? id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - WhoIsSpy whoIsSpy = db.WhoIsSpy.Find(id); - if (whoIsSpy == null) - { - return HttpNotFound(); - } - return View(whoIsSpy); - } - - // POST: dashboard/WhoIsSpies/Edit/5 - // 若要免於過量張貼攻擊,請啟用想要繫結的特定屬性,如需 - // 詳細資訊,請參閱 https://go.microsoft.com/fwlink/?LinkId=317598。 - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult Edit([Bind(Include = "Id,Answer1Cht,Answer1Chs,Answer1En,Answer2Cht,Answer2Chs,Answer2En,Answer1Image,Answer2Image")] WhoIsSpy whoIsSpy) - { - if (ModelState.IsValid) - { - db.Entry(whoIsSpy).State = EntityState.Modified; - db.SaveChanges(); - - SaveImageFromRequest("Answer1Image", Server.MapPath("~/Images/IceBreak/WhoIsSpy/"), whoIsSpy.Answer1Image); - SaveImageFromRequest("Answer2Image", Server.MapPath("~/Images/IceBreak/WhoIsSpy/"), whoIsSpy.Answer2Image); - return RedirectToAction("Index"); - } - return View(whoIsSpy); - } - - // GET: dashboard/WhoIsSpies/Delete/5 - public ActionResult Delete(int? id) - { - if (id == null) - { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); - } - WhoIsSpy whoIsSpy = db.WhoIsSpy.Find(id); - if (whoIsSpy == null) - { - return HttpNotFound(); - } - return View(whoIsSpy); - } - - // POST: dashboard/WhoIsSpies/Delete/5 - [HttpPost, ActionName("Delete")] - [ValidateAntiForgeryToken] - public ActionResult DeleteConfirmed(int id) - { - WhoIsSpy whoIsSpy = db.WhoIsSpy.Find(id); - db.WhoIsSpy.Remove(whoIsSpy); - db.SaveChanges(); - return RedirectToAction("Index"); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - db.Dispose(); - } - base.Dispose(disposing); - } - - private void SaveImageFromRequest(string requestParameterName, string filePath,string newFileName) - { - - var file = HttpContext.Request.Files[requestParameterName]; - bool hasFile = file != null && !string.IsNullOrEmpty(file.FileName); - - - //string newFileName = hasFile ? $"{model.Id}{file.FileName.Substring(file.FileName.LastIndexOf("."))}" : ""; - Directory.CreateDirectory(filePath); - if (hasFile) - { - - Church.Net.Utility.Image.SaveThumbnail(new Bitmap(file.InputStream), - filePath + "\\" + newFileName, 200, 200); - } - } - } -} diff --git a/Chruch.Net/Areas/dashboard/Controllers/_DashboardBaseController.cs b/Chruch.Net/Areas/dashboard/Controllers/_DashboardBaseController.cs deleted file mode 100644 index 9aebabc..0000000 --- a/Chruch.Net/Areas/dashboard/Controllers/_DashboardBaseController.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; - -namespace Chruch.Net.Areas.dashboard.Controllers -{ - [Authorize] - public class _DashboardBaseController : Controller - { - - } -} \ No newline at end of file diff --git a/Chruch.Net/Areas/dashboard/Models/FamilyMemberCreateViewModel.cs b/Chruch.Net/Areas/dashboard/Models/FamilyMemberCreateViewModel.cs deleted file mode 100644 index 71fa283..0000000 --- a/Chruch.Net/Areas/dashboard/Models/FamilyMemberCreateViewModel.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Web; -using Church.Net.Entity; - -namespace Chruch.Net.Areas.dashboard.Models -{ - public class FamilyMemberCreateViewModel - { - - [StringLength(50)] - public string FirstName { get; set; } - [StringLength(50)] - public string LastName { get; set; } - public Enumeration.Gender Gender { get; set; } - public bool Married { get; set; } - public bool Baptized { get; set; } - - public Enumeration.Month BaptizedMonth { get; set; } - - public int BaptizedDay { get; set; } - public int BaptizedYear { get; set; } - public Enumeration.Month BirthMonth { get; set; } - - public int BirthDay { get; set; } - public int BirthYear { get; set; } - - [StringLength(500)] - public string Address { get; set; } - - [StringLength(50)] - public string ComunityAppId { get; set; } - - public string PhoneNumber { get; set; } - - [StringLength(500)] - public string Email { get; set; } - public string ProfileImage { get; set; } - - - [Required] - [StringLength(100, ErrorMessage = "{0} 的長度至少必須為 {2} 個字元。", MinimumLength = 6)] - [DataType(DataType.Password)] - [Display(Name = "密碼")] - public string Password { get; set; } - - [DataType(DataType.Password)] - [Display(Name = "確認密碼")] - [System.ComponentModel.DataAnnotations.Compare("Password", ErrorMessage = "密碼和確認密碼不相符。")] - public string ConfirmPassword { get; set; } - - - public DateTime GetBirthDate() - { - return new DateTime(BirthYear,(int)BirthMonth,BirthDay); - } - public DateTime GetBaptizedDate() - { - return new DateTime(BaptizedYear, (int)BaptizedMonth, BaptizedDay); - } - - } -} \ No newline at end of file diff --git a/Chruch.Net/Chruch.Net.csproj b/Chruch.Net/Chruch.Net.csproj index e5369d5..9dd10ee 100644 --- a/Chruch.Net/Chruch.Net.csproj +++ b/Chruch.Net/Chruch.Net.csproj @@ -204,25 +204,8 @@ - - - - - - - - - - - - - - - - - Global.asax @@ -4230,19 +4213,6 @@ - - - - - - - - - - - - - @@ -4253,7 +4223,6 @@ - @@ -4496,8 +4465,9 @@ + + - @@ -4511,20 +4481,6 @@ - - - {ef712f0f-d4a3-452b-94fd-09261c558347} - Church.Net.BLL.Core - - - {e00016c7-1d23-482b-b6fd-1da93f3a8048} - Church.Net.BLL - - - {606e98ab-096a-46ed-8e2e-4eb5ce4ec553} - Church.Net.Utility - - 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) diff --git a/Chruch.Net/Controllers/AccountController.cs b/Chruch.Net/Controllers/AccountController.cs deleted file mode 100644 index d38a810..0000000 --- a/Chruch.Net/Controllers/AccountController.cs +++ /dev/null @@ -1,488 +0,0 @@ -using System; -using System.Globalization; -using System.Linq; -using System.Security.Claims; -using System.Threading.Tasks; -using System.Web; -using System.Web.Mvc; -using Microsoft.AspNet.Identity; -using Microsoft.AspNet.Identity.Owin; -using Microsoft.Owin.Security; -using Chruch.Net.Models; -using Church.Net.Entity; - -namespace Chruch.Net.Controllers -{ - [Authorize] - public class AccountController : Controller - { - private ApplicationSignInManager _signInManager; - private ApplicationUserManager _userManager; - - public AccountController() - { - } - - public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager ) - { - UserManager = userManager; - SignInManager = signInManager; - } - - public ApplicationSignInManager SignInManager - { - get - { - return _signInManager ?? HttpContext.GetOwinContext().Get(); - } - private set - { - _signInManager = value; - } - } - - public ApplicationUserManager UserManager - { - get - { - return _userManager ?? HttpContext.GetOwinContext().GetUserManager(); - } - private set - { - _userManager = value; - } - } - - // - // GET: /Account/Login - [AllowAnonymous] - public ActionResult Login(string returnUrl) - { - ViewBag.ReturnUrl = returnUrl; - return View(); - } - - // - // POST: /Account/Login - [HttpPost] - [AllowAnonymous] - [ValidateAntiForgeryToken] - public async Task Login(LoginViewModel model, string returnUrl) - { - if (!ModelState.IsValid) - { - return View(model); - } - - // 這不會計算為帳戶鎖定的登入失敗 - // 若要啟用密碼失敗來觸發帳戶鎖定,請變更為 shouldLockout: true - var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false); - - switch (result) - { - case SignInStatus.Success: - return RedirectToLocal(returnUrl); - case SignInStatus.LockedOut: - return View("Lockout"); - case SignInStatus.RequiresVerification: - return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }); - case SignInStatus.Failure: - default: - ModelState.AddModelError("", "登入嘗試失試。"); - return View(model); - } - } - - // - // GET: /Account/VerifyCode - [AllowAnonymous] - public async Task VerifyCode(string provider, string returnUrl, bool rememberMe) - { - // 需要使用者已透過使用者名稱/密碼或外部登入進行登入 - if (!await SignInManager.HasBeenVerifiedAsync()) - { - return View("Error"); - } - return View(new VerifyCodeViewModel { Provider = provider, ReturnUrl = returnUrl, RememberMe = rememberMe }); - } - - // - // POST: /Account/VerifyCode - [HttpPost] - [AllowAnonymous] - [ValidateAntiForgeryToken] - public async Task VerifyCode(VerifyCodeViewModel model) - { - if (!ModelState.IsValid) - { - return View(model); - } - - // 下列程式碼保護兩個因素碼不受暴力密碼破解攻擊。 - // 如果使用者輸入不正確的代碼來表示一段指定的時間,則使用者帳戶 - // 會有一段指定的時間遭到鎖定。 - // 您可以在 IdentityConfig 中設定帳戶鎖定設定 - var result = await SignInManager.TwoFactorSignInAsync(model.Provider, model.Code, isPersistent: model.RememberMe, rememberBrowser: model.RememberBrowser); - switch (result) - { - case SignInStatus.Success: - return RedirectToLocal(model.ReturnUrl); - case SignInStatus.LockedOut: - return View("Lockout"); - case SignInStatus.Failure: - default: - ModelState.AddModelError("", "代碼無效。"); - return View(model); - } - } - - // - // GET: /Account/Register - [AllowAnonymous] - public ActionResult Register() - { - return View(); - } - - // - // POST: /Account/Register - [HttpPost] - [AllowAnonymous] - [ValidateAntiForgeryToken] - public async Task Register(RegisterViewModel model) - { - if (ModelState.IsValid) - { - var user = new FamilyMember { UserName = model.Email, Email = model.Email }; - var result = await UserManager.CreateAsync(user, model.Password); - if (result.Succeeded) - { - UserManager.AddToRole(user.Id, "FamilyMember"); - await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false); - - // 如需如何進行帳戶確認及密碼重設的詳細資訊,請前往 https://go.microsoft.com/fwlink/?LinkID=320771 - // 傳送包含此連結的電子郵件 - // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); - // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); - // await UserManager.SendEmailAsync(user.Id, "確認您的帳戶", "請按一下此連結確認您的帳戶 這裏"); - - return RedirectToAction("Index", "Home"); - } - AddErrors(result); - } - - // 如果執行到這裡,發生某項失敗,則重新顯示表單 - return View(model); - } - - // - // GET: /Account/ConfirmEmail - [AllowAnonymous] - public async Task ConfirmEmail(string userId, string code) - { - if (userId == null || code == null) - { - return View("Error"); - } - var result = await UserManager.ConfirmEmailAsync(userId, code); - return View(result.Succeeded ? "ConfirmEmail" : "Error"); - } - - // - // GET: /Account/ForgotPassword - [AllowAnonymous] - public ActionResult ForgotPassword() - { - return View(); - } - - // - // POST: /Account/ForgotPassword - [HttpPost] - [AllowAnonymous] - [ValidateAntiForgeryToken] - public async Task ForgotPassword(ForgotPasswordViewModel model) - { - if (ModelState.IsValid) - { - var user = await UserManager.FindByNameAsync(model.Email); - if (user == null || !(await UserManager.IsEmailConfirmedAsync(user.Id))) - { - // 不顯示使用者不存在或未受確認 - return View("ForgotPasswordConfirmation"); - } - - // 如需如何進行帳戶確認及密碼重設的詳細資訊,請前往 https://go.microsoft.com/fwlink/?LinkID=320771 - // 傳送包含此連結的電子郵件 - // string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id); - // var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); - // await UserManager.SendEmailAsync(user.Id, "重設密碼", "請按 這裏 重設密碼"); - // return RedirectToAction("ForgotPasswordConfirmation", "Account"); - } - - // 如果執行到這裡,發生某項失敗,則重新顯示表單 - return View(model); - } - - // - // GET: /Account/ForgotPasswordConfirmation - [AllowAnonymous] - public ActionResult ForgotPasswordConfirmation() - { - return View(); - } - - // - // GET: /Account/ResetPassword - [AllowAnonymous] - public ActionResult ResetPassword(string code) - { - return code == null ? View("Error") : View(); - } - - // - // POST: /Account/ResetPassword - [HttpPost] - [AllowAnonymous] - [ValidateAntiForgeryToken] - public async Task ResetPassword(ResetPasswordViewModel model) - { - if (!ModelState.IsValid) - { - return View(model); - } - var user = await UserManager.FindByNameAsync(model.Email); - if (user == null) - { - // 不顯示使用者不存在 - return RedirectToAction("ResetPasswordConfirmation", "Account"); - } - var result = await UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password); - if (result.Succeeded) - { - return RedirectToAction("ResetPasswordConfirmation", "Account"); - } - AddErrors(result); - return View(); - } - - // - // GET: /Account/ResetPasswordConfirmation - [AllowAnonymous] - public ActionResult ResetPasswordConfirmation() - { - return View(); - } - - // - // POST: /Account/ExternalLogin - [HttpPost] - [AllowAnonymous] - [ValidateAntiForgeryToken] - public ActionResult ExternalLogin(string provider, string returnUrl) - { - // 要求重新導向至外部登入提供者 - return new ChallengeResult(provider, Url.Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl })); - } - - // - // GET: /Account/SendCode - [AllowAnonymous] - public async Task SendCode(string returnUrl, bool rememberMe) - { - var userId = await SignInManager.GetVerifiedUserIdAsync(); - if (userId == null) - { - return View("Error"); - } - var userFactors = await UserManager.GetValidTwoFactorProvidersAsync(userId); - var factorOptions = userFactors.Select(purpose => new SelectListItem { Text = purpose, Value = purpose }).ToList(); - return View(new SendCodeViewModel { Providers = factorOptions, ReturnUrl = returnUrl, RememberMe = rememberMe }); - } - - // - // POST: /Account/SendCode - [HttpPost] - [AllowAnonymous] - [ValidateAntiForgeryToken] - public async Task SendCode(SendCodeViewModel model) - { - if (!ModelState.IsValid) - { - return View(); - } - - // 產生並傳送 Token - if (!await SignInManager.SendTwoFactorCodeAsync(model.SelectedProvider)) - { - return View("Error"); - } - return RedirectToAction("VerifyCode", new { Provider = model.SelectedProvider, ReturnUrl = model.ReturnUrl, RememberMe = model.RememberMe }); - } - - // - // GET: /Account/ExternalLoginCallback - [AllowAnonymous] - public async Task ExternalLoginCallback(string returnUrl) - { - var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(); - if (loginInfo == null) - { - return RedirectToAction("Login"); - } - - // 若使用者已經有登入資料,請使用此外部登入提供者登入使用者 - var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent: false); - switch (result) - { - case SignInStatus.Success: - return RedirectToLocal(returnUrl); - case SignInStatus.LockedOut: - return View("Lockout"); - case SignInStatus.RequiresVerification: - return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = false }); - case SignInStatus.Failure: - default: - // 若使用者沒有帳戶,請提示使用者建立帳戶 - ViewBag.ReturnUrl = returnUrl; - ViewBag.LoginProvider = loginInfo.Login.LoginProvider; - return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = loginInfo.Email }); - } - } - - // - // POST: /Account/ExternalLoginConfirmation - [HttpPost] - [AllowAnonymous] - [ValidateAntiForgeryToken] - public async Task ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl) - { - if (User.Identity.IsAuthenticated) - { - return RedirectToAction("Index", "Manage"); - } - - if (ModelState.IsValid) - { - // 從外部登入提供者處取得使用者資訊 - var info = await AuthenticationManager.GetExternalLoginInfoAsync(); - if (info == null) - { - return View("ExternalLoginFailure"); - } - var user = new FamilyMember { UserName = model.Email, Email = model.Email }; - var result = await UserManager.CreateAsync(user); - if (result.Succeeded) - { - result = await UserManager.AddLoginAsync(user.Id, info.Login); - if (result.Succeeded) - { - await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); - return RedirectToLocal(returnUrl); - } - } - AddErrors(result); - } - - ViewBag.ReturnUrl = returnUrl; - return View(model); - } - - // - // POST: /Account/LogOff - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult LogOff() - { - AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie); - return RedirectToAction("Index", "Home"); - } - - // - // GET: /Account/ExternalLoginFailure - [AllowAnonymous] - public ActionResult ExternalLoginFailure() - { - return View(); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - if (_userManager != null) - { - _userManager.Dispose(); - _userManager = null; - } - - if (_signInManager != null) - { - _signInManager.Dispose(); - _signInManager = null; - } - } - - base.Dispose(disposing); - } - - #region Helper - // 新增外部登入時用來當做 XSRF 保護 - private const string XsrfKey = "XsrfId"; - - private IAuthenticationManager AuthenticationManager - { - get - { - return HttpContext.GetOwinContext().Authentication; - } - } - - private void AddErrors(IdentityResult result) - { - foreach (var error in result.Errors) - { - ModelState.AddModelError("", error); - } - } - - private ActionResult RedirectToLocal(string returnUrl) - { - if (Url.IsLocalUrl(returnUrl)) - { - return Redirect(returnUrl); - } - return RedirectToAction("Index", "Home"); - } - - internal class ChallengeResult : HttpUnauthorizedResult - { - public ChallengeResult(string provider, string redirectUri) - : this(provider, redirectUri, null) - { - } - - public ChallengeResult(string provider, string redirectUri, string userId) - { - LoginProvider = provider; - RedirectUri = redirectUri; - UserId = userId; - } - - public string LoginProvider { get; set; } - public string RedirectUri { get; set; } - public string UserId { get; set; } - - public override void ExecuteResult(ControllerContext context) - { - var properties = new AuthenticationProperties { RedirectUri = RedirectUri }; - if (UserId != null) - { - properties.Dictionary[XsrfKey] = UserId; - } - context.HttpContext.GetOwinContext().Authentication.Challenge(properties, LoginProvider); - } - } - #endregion - } -} \ No newline at end of file diff --git a/Chruch.Net/Controllers/HappinessController.cs b/Chruch.Net/Controllers/HappinessController.cs deleted file mode 100644 index 5232efc..0000000 --- a/Chruch.Net/Controllers/HappinessController.cs +++ /dev/null @@ -1,174 +0,0 @@ -using Church.Net.DAL.EF; -using Church.Net.Entity; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Web; -using System.Web.Mvc; - -namespace Chruch.Net.Controllers -{ - public class HappinessController : Controller - { - private ChurchNetContext db = new ChurchNetContext(); - - // GET: Happiness - public ActionResult Best(string id) - { - HappinessBEST best; - best = db.HappinessBESTs.FirstOrDefault(h => h.BestId == id); - - if (best!=null) - { - ViewBag.BestName = best.Name; - HappinessGroup group = new HappinessGroup(); - - - - group = db.HappinessGroups.First(g => g.GroupId == best.GroupId); - group.BestList = new List(); - group.BestList.Clear(); - group.BestList.Add(best); - group.Weeks = new List(); - group.Weeks.Clear(); - var qurry = db.HappinessWeeks.OrderBy(o => o.SEQ).ToList(); - group.Weeks.Add(qurry.First(g => g.GroupId == best.GroupId & g.Date>= DateTime.Today)); - - string weekTitle = ""; - StringBuilder invitation = new StringBuilder(); - invitation.Append($".type('Hi, {best.Name},').break()"); - switch (group.Weeks.First().SEQ) - { - case 1: - weekTitle = "真幸福"; - invitation.Append("我們想送你一份禮物, "); - invitation.Append("他是人生中最棒的夥伴, "); - invitation.Append("為你帶來超乎想像的幸福感, "); - invitation.Append("值得你用8個星期的時間來認識. "); - invitation.Append("幸福小組,邀你一同了解幸福! "); - break; - case 2: - weekTitle = "真相大白"; - invitation.Append(".options({ speed: 155 }).type('我們想送你一份禮物,').pause(500)"); - invitation.Append(".options({ speed: 125 }).delete(10)"); - invitation.Append(".type('你以為我們這麼偷懶 :-),').break()"); - invitation.Append(".type('每周的邀請函內容一樣嗎?').break()"); - invitation.Append(".type('當然不是囉~').break()"); - invitation.Append(".type('我們可是求新求變,').break()"); - invitation.Append(".type('尋找人生新氣象的幸福小組呢~').break()"); - invitation.Append(".type('這周想邀請你一起來,').break()"); - invitation.Append(".type('破除謊言尋找幸福的真相唷~').break()"); - break; - case 3: - weekTitle = "萬世巨星"; - invitation.Append(".type('這星期過得好嗎? ').break()"); - invitation.Append(".options({ speed: 155 }).type('這週將揭曉一位萬事巨猩唷!')"); - invitation.Append(".options({ speed: 125 }).delete(4)"); - invitation.Append(".type('巨星唷!').break()"); - invitation.Append(".type('想知道是誰要登場了嗎;-)? ').break()"); - invitation.Append(".type('千萬別錯過這週的幸福小組唷~ ').break()"); - invitation.Append(".type('期待與你幸福有約。 ').break()"); - invitation.Append(".type('讓我們一起來經歷平安、喜樂 ').break()"); - invitation.Append(".options({ speed: 175 }).type('祝 福 滿 滿!!!')"); - break; - case 4: - weekTitle = "幸福連線"; - break; - case 5: - weekTitle = "當上帝來敲門"; - break; - case 6: - weekTitle = "十字架的勝利"; - break; - case 7: - weekTitle = "釋放與自由"; - break; - case 8: - weekTitle = "幸福的教會"; - break; - default: - break; - } - - - ViewBag.Title = $"{group.Name}-邀請函之{weekTitle}! for {best.Name}"; - ViewBag.InvitationJS = invitation.ToString(); - return View(group); - } - return RedirectToAction("Index", "Home"); - } - - public ActionResult Week(int id) - { - - HappinessGroup group = new HappinessGroup(); - group = db.HappinessGroups.First(); - group.Weeks = new List(); - group.Weeks.Clear(); - var qurry = db.HappinessWeeks.OrderBy(o => o.SEQ).ToList(); - group.Weeks.Add(qurry.First(g => g.GroupId == group.GroupId & g.SEQ == id)); - - HappinessBEST best; - best = group.BestList.First(); - ViewBag.BestName = best.Name; - - - string weekTitle = ""; - StringBuilder invitation = new StringBuilder(); - switch (group.Weeks.First().SEQ) - { - case 1: - weekTitle = "真幸福"; - break; - case 2: - weekTitle = "真相大白"; - invitation.Append($".type('Hi, {best.Name},').break()"); - invitation.Append(".options({ speed: 155 }).type('我們想送你一份禮物,').pause(500)"); - invitation.Append(".options({ speed: 125 }).delete(10)"); - invitation.Append(".type('你以為我們這麼偷懶 :-),').break()"); - invitation.Append(".type('每周的邀請函內容一樣嗎?').break()"); - invitation.Append(".type('當然不是囉~').break()"); - invitation.Append(".type('我們可是求新求變,').break()"); - invitation.Append(".type('尋找人生新氣象的幸福小組呢~').break()"); - invitation.Append(".type('這周想邀請你一起來,').break()"); - invitation.Append(".type('破除謊言尋找幸福的真相唷~').break()"); - break; - case 3: - weekTitle = "萬世巨星"; - break; - case 4: - weekTitle = "幸福連線"; - break; - case 5: - weekTitle = "當上帝來敲門"; - break; - case 6: - weekTitle = "十字架的勝利"; - break; - case 7: - weekTitle = "釋放與自由"; - break; - case 8: - weekTitle = "幸福的教會"; - break; - default: - break; - } - - - ViewBag.Title = $"{group.Name}-邀請函之{weekTitle}! for {group.BestList.First().Name}"; - - ViewBag.InvitationJS = invitation.ToString(); - return View("Best", group); - } - protected override void Dispose(bool disposing) - { - if (disposing) - { - db.Dispose(); - } - base.Dispose(disposing); - } - } -} diff --git a/Chruch.Net/Controllers/HomeController.cs b/Chruch.Net/Controllers/HomeController.cs deleted file mode 100644 index d9ee346..0000000 --- a/Chruch.Net/Controllers/HomeController.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; - -namespace Chruch.Net.Controllers -{ - public class HomeController : Controller - { - public ActionResult Index(string id) - { - - if (HttpContext.Request.Url.AbsoluteUri.IndexOf("gls.") > 0 || HttpContext.Request.Url.AbsoluteUri.IndexOf("glsoc.") > 0) - { - if (id == "EN") - { - return View("/Views/Register2019/Index.cshtml"); - - } - else - { - return View("/Views/Register2019/IndexCn.cshtml"); - - } - - } - //return RedirectToAction("Index", "NewVisitor"); - return View(); - } - - public ActionResult About() - { - ViewBag.Message = "Your application description page."; - - return View(); - } - - public ActionResult Contact() - { - ViewBag.Message = "Your contact page."; - - return View(); - } - } -} \ No newline at end of file diff --git a/Chruch.Net/Controllers/IceBreakController.cs b/Chruch.Net/Controllers/IceBreakController.cs deleted file mode 100644 index b4b18c5..0000000 --- a/Chruch.Net/Controllers/IceBreakController.cs +++ /dev/null @@ -1,483 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Web; -using System.Web.Mvc; -using Chruch.Net.Models.IceBreak; -using Church.Net.DAL.EF; -using Church.Net.Entity; -using Church.Net.Utility; -using Microsoft.Ajax.Utilities; - -namespace Chruch.Net.Controllers -{ - public class IceBreakController : _BaseController - { - - private ChurchNetContext db = new ChurchNetContext(); - // GET: IceBreak - public ActionResult Index() - { - return View(); - } - - public ActionResult Host() - { - return View(); - } - - - public ActionResult Hi(string id, GamePlayer model) - { - model = new GamePlayer(); - model.TempGameRoomId = PlayerInfo.TempGameRoomId; - return View(model); - } - [HttpPost] - public ActionResult Hi(GamePlayer model) - { - - if (ModelState.IsValid) - { - PlayerInfo = model; - PlayerInfo.Id = Church.Net.Utility.Format.Get33BaseGuid(); - - if (PlayerInfo.TempGameRoomId.IsNullOrWhiteSpace()) - { - return RedirectToAction("WhoIsSpyPlay"); - - } - else - { - - return RedirectToAction("WhoIsSpyPlayJoin", new { id = PlayerInfo.TempGameRoomId }); - } - } - return View(model); - } - - #region WhoIsSpy - - #region PublicProperty - - - - public List GameRooms - { - get - { - if (HttpContext.Application["GameRooms"] == null) - { - HttpContext.Application["GameRooms"] = new List(); - } - return (List)HttpContext.Application["GameRooms"]; - } - set => HttpContext.Application["GameRooms"] = value; - } - public string GameRoomId - { - get - { - if (HttpContext.Session["GameRoomId"] == null) - { - HttpContext.Session["GameRoomId"] = ""; - } - return (string)HttpContext.Session["GameRoomId"]; - } - set => HttpContext.Session["GameRoomId"] = value; - } - - - public GamePlayer PlayerInfo - { - - get - { - if (HttpContext.Session["PlayerInfo"] == null) - { - HttpContext.Session["PlayerInfo"] = new GamePlayer(); - } - return (GamePlayer)HttpContext.Session["PlayerInfo"]; - } - set => HttpContext.Session["PlayerInfo"] = value; - } - - #endregion - #region Console - - - - // GET: IceBreak - - public ActionResult WhoIsSpy(string id) - { - - - if (id.IsNullOrWhiteSpace() && GameRoomId.IsNullOrWhiteSpace()) - { - - return View("WhoIsSpy", new Models.IceBreak.WhoIsSpyGameRoom()); - } - - - - if (GameRooms.Any(g => g.Id == id)) - { - GameRoomId = id; - } - else if(!id.IsNullOrWhiteSpace()) - { - - Models.IceBreak.WhoIsSpyGameRoom model = new WhoIsSpyGameRoom(); - - if (model.Id.IsNullOrWhiteSpace()) - { - Random r = new Random(); - model.Id = r.Next(1, 99).ToString("00"); - } - model.Id = GameRoomId; - model.SpyAmount = 2; - model.Status = WhoIsSpyProcess.WaitForPlayer; - GameRooms.Add(model); - GameRoomId = model.Id; - } - - var gameRoom = GameRooms.FirstOrDefault(room => room.Id == GameRoomId); - return View("WhoIsSpy", (WhoIsSpyGameRoom)gameRoom); - } - - - - [HttpPost] - public ActionResult WhoIsSpyCreate(string id) - { - - - if (GameRooms.Any(g => g.Id == id)) - { - GameRoomId = id; - } - else - { - - Models.IceBreak.WhoIsSpyGameRoom model = new WhoIsSpyGameRoom(); - - model.Id = id; - - if (model.Id.IsNullOrWhiteSpace()) - { - Random r = new Random(); - model.Id = r.Next(1, 99).ToString("00"); - } - model.SpyAmount = 2; - model.Status = WhoIsSpyProcess.WaitForPlayer; - GameRooms.Add(model); - GameRoomId = model.Id; - - } - - - return RedirectToAction("WhoIsSpy"); - } - - - - - [HttpPost] - public ActionResult WhoIsSpyStart(Models.IceBreak.WhoIsSpyGameRoom model) - { - - Random r = new Random(); - WhoIsSpyGameRoom gameRoom = (WhoIsSpyGameRoom)GameRooms.FirstOrDefault(room => room.Id == GameRoomId); - - if (gameRoom == null) - { - return RedirectToAction("WhoIsSpy"); - } - - gameRoom.SpyAmount = model.SpyAmount; - gameRoom.EmptyAmount = model.EmptyAmount; - - - if ((gameRoom.TotalPlayer -1) < gameRoom.SpyAmount*2) - { - ShowScriptMsg("臥底人數太多了!", MessageType.Errors); - - return View("WhoIsSpy", gameRoom); - } - if (gameRoom.SpyAmount < gameRoom.EmptyAmount * 2) - { - ShowScriptMsg("空白人數太多了!", MessageType.Errors); - - return View("WhoIsSpy", gameRoom); - } - //取題目 - - int totalAnswer = db.WhoIsSpy.Count(a=> !gameRoom.PlayedAnswerId.Contains(a.Id)); - - if (totalAnswer==0) - { - gameRoom.PlayedAnswerId=new List(); - } - - WhoIsSpy answer; - - answer = db.WhoIsSpy.Where(a => !gameRoom.PlayedAnswerId.Contains(a.Id)).OrderBy(a => a.Id).Skip(r.Next(0, totalAnswer - 1)).First(); - gameRoom.PlayedAnswerId.Add(answer.Id); - bool reverseAnswer = r.Next(0, 100) > 50; - - gameRoom.Answer = reverseAnswer - ? new WhoIsSpyAnswer(answer.Answer1Cht, answer.Answer1Chs, answer.Answer1En, answer.Answer1Image) - : new WhoIsSpyAnswer(answer.Answer2Cht, answer.Answer2Chs, answer.Answer2En, answer.Answer2Image); - gameRoom.SpysAnswer = !reverseAnswer - ? new WhoIsSpyAnswer(answer.Answer1Cht, answer.Answer1Chs, answer.Answer1En, answer.Answer1Image) - : new WhoIsSpyAnswer(answer.Answer2Cht, answer.Answer2Chs, answer.Answer2En, answer.Answer2Image); - //Set Player - - foreach (var whoIsSpyPlayer in gameRoom.Players) - { - whoIsSpyPlayer.VoteTo = new List(); - whoIsSpyPlayer.IsDead = false; - whoIsSpyPlayer.GameStatus = WhoIsSpyProcess.Started; - whoIsSpyPlayer.Answer = gameRoom.Answer; - whoIsSpyPlayer.IsSpy = false; - - - } - - //Set Spy - - - WhoIsSpyPlayer spy; - for (int g = 1; g <= gameRoom.SpyAmount; g++) - { - - do - { - spy = gameRoom.Players[r.Next(0, gameRoom.TotalPlayer - 1)]; - - } while (spy.IsSpy); - - spy.IsSpy = true; - spy.Answer = g <= gameRoom.EmptyAmount ? new WhoIsSpyAnswer() : gameRoom.SpysAnswer; - - } - - - //Start Order - do - { - gameRoom.StartIndex = r.Next(0, gameRoom.TotalPlayer - 1); - } while (gameRoom.Players[gameRoom.StartIndex].IsDead); - - gameRoom.Status = WhoIsSpyProcess.Started; - - return RedirectToAction("WhoIsSpy"); - } - - - public ActionResult WhoIsSpyClose() - { - GameRooms.RemoveAll(room => room.Id == GameRoomId); - GameRoomId = ""; - - return RedirectToAction("WhoIsSpy"); - } - - [HttpPost] - public ActionResult WhoIsSpyNext() - { - - var gameRoom = (WhoIsSpyGameRoom)GameRooms.FirstOrDefault(room => room.Id == GameRoomId); - - if (gameRoom==null) - { - return RedirectToAction("WhoIsSpy"); - } - - switch (gameRoom.Status) - { - case WhoIsSpyProcess.WaitForPlayer: - break; - case WhoIsSpyProcess.Started: - - //開始 - gameRoom.Status = WhoIsSpyProcess.Votting; - - gameRoom.VoteAmount = gameRoom.Players.Count(p => p.IsSpy && !p.IsDead); - gameRoom.Players.Shuffle(); - foreach (var whoIsSpyPlayer in gameRoom.Players) - { - whoIsSpyPlayer.VoteTo = new List(); - whoIsSpyPlayer.ReceviedVotes = 0; - whoIsSpyPlayer.VoteAmount = gameRoom.Players.Count(p => p.IsSpy && !p.IsDead); - whoIsSpyPlayer.VoteOption=new List(gameRoom.Players.Where(p=>p.Id!=whoIsSpyPlayer.Id&&!p.IsDead).Select(p=>new WhoIsSpyVoteOption(p.Id,p.Name))); - - } - break; - case WhoIsSpyProcess.Votting: - foreach (var whoIsSpyPlayer in gameRoom.Players.OrderByDescending(p=>p.ReceviedVotes).Take(gameRoom.Players.Count(p => p.IsSpy && !p.IsDead))) - { - whoIsSpyPlayer.IsDead = true; - } - gameRoom.Status = WhoIsSpyProcess.DisplayResult; - break; - case WhoIsSpyProcess.DisplayResult: - if (gameRoom.Players.Count(p => p.IsSpy && !p.IsDead)>= gameRoom.Players.Count(p => !p.IsSpy && !p.IsDead) || gameRoom.Players.Count(p => p.IsSpy && !p.IsDead)==0) - { - gameRoom.Status = WhoIsSpyProcess.End; - - } - else - { - gameRoom.Status = WhoIsSpyProcess.Started; - } - - - break; - case WhoIsSpyProcess.End: - - gameRoom.Status = WhoIsSpyProcess.WaitForPlayer; - break; - default: - throw new ArgumentOutOfRangeException(); - } - - foreach (var whoIsSpyPlayer in gameRoom.Players) - { - whoIsSpyPlayer.GameStatus = gameRoom.Status; - } - return RedirectToAction("WhoIsSpy"); - } - - public PartialViewResult WhoIsSpyGetPlayerList() - { - var gameRoom = GameRooms.FirstOrDefault(room => room.Id == GameRoomId); - - if (gameRoom == null) - { - return null; - } - return PartialView("~/Views/IceBreak/WhoIsSpyPlayerList.cshtml", gameRoom.Players.Select(p => p.Name).ToList()); - } - - public PartialViewResult WhoIsSpyGetPlayerVoteList() - { - var gameRoom = GameRooms.FirstOrDefault(room => room.Id == GameRoomId); - - - if (gameRoom == null) - { - return null; - } - return PartialView("~/Views/IceBreak/WhoIsSpyPlayerList.cshtml", gameRoom?.Players.Where(p => !p.IsDead && p.VoteTo.Count == 0).Select(p => p.Name).ToList()); - } - #endregion - - - #region WhoIsSpyPlayer - - - public ActionResult WhoIsSpyPlay() - { - if (PlayerInfo.Name.IsNullOrWhiteSpace()) - { - return RedirectToAction("Hi"); - } - - var gameRoom = GameRooms.FirstOrDefault(room => room.Id == GameRoomId); - if (gameRoom != null && gameRoom.Players.Exists(p => p.Id == PlayerInfo.Id)) - { - return View(gameRoom.Players.FirstOrDefault(p => p.Id == PlayerInfo.Id)); - - } - return View(); - } - - public ActionResult WhoIsSpyPlayJoin(string id) - { - var gameRoom = (WhoIsSpyGameRoom)GameRooms.FirstOrDefault(room => room.Id == id); - - if (gameRoom == null) - { - ShowScriptMsg("遊戲室不存在,請重新輸入遊戲室編號", MessageType.Warring); - - return RedirectToAction("WhoIsSpyPlay"); - } - - - if (PlayerInfo.Name.IsNullOrWhiteSpace()) - { - PlayerInfo.TempGameRoomId = id; - return RedirectToAction("Hi"); - } - - WhoIsSpyPlayer model; - if (!gameRoom.Players.Exists(p => p.Id == PlayerInfo.Id)) - { - model = new WhoIsSpyPlayer() - { - Id = PlayerInfo.Id, - Name = PlayerInfo.Name, - RoomId = id, - GameStatus = gameRoom.Status - }; - gameRoom.Players.Add(model); - GameRoomId = gameRoom.Id; - } - return RedirectToAction("WhoIsSpyPlay"); - } - - public ActionResult WhoIsSpyPlayVote(WhoIsSpyPlayer model) - { - try - { - var gameRoom = GameRooms.FirstOrDefault(room => room.Id == GameRoomId); - var player = gameRoom.Players.Find(p => p.Id == model.Id); - player.GameStatus = WhoIsSpyProcess.DisplayResult; - player.VoteTo = model.VoteTo; - foreach (var s in model.VoteTo) - { - gameRoom.Players.Find(p => p.Id == s).ReceviedVotes += 1; - } - - } - catch (Exception e) - { - } - return RedirectToAction("WhoIsSpyPlay"); - } - public ActionResult WhoIsSpyExit() - { - - var gameRoom = GameRooms.FirstOrDefault(room => room.Id == GameRoomId); - gameRoom.Players.RemoveAll(p => p.Id == PlayerInfo.Id); - PlayerInfo.TempGameRoomId = ""; - GameRoomId = ""; - return RedirectToAction("WhoIsSpyPlay"); - } - - - public JsonResult CheckGameRoomStatu(string id) - { - var gameRoom = GameRooms.FirstOrDefault(room => room.Id == id); - - if (gameRoom==null) - { - return Json(WhoIsSpyProcess.Closed); - - } - var player = gameRoom.Players.Find(p => p.Id == PlayerInfo.Id); - - return Json(player.GameStatus); - } - - #endregion - #endregion - - - - - } -} \ No newline at end of file diff --git a/Chruch.Net/Controllers/ManageController.cs b/Chruch.Net/Controllers/ManageController.cs deleted file mode 100644 index 0e9e83a..0000000 --- a/Chruch.Net/Controllers/ManageController.cs +++ /dev/null @@ -1,389 +0,0 @@ -using System; -using System.Linq; -using System.Threading.Tasks; -using System.Web; -using System.Web.Mvc; -using Microsoft.AspNet.Identity; -using Microsoft.AspNet.Identity.Owin; -using Microsoft.Owin.Security; -using Chruch.Net.Models; - -namespace Chruch.Net.Controllers -{ - [Authorize] - public class ManageController : Controller - { - private ApplicationSignInManager _signInManager; - private ApplicationUserManager _userManager; - - public ManageController() - { - } - - public ManageController(ApplicationUserManager userManager, ApplicationSignInManager signInManager) - { - UserManager = userManager; - SignInManager = signInManager; - } - - public ApplicationSignInManager SignInManager - { - get - { - return _signInManager ?? HttpContext.GetOwinContext().Get(); - } - private set - { - _signInManager = value; - } - } - - public ApplicationUserManager UserManager - { - get - { - return _userManager ?? HttpContext.GetOwinContext().GetUserManager(); - } - private set - { - _userManager = value; - } - } - - // - // GET: /Manage/Index - public async Task Index(ManageMessageId? message) - { - ViewBag.StatusMessage = - message == ManageMessageId.ChangePasswordSuccess ? "已變更您的密碼。" - : message == ManageMessageId.SetPasswordSuccess ? "已設定您的密碼。" - : message == ManageMessageId.SetTwoFactorSuccess ? "已設定您的雙因素驗證。" - : message == ManageMessageId.Error ? "發生錯誤。" - : message == ManageMessageId.AddPhoneSuccess ? "已新增您的電話號碼。" - : message == ManageMessageId.RemovePhoneSuccess ? "已移除您的電話號碼。" - : ""; - - var userId = User.Identity.GetUserId(); - var model = new IndexViewModel - { - HasPassword = HasPassword(), - PhoneNumber = await UserManager.GetPhoneNumberAsync(userId), - TwoFactor = await UserManager.GetTwoFactorEnabledAsync(userId), - Logins = await UserManager.GetLoginsAsync(userId), - BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId) - }; - return View(model); - } - - // - // POST: /Manage/RemoveLogin - [HttpPost] - [ValidateAntiForgeryToken] - public async Task RemoveLogin(string loginProvider, string providerKey) - { - ManageMessageId? message; - var result = await UserManager.RemoveLoginAsync(User.Identity.GetUserId(), new UserLoginInfo(loginProvider, providerKey)); - if (result.Succeeded) - { - var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); - if (user != null) - { - await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); - } - message = ManageMessageId.RemoveLoginSuccess; - } - else - { - message = ManageMessageId.Error; - } - return RedirectToAction("ManageLogins", new { Message = message }); - } - - // - // GET: /Manage/AddPhoneNumber - public ActionResult AddPhoneNumber() - { - return View(); - } - - // - // POST: /Manage/AddPhoneNumber - [HttpPost] - [ValidateAntiForgeryToken] - public async Task AddPhoneNumber(AddPhoneNumberViewModel model) - { - if (!ModelState.IsValid) - { - return View(model); - } - // 產生並傳送 Token - var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), model.Number); - if (UserManager.SmsService != null) - { - var message = new IdentityMessage - { - Destination = model.Number, - Body = "您的安全碼為: " + code - }; - await UserManager.SmsService.SendAsync(message); - } - return RedirectToAction("VerifyPhoneNumber", new { PhoneNumber = model.Number }); - } - - // - // POST: /Manage/EnableTwoFactorAuthentication - [HttpPost] - [ValidateAntiForgeryToken] - public async Task EnableTwoFactorAuthentication() - { - await UserManager.SetTwoFactorEnabledAsync(User.Identity.GetUserId(), true); - var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); - if (user != null) - { - await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); - } - return RedirectToAction("Index", "Manage"); - } - - // - // POST: /Manage/DisableTwoFactorAuthentication - [HttpPost] - [ValidateAntiForgeryToken] - public async Task DisableTwoFactorAuthentication() - { - await UserManager.SetTwoFactorEnabledAsync(User.Identity.GetUserId(), false); - var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); - if (user != null) - { - await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); - } - return RedirectToAction("Index", "Manage"); - } - - // - // GET: /Manage/VerifyPhoneNumber - public async Task VerifyPhoneNumber(string phoneNumber) - { - var code = await UserManager.GenerateChangePhoneNumberTokenAsync(User.Identity.GetUserId(), phoneNumber); - // 透過 SMS 提供者傳送 SMS,以驗證電話號碼 - return phoneNumber == null ? View("Error") : View(new VerifyPhoneNumberViewModel { PhoneNumber = phoneNumber }); - } - - // - // POST: /Manage/VerifyPhoneNumber - [HttpPost] - [ValidateAntiForgeryToken] - public async Task VerifyPhoneNumber(VerifyPhoneNumberViewModel model) - { - if (!ModelState.IsValid) - { - return View(model); - } - var result = await UserManager.ChangePhoneNumberAsync(User.Identity.GetUserId(), model.PhoneNumber, model.Code); - if (result.Succeeded) - { - var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); - if (user != null) - { - await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); - } - return RedirectToAction("Index", new { Message = ManageMessageId.AddPhoneSuccess }); - } - // 如果執行到這裡,發生某項失敗,則重新顯示表單 - ModelState.AddModelError("", "無法驗證號碼"); - return View(model); - } - - // - // POST: /Manage/RemovePhoneNumber - [HttpPost] - [ValidateAntiForgeryToken] - public async Task RemovePhoneNumber() - { - var result = await UserManager.SetPhoneNumberAsync(User.Identity.GetUserId(), null); - if (!result.Succeeded) - { - return RedirectToAction("Index", new { Message = ManageMessageId.Error }); - } - var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); - if (user != null) - { - await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); - } - return RedirectToAction("Index", new { Message = ManageMessageId.RemovePhoneSuccess }); - } - - // - // GET: /Manage/ChangePassword - public ActionResult ChangePassword() - { - return View(); - } - - // - // POST: /Manage/ChangePassword - [HttpPost] - [ValidateAntiForgeryToken] - public async Task ChangePassword(ChangePasswordViewModel model) - { - if (!ModelState.IsValid) - { - return View(model); - } - var result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword); - if (result.Succeeded) - { - var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); - if (user != null) - { - await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); - } - return RedirectToAction("Index", new { Message = ManageMessageId.ChangePasswordSuccess }); - } - AddErrors(result); - return View(model); - } - - // - // GET: /Manage/SetPassword - public ActionResult SetPassword() - { - return View(); - } - - // - // POST: /Manage/SetPassword - [HttpPost] - [ValidateAntiForgeryToken] - public async Task SetPassword(SetPasswordViewModel model) - { - if (ModelState.IsValid) - { - var result = await UserManager.AddPasswordAsync(User.Identity.GetUserId(), model.NewPassword); - if (result.Succeeded) - { - var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); - if (user != null) - { - await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); - } - return RedirectToAction("Index", new { Message = ManageMessageId.SetPasswordSuccess }); - } - AddErrors(result); - } - - // 如果執行到這裡,發生某項失敗,則重新顯示表單 - return View(model); - } - - // - // GET: /Manage/ManageLogins - public async Task ManageLogins(ManageMessageId? message) - { - ViewBag.StatusMessage = - message == ManageMessageId.RemoveLoginSuccess ? "已移除外部登入。" - : message == ManageMessageId.Error ? "發生錯誤。" - : ""; - var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); - if (user == null) - { - return View("Error"); - } - var userLogins = await UserManager.GetLoginsAsync(User.Identity.GetUserId()); - var otherLogins = AuthenticationManager.GetExternalAuthenticationTypes().Where(auth => userLogins.All(ul => auth.AuthenticationType != ul.LoginProvider)).ToList(); - ViewBag.ShowRemoveButton = user.PasswordHash != null || userLogins.Count > 1; - return View(new ManageLoginsViewModel - { - CurrentLogins = userLogins, - OtherLogins = otherLogins - }); - } - - // - // POST: /Manage/LinkLogin - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult LinkLogin(string provider) - { - // 要求重新導向至外部登入提供者,以連結目前使用者的登入 - return new AccountController.ChallengeResult(provider, Url.Action("LinkLoginCallback", "Manage"), User.Identity.GetUserId()); - } - - // - // GET: /Manage/LinkLoginCallback - public async Task LinkLoginCallback() - { - var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(XsrfKey, User.Identity.GetUserId()); - if (loginInfo == null) - { - return RedirectToAction("ManageLogins", new { Message = ManageMessageId.Error }); - } - var result = await UserManager.AddLoginAsync(User.Identity.GetUserId(), loginInfo.Login); - return result.Succeeded ? RedirectToAction("ManageLogins") : RedirectToAction("ManageLogins", new { Message = ManageMessageId.Error }); - } - - protected override void Dispose(bool disposing) - { - if (disposing && _userManager != null) - { - _userManager.Dispose(); - _userManager = null; - } - - base.Dispose(disposing); - } - -#region Helper - // 新增外部登入時用來當做 XSRF 保護 - private const string XsrfKey = "XsrfId"; - - private IAuthenticationManager AuthenticationManager - { - get - { - return HttpContext.GetOwinContext().Authentication; - } - } - - private void AddErrors(IdentityResult result) - { - foreach (var error in result.Errors) - { - ModelState.AddModelError("", error); - } - } - - private bool HasPassword() - { - var user = UserManager.FindById(User.Identity.GetUserId()); - if (user != null) - { - return user.PasswordHash != null; - } - return false; - } - - private bool HasPhoneNumber() - { - var user = UserManager.FindById(User.Identity.GetUserId()); - if (user != null) - { - return user.PhoneNumber != null; - } - return false; - } - - public enum ManageMessageId - { - AddPhoneSuccess, - ChangePasswordSuccess, - SetTwoFactorSuccess, - SetPasswordSuccess, - RemoveLoginSuccess, - RemovePhoneSuccess, - Error - } - -#endregion - } -} \ No newline at end of file diff --git a/Chruch.Net/Controllers/NewVisitorController.cs b/Chruch.Net/Controllers/NewVisitorController.cs index 3b46f2c..4bf10e4 100644 --- a/Chruch.Net/Controllers/NewVisitorController.cs +++ b/Chruch.Net/Controllers/NewVisitorController.cs @@ -6,109 +6,15 @@ using System.Linq; using System.Web; using System.Web.Mvc; using Chruch.Net.Models; -using Church.Net.DAL.EF; -using Church.Net.Entity; namespace Chruch.Net.Controllers { - public class NewVisitorController : _BaseController + public class NewVisitorController :Controller { - private ChurchNetContext db = new ChurchNetContext(); // GET: NewVisitor - public ActionResult Index(Church.Net.Entity.NewVisitor model) + public ActionResult Index() { - ViewBag.ReligionId = new SelectList(db.Religions, "ReligionId", "Name"); - model.Gender = Enumeration.Gender.Male; - return View(model); - } - - public ActionResult Registration(Church.Net.Entity.NewVisitor model) - { - - if (model != null) - { - model.Id = Church.Net.Utility.Format.Get33BaseGuid(); - model.VisitingDate=DateTime.Now; - ModelState.Clear(); - TryValidateModel(model); - //ValidateModel(dNSServer); - } - if (ModelState.IsValid) - { - - var file = HttpContext.Request.Files["AttachFile"]; - bool hasFile = file != null && !string.IsNullOrEmpty(file.FileName); - - - string filePath = Server.MapPath("~/NewVisitorsPics/"); - //string newFileName = hasFile ? $"{model.Id}{file.FileName.Substring(file.FileName.LastIndexOf("."))}" : ""; - string newFileName = hasFile ? $"{model.Id}.jpg" : ""; - Directory.CreateDirectory(filePath); - - try - { - - var logic = new Church.Net.BLL.NewVisitorBLL(this.ConnString); - logic.Add(model); - - - if (hasFile) - { - Church.Net.Utility.Image.SaveThumbnail(new Bitmap(file.InputStream), - filePath + "\\" + newFileName, 1920, 1080); - - //file.SaveAs(filePath + "\\" + newFileName); - - } - ShowScriptMsg("一次歡迎,永遠歡迎!",MessageType.Success); - } - catch (Exception e) - { - ShowMsgByEx(e); - } - - } - - - return RedirectToAction("Index"); - // return View(model); - } - [HttpGet] - public ActionResult Slider() - { - NewVisitorViewClass model = new NewVisitorViewClass() - { - BeginDate = DateTime.Today, - EndDate = DateTime.Today - }; - return View("ImageTextSliderChooseDate", model); - } - [HttpPost] - public ActionResult Slider(NewVisitorViewClass model) - { - DateTime beginDate = DateTime.Today; - DateTime endDate = DateTime.Today.AddDays(1); - beginDate = model.BeginDate; - endDate = model.EndDate.AddDays(1); - var list = new Church.Net.BLL.NewVisitorBLL(this.ConnString).GetAll(visitor => - visitor.VisitingDate >= beginDate && visitor.VisitingDate <= endDate); - return View(list); - } - public ActionResult Today() - { - DateTime beginDate = DateTime.Today; - DateTime endDate = DateTime.Today.AddDays(1); - var list = new Church.Net.BLL.NewVisitorBLL(this.ConnString).GetAll(visitor => - visitor.VisitingDate >= beginDate && visitor.VisitingDate <= endDate); - return View("Slider", list); - } - protected override void Dispose(bool disposing) - { - if (disposing) - { - db.Dispose(); - } - base.Dispose(disposing); + return View(); } } } \ No newline at end of file diff --git a/Chruch.Net/Controllers/Register2019Controller.cs b/Chruch.Net/Controllers/Register2019Controller.cs deleted file mode 100644 index 7387f26..0000000 --- a/Chruch.Net/Controllers/Register2019Controller.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; - -namespace Chruch.Net.Controllers -{ - public class Register2019Controller : Controller - { - // GET: Register2018 - public ActionResult Index(string id) - { - if (id=="EN") - { - return View(); - - } - else - { - return View("IndexCn"); - - } - } - } -} \ No newline at end of file diff --git a/Chruch.Net/Controllers/_BaseController.cs b/Chruch.Net/Controllers/_BaseController.cs deleted file mode 100644 index b70b113..0000000 --- a/Chruch.Net/Controllers/_BaseController.cs +++ /dev/null @@ -1,196 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Web; -using System.Web.Mvc; - -namespace Chruch.Net.Controllers -{ - public class _BaseController : Controller - { - - #region 列舉行別宣告 - protected enum MessageType - { - Warring, - Done, - Success, - Errors, - None - } - protected enum CRUDType - { - None, - Processing, - Create, - Update, - Delete - } - protected enum Active - { - Processing, - Reading, - Adding, - Editing - } - - #endregion - - private string ResultMessage - { - get - { - if (System.Web.HttpContext.Current.Session["ResultMessage"] != null) - { - return System.Web.HttpContext.Current.Session["ResultMessage"].ToString(); - } - return ""; - } - set - { - System.Web.HttpContext.Current.Session["ResultMessage"] = value; - } - } - protected string ConnString - { - get - { - if (System.Web.HttpContext.Current.Session["ConnString"] != null) - { - return System.Web.HttpContext.Current.Session["ConnString"].ToString(); - } - ConnString= System.Configuration.ConfigurationManager.ConnectionStrings["entityFramework"].ConnectionString; - return ConnString; - } - set - { - System.Web.HttpContext.Current.Session["ConnString"] = value; - } - } - - protected override void OnActionExecuted(ActionExecutedContext filterContext) - { - if (!filterContext.HttpContext.Request.IsAjaxRequest()) - { - var response = filterContext.HttpContext.Response; - if (response.ContentType == "text/html" && - !(filterContext.Result is RedirectToRouteResult) && - !(filterContext.Result is RedirectResult)) - { - if (!string.IsNullOrEmpty(ResultMessage)) - { - ViewBag.StartScript = ResultMessage; - ResultMessage = ""; - } - - - } - } - } - #region MessageBox - - - protected void ShowScriptMsg(string description, MessageType MsType = MessageType.None) - { - ShowScriptMsg(description, "", MsType); - } - - protected void ShowScriptMsg(string descritpion, string title, MessageType MsType = MessageType.None) - { - StringBuilder stringBuilder = new StringBuilder(); - title = title.Replace(Environment.NewLine, "
").Replace("'", "\""); - descritpion = descritpion.Replace(Environment.NewLine, "
").Replace("'", "\""); - stringBuilder.AppendLine(" swal({ "); - if (!string.IsNullOrWhiteSpace(descritpion)) - { - stringBuilder.AppendLine($" html: '{descritpion}', "); - } - switch (MsType) - { - case MessageType.Success: - stringBuilder.AppendLine($" title: '{title} {LanHelper.GetText("Success")}', "); - stringBuilder.AppendLine(" type: \"success\" "); - break; - case MessageType.Warring: - stringBuilder.AppendLine($" title: '{title} {LanHelper.GetText("Warning")}', "); - stringBuilder.AppendLine(" type: \"warning\" "); - break; - case MessageType.Errors: - stringBuilder.AppendLine($" title: '{title} {LanHelper.GetText("Fail")}', "); - stringBuilder.AppendLine(" type: \"error\" "); - break; - case MessageType.Done: - stringBuilder.AppendLine($" title: '{title} {LanHelper.GetText("Done")}', "); - stringBuilder.AppendLine(" type: \"success\" "); - break; - default: - break; - } - stringBuilder.AppendLine("}); "); - - ResultMessage = stringBuilder.ToString(); - } - protected void ShowScriptMsgAndRedirect(string descritpion, string url, MessageType MsType = MessageType.None) - { - ShowScriptMsgAndRedirect(descritpion, "", url, MsType); - - } - - protected void ShowScriptMsgAndRedirect(string descritpion, string title, string url, MessageType MsType = MessageType.None) - { - StringBuilder stringBuilder = new StringBuilder(); - title = title.Replace(Environment.NewLine, "
").Replace("'", "\""); - descritpion = descritpion.Replace(Environment.NewLine, "
").Replace("'", "\""); - stringBuilder.AppendLine(" swal({ "); - if (!string.IsNullOrWhiteSpace(descritpion)) - { - stringBuilder.AppendLine($" html: '{descritpion}', "); - } - switch (MsType) - { - case MessageType.Success: - - stringBuilder.AppendLine($" title: \"{title} {LanHelper.GetText("Success")}\", "); - stringBuilder.AppendLine(" type: \"success\" "); - break; - case MessageType.Warring: - stringBuilder.AppendLine($" title: \"{title} {LanHelper.GetText("Warning")}\", "); - stringBuilder.AppendLine(" type: \"warning\" "); - break; - case MessageType.Errors: - stringBuilder.AppendLine($" title: \"{title} {LanHelper.GetText("Fail")}\", "); - stringBuilder.AppendLine(" type: \"error\" "); - break; - case MessageType.Done: - stringBuilder.AppendLine($" title: \"{title} {LanHelper.GetText("Done")}\", "); - stringBuilder.AppendLine(" type: \"success\" "); - break; - default: - break; - } - stringBuilder.Append("}).then(function () {"); - stringBuilder.Append("$.ShowP;"); - stringBuilder.Append($"window.location.href = '{url}';"); - stringBuilder.Append("});"); - ResultMessage = stringBuilder.ToString(); - - } - - protected void ShowMsgByEx(Exception ex) - { - if (ex.GetType() == typeof(ArgumentException)) - { - - ShowScriptMsg(LanHelper.GetText(ex.Message), "", MessageType.Warring); - } - else - { - ShowScriptMsg(ex.Message, "", MessageType.Errors); - } - } - - - #endregion - } -} \ No newline at end of file diff --git a/Chruch.Net/Global.asax.cs b/Chruch.Net/Global.asax.cs index c1517ad..7f7568b 100644 --- a/Chruch.Net/Global.asax.cs +++ b/Chruch.Net/Global.asax.cs @@ -6,9 +6,6 @@ using System.Web.Http; using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; -using Church.Net.DAL.EF; -using Church.Net.Entity; - namespace Chruch.Net { public class MvcApplication : System.Web.HttpApplication diff --git a/Chruch.Net/Views/NewVisitor/Index.cshtml b/Chruch.Net/Views/NewVisitor/Index.cshtml index 83035c5..aa86c35 100644 --- a/Chruch.Net/Views/NewVisitor/Index.cshtml +++ b/Chruch.Net/Views/NewVisitor/Index.cshtml @@ -1,4 +1,4 @@ -@model Church.Net.Entity.NewVisitor + @{ Layout = null; } @@ -18,7 +18,7 @@ - 歡迎新朋友 + New @@ -33,7 +33,7 @@
-

新生命靈糧堂-亞凱迪亞

+

LOGO Here

@@ -44,66 +44,32 @@ @using (Html.BeginForm("Registration", "NewVisitor", FormMethod.Post, new { enctype = "multipart/form-data" })) { @Html.AntiForgeryToken() -

歡迎新朋友

+

Weclome Text

- @Html.ValidationMessageFor(c => c.LastName) - @Html.TextBoxFor(c => c.LastName, new + + @*@Html.ValidationMessageFor(c => c) + @Html.TextBoxFor(c => c, new { placeholder = "請輸入您的姓氏" - }) + })*@

- @Html.ValidationMessageFor(c => c.FirstName) - @Html.TextBoxFor(c => c.FirstName, new - { - placeholder = "請輸入您的名字" - }) -

-

- -
-
- @Html.RadioButtonFor(c => c.Gender, Church.Net.Entity.Enumeration.Gender.Male)@Html.Label("弟兄") - @Html.RadioButtonFor(c => c.Gender, Church.Net.Entity.Enumeration.Gender.Female)@Html.Label("姊妹") -

-

- - @Html.ValidationMessageFor(c => c.Phone) - @Html.TextBoxFor(c => c.Phone, new { placeholder = "請輸入您的聯繫電話" }) -

-

- - @Html.ValidationMessageFor(c => c.Email) - @Html.TextBoxFor(c => c.Email, new { placeholder = "請輸入您的聯繫Email" }) -

- -

- - @Html.ValidationMessageFor(c => c.Note) - @Html.TextBoxFor(c => c.Note, new { placeholder = "請輸入您的來訪原因" }) -

-

- - @Html.ValidationMessageFor(c => c.ComunityAppId) - @Html.TextBoxFor(c => c.ComunityAppId, new { placeholder = "請輸入您的通信軟體 Id ex:WeChat,Line" }) -

-

- - @Html.DropDownList("ReligionId", null, htmlAttributes: new { @class = "w-100 u-select-v2 u-shadow-v19 g-brd-none g-color-black g-color-primary--hover g-bg-white text-left g-rounded-30 g-pl-30 g-py-12" }) -

-

- - @Html.TextBox("AttachFile", "", new { @class = "form-control-file", type = "file", accept = "image/*;capture=camera" }) + + @*@Html.ValidationMessageFor(c => c) + @Html.TextBoxFor(c => c, new + { + placeholder = "請輸入您的名字" + })*@

} diff --git a/Church.Net.DAL.EFCoreDBF/ChurchNetContext.cs b/Church.Net.DAL.EFCoreDBF/ChurchNetContext.cs index 1e2cc07..7ba455b 100644 --- a/Church.Net.DAL.EFCoreDBF/ChurchNetContext.cs +++ b/Church.Net.DAL.EFCoreDBF/ChurchNetContext.cs @@ -136,7 +136,11 @@ namespace Church.Net.DAL.EF public DbSet AddressInfos { get; set; } public DbSet LineMessageClients { get; set; } public DbSet LineMessagingAccounts { get; set; } + + public DbSet Contributions { get; set; } + public DbSet HappinessCosts { get; set; } + #endregion diff --git a/Church.Net.DAL.EFCoreDBF/CombinedKeyCrudDALCBase - Copy.cs b/Church.Net.DAL.EFCoreDBF/CombinedKeyCrudDALCBase - Copy.cs index 434d3ff..2a50922 100644 --- a/Church.Net.DAL.EFCoreDBF/CombinedKeyCrudDALCBase - Copy.cs +++ b/Church.Net.DAL.EFCoreDBF/CombinedKeyCrudDALCBase - Copy.cs @@ -204,6 +204,11 @@ namespace Church.Net.DAL.EFCoreDBF { throw new NotImplementedException(); } + + public IEnumerable GetAllById(IEnumerable Ids) + { + throw new NotImplementedException(); + } } diff --git a/Church.Net.DAL.EFCoreDBF/CombinedKeyCrudDALCBase.cs b/Church.Net.DAL.EFCoreDBF/CombinedKeyCrudDALCBase.cs index 798ea7b..c5fa1fd 100644 --- a/Church.Net.DAL.EFCoreDBF/CombinedKeyCrudDALCBase.cs +++ b/Church.Net.DAL.EFCoreDBF/CombinedKeyCrudDALCBase.cs @@ -65,6 +65,14 @@ namespace Church.Net.DAL.EFCoreDBF return GetDbSet().AsNoTracking().Where(filter ?? (s => true)).ToList(); } + public virtual IQueryable GetQuery(Func filter = null) + { + //var dbObjs = GetDbSet().ToArray(); + + //IEnumerable list = GetDbSet().Where(filter ?? (s => true)).ToList(); + + return GetDbSet().AsNoTracking().Where(filter ?? (s => true)).AsQueryable(); + } public virtual int Create(T entity) { diff --git a/Church.Net.DAL.EFCoreDBF/CrudDALCBase.cs b/Church.Net.DAL.EFCoreDBF/CrudDALCBase.cs index 11a279a..1cc6a3a 100644 --- a/Church.Net.DAL.EFCoreDBF/CrudDALCBase.cs +++ b/Church.Net.DAL.EFCoreDBF/CrudDALCBase.cs @@ -241,10 +241,12 @@ namespace Church.Net.DAL.EFCoreDBF DateTime localTime = ((DateTime)prop.GetValue(entity)); if (localTime.Kind != DateTimeKind.Utc) { - //localTime= DateTime.SpecifyKind(localTime, DateTimeKind.Local); localTime = new DateTime(localTime.Year, localTime.Month, localTime.Day, - localTime.Hour, localTime.Minute, localTime.Second, localTime.Millisecond); + localTime.Hour, localTime.Minute, localTime.Second, + localTime.Millisecond, DateTimeKind.Local); } + var offset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); + var OutputTime = DateTime.SpecifyKind(localTime - offset, DateTimeKind.Utc); DateTime utcTime = localTime.ToUniversalTime(); prop.SetValue(entity, utcTime, null); diff --git a/Church.Net.DAL.EFCoreDBF/ICrudDAL.cs b/Church.Net.DAL.EFCoreDBF/ICrudDAL.cs index 3d46f94..d25fba9 100644 --- a/Church.Net.DAL.EFCoreDBF/ICrudDAL.cs +++ b/Church.Net.DAL.EFCoreDBF/ICrudDAL.cs @@ -31,6 +31,7 @@ namespace Church.Net.DAL.EFCoreDBF int Delete(Func filter); bool CheckExist(T obj); + IEnumerable GetAllById(IEnumerable Ids); } @@ -55,5 +56,6 @@ namespace Church.Net.DAL.EFCoreDBF int Delete(Func filter); bool CheckExist(T obj); + IQueryable GetQuery(Func filter = null); } } diff --git a/Church.Net.DAL.EFCoreDBF/Migrations/20221012223219_AddCost.Designer.cs b/Church.Net.DAL.EFCoreDBF/Migrations/20221012223219_AddCost.Designer.cs new file mode 100644 index 0000000..6d4eddb --- /dev/null +++ b/Church.Net.DAL.EFCoreDBF/Migrations/20221012223219_AddCost.Designer.cs @@ -0,0 +1,910 @@ +// +using System; +using Church.Net.DAL.EF; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Church.Net.DAL.EFCoreDBF.Migrations +{ + [DbContext(typeof(ChurchNetContext))] + [Migration("20221012223219_AddCost")] + partial class AddCost + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Church.Net.Entity.AddressInfo", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("City") + .HasColumnType("text"); + + b.Property("State") + .HasColumnType("text"); + + b.Property("Zip") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("AddressInfos"); + }); + + modelBuilder.Entity("Church.Net.Entity.AutoReplyItem", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Command") + .HasColumnType("text"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("AutoReplyItems"); + }); + + modelBuilder.Entity("Church.Net.Entity.Career", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.HasKey("Id"); + + b.ToTable("Careers"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("PastoralDomainId") + .HasColumnType("text"); + + b.Property("Time") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("PastoralDomainId"); + + b.ToTable("CellGroupRoutineEvents"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventAttendee", b => + { + b.Property("EventId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("Id") + .HasColumnType("text") + .HasColumnOrder(1); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("JoinPotluck") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("PotluckItem") + .HasColumnType("text"); + + b.HasKey("EventId", "Id"); + + b.ToTable("CellGroupRoutineEventAttendees"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventPrayer", b => + { + b.Property("EventId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("MemberId") + .HasColumnType("text") + .HasColumnOrder(1); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("Prayer") + .HasColumnType("text"); + + b.HasKey("EventId", "MemberId"); + + b.ToTable("CellGroupRoutineEventPrayers"); + }); + + modelBuilder.Entity("Church.Net.Entity.Contribution", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Amount") + .HasColumnType("numeric"); + + b.Property("Contributor") + .HasColumnType("text"); + + b.Property("GroupId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GroupId"); + + b.ToTable("Contributions"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMember", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("AvatarImage") + .HasColumnType("text"); + + b.Property("Baptized") + .HasColumnType("boolean"); + + b.Property("Birthday") + .HasColumnType("timestamp with time zone"); + + b.Property("CareerId") + .HasColumnType("text"); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("ComunityAppId") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("DateOfBaptized") + .HasColumnType("timestamp with time zone"); + + b.Property("DateOfWalkIn") + .HasColumnType("timestamp with time zone"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("FirstName") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastName") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Married") + .HasColumnType("boolean"); + + b.Property("Password") + .HasColumnType("text"); + + b.Property("Role") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CareerId"); + + b.ToTable("FamilyMembers"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMemberOAuth", b => + { + b.Property("FamilyMemberId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("OAuthType") + .HasColumnType("text") + .HasColumnOrder(1); + + b.Property("OAuthAccessToken") + .HasColumnType("text"); + + b.HasKey("FamilyMemberId", "OAuthType"); + + b.ToTable("FamilyMemberOAuths"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessBEST", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("GroupId") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Phone") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GroupId"); + + b.ToTable("HappinessBESTs"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessCost", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Amount") + .HasColumnType("numeric"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("Tasker") + .HasColumnType("text"); + + b.Property("WeekId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("WeekId"); + + b.ToTable("HappinessCosts"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessTask", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("Tasker") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("WeekId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("WeekId"); + + b.ToTable("HappinessTask"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("CityAndZipCode") + .HasColumnType("text"); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("Date") + .HasColumnType("timestamp with time zone"); + + b.Property("GroupId") + .HasColumnType("text"); + + b.Property("InvitationText") + .HasColumnType("text"); + + b.Property("SEQ") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GroupId"); + + b.ToTable("HappinessWeeks"); + }); + + modelBuilder.Entity("Church.Net.Entity.LineMessagingAccount", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ChatToken") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Seq") + .HasColumnType("integer"); + + b.Property("TotalUsage") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("LineMessagingAccounts"); + }); + + modelBuilder.Entity("Church.Net.Entity.LogInfo", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("DetailMessage") + .HasColumnType("text"); + + b.Property("Level") + .HasColumnType("integer"); + + b.Property("Message") + .HasColumnType("text"); + + b.Property("Source") + .HasColumnType("text"); + + b.Property("StackTrace") + .HasColumnType("text"); + + b.Property("Time") + .HasColumnType("timestamp with time zone"); + + b.Property("TrackNo") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TrackNo")); + + b.Property("Url") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("LogInfos"); + }); + + modelBuilder.Entity("Church.Net.Entity.Messenger.LineMessageClient", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ClientId") + .HasColumnType("text"); + + b.Property("IsGroup") + .HasColumnType("boolean"); + + b.Property("IsManager") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("LineMessageClients"); + }); + + modelBuilder.Entity("Church.Net.Entity.NewVisitor", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("BirthDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ComunityAppId") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Email") + .HasMaxLength(150) + .HasColumnType("character varying(150)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Note") + .HasColumnType("text"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("character varying(150)"); + + b.Property("ReligionId") + .HasColumnType("integer"); + + b.Property("VisitingDate") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("ReligionId"); + + b.ToTable("NewVisitors"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Image1") + .HasColumnType("text"); + + b.Property("Image2") + .HasColumnType("text"); + + b.Property("Image3") + .HasColumnType("text"); + + b.Property("Image4") + .HasColumnType("text"); + + b.Property("Image5") + .HasColumnType("text"); + + b.Property("LeaderMemberId") + .HasColumnType("text"); + + b.Property("LineAccountId") + .HasColumnType("text"); + + b.Property("LineGroupId") + .HasColumnType("text"); + + b.Property("LogoImage") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ServiceAddressId") + .HasColumnType("text"); + + b.Property("ServiceTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("LeaderMemberId"); + + b.HasIndex("LineAccountId"); + + b.HasIndex("ServiceAddressId"); + + b.ToTable("PastoralDomains"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomainAutoReplys", b => + { + b.Property("PastoralDomainCommunityAppId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("AutoReplyItemId") + .HasColumnType("text") + .HasColumnOrder(1); + + b.HasKey("PastoralDomainCommunityAppId", "AutoReplyItemId"); + + b.HasIndex("AutoReplyItemId"); + + b.ToTable("PastoralDomainAutoReplys"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomainMembers", b => + { + b.Property("PastoralDomainId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("FamilyMemberId") + .HasColumnType("text") + .HasColumnOrder(1); + + b.HasKey("PastoralDomainId", "FamilyMemberId"); + + b.HasIndex("FamilyMemberId"); + + b.ToTable("PastoralDomainMembers"); + }); + + modelBuilder.Entity("Church.Net.Entity.Religion", b => + { + b.Property("ReligionId") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReligionId")); + + b.Property("Name") + .HasColumnType("text"); + + b.HasKey("ReligionId"); + + b.ToTable("Religions"); + }); + + modelBuilder.Entity("Church.Net.Entity.Vocabulary", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DefinitionCh") + .IsRequired() + .HasColumnType("text"); + + b.Property("DefinitionEn") + .IsRequired() + .HasColumnType("text"); + + b.Property("FlashCardTimes") + .HasColumnType("integer"); + + b.Property("ImagesUrl") + .HasColumnType("text"); + + b.Property("InsertDate") + .HasColumnType("timestamp with time zone"); + + b.Property("NounPlural") + .HasColumnType("text"); + + b.Property("PartOfSpeech") + .HasColumnType("integer"); + + b.Property("PracticeApply") + .HasColumnType("boolean"); + + b.Property("PracticeDate") + .HasColumnType("timestamp with time zone"); + + b.Property("PracticeMemorized") + .HasColumnType("boolean"); + + b.Property("PracticeReview") + .HasColumnType("boolean"); + + b.Property("PracticeSelect") + .HasColumnType("boolean"); + + b.Property("PracticeSentence") + .HasColumnType("text"); + + b.Property("PracticeStage") + .HasColumnType("integer"); + + b.Property("PracticeVisualize") + .HasColumnType("boolean"); + + b.Property("VerbParticiple") + .HasColumnType("text"); + + b.Property("VerbPast") + .HasColumnType("text"); + + b.Property("Word") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Vocabulary"); + }); + + modelBuilder.Entity("Church.Net.Entity.WhoIsSpy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Answer1Chs") + .HasColumnType("text"); + + b.Property("Answer1Cht") + .HasColumnType("text"); + + b.Property("Answer1En") + .HasColumnType("text"); + + b.Property("Answer2Chs") + .HasColumnType("text"); + + b.Property("Answer2Cht") + .HasColumnType("text"); + + b.Property("Answer2En") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("WhoIsSpy"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b => + { + b.HasOne("Church.Net.Entity.PastoralDomain", "CellGroupInfo") + .WithMany() + .HasForeignKey("PastoralDomainId"); + + b.Navigation("CellGroupInfo"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventAttendee", b => + { + b.HasOne("Church.Net.Entity.CellGroupRoutineEvent", "CellGroupRoutineEvent") + .WithMany("Attendees") + .HasForeignKey("EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CellGroupRoutineEvent"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventPrayer", b => + { + b.HasOne("Church.Net.Entity.CellGroupRoutineEvent", "CellGroupRoutineEvent") + .WithMany("Prayers") + .HasForeignKey("EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CellGroupRoutineEvent"); + }); + + modelBuilder.Entity("Church.Net.Entity.Contribution", b => + { + b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup") + .WithMany("Contributions") + .HasForeignKey("GroupId"); + + b.Navigation("HappinessGroup"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMember", b => + { + b.HasOne("Church.Net.Entity.Career", "Career") + .WithMany() + .HasForeignKey("CareerId"); + + b.Navigation("Career"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMemberOAuth", b => + { + b.HasOne("Church.Net.Entity.FamilyMember", null) + .WithMany("OAuthInfos") + .HasForeignKey("FamilyMemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessBEST", b => + { + b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup") + .WithMany("Bests") + .HasForeignKey("GroupId"); + + b.Navigation("HappinessGroup"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessCost", b => + { + b.HasOne("Church.Net.Entity.HappinessWeek", "HappinessWeek") + .WithMany("Costs") + .HasForeignKey("WeekId"); + + b.Navigation("HappinessWeek"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessTask", b => + { + b.HasOne("Church.Net.Entity.HappinessWeek", "HappinessWeek") + .WithMany("Tasks") + .HasForeignKey("WeekId"); + + b.Navigation("HappinessWeek"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b => + { + b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup") + .WithMany("HappinessWeeks") + .HasForeignKey("GroupId"); + + b.Navigation("HappinessGroup"); + }); + + modelBuilder.Entity("Church.Net.Entity.NewVisitor", b => + { + b.HasOne("Church.Net.Entity.Religion", "Religion") + .WithMany() + .HasForeignKey("ReligionId"); + + b.Navigation("Religion"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b => + { + b.HasOne("Church.Net.Entity.FamilyMember", "Leader") + .WithMany() + .HasForeignKey("LeaderMemberId"); + + b.HasOne("Church.Net.Entity.LineMessagingAccount", "LineMessagingAccount") + .WithMany() + .HasForeignKey("LineAccountId"); + + b.HasOne("Church.Net.Entity.AddressInfo", "ServiceAddress") + .WithMany() + .HasForeignKey("ServiceAddressId"); + + b.Navigation("Leader"); + + b.Navigation("LineMessagingAccount"); + + b.Navigation("ServiceAddress"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomainAutoReplys", b => + { + b.HasOne("Church.Net.Entity.AutoReplyItem", "FamilyMember") + .WithMany("AutoReplyItemRelations") + .HasForeignKey("AutoReplyItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Church.Net.Entity.PastoralDomain", "PastoralDomain") + .WithMany("AutoReplyItemRelations") + .HasForeignKey("PastoralDomainCommunityAppId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FamilyMember"); + + b.Navigation("PastoralDomain"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomainMembers", b => + { + b.HasOne("Church.Net.Entity.FamilyMember", "FamilyMember") + .WithMany("PastoralDomains") + .HasForeignKey("FamilyMemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Church.Net.Entity.PastoralDomain", "PastoralDomain") + .WithMany("Members") + .HasForeignKey("PastoralDomainId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FamilyMember"); + + b.Navigation("PastoralDomain"); + }); + + modelBuilder.Entity("Church.Net.Entity.AutoReplyItem", b => + { + b.Navigation("AutoReplyItemRelations"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b => + { + b.Navigation("Attendees"); + + b.Navigation("Prayers"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMember", b => + { + b.Navigation("OAuthInfos"); + + b.Navigation("PastoralDomains"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b => + { + b.Navigation("Costs"); + + b.Navigation("Tasks"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b => + { + b.Navigation("AutoReplyItemRelations"); + + b.Navigation("Bests"); + + b.Navigation("Contributions"); + + b.Navigation("HappinessWeeks"); + + b.Navigation("Members"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Church.Net.DAL.EFCoreDBF/Migrations/20221012223219_AddCost.cs b/Church.Net.DAL.EFCoreDBF/Migrations/20221012223219_AddCost.cs new file mode 100644 index 0000000..aac3e4b --- /dev/null +++ b/Church.Net.DAL.EFCoreDBF/Migrations/20221012223219_AddCost.cs @@ -0,0 +1,70 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Church.Net.DAL.EFCoreDBF.Migrations +{ + public partial class AddCost : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Contributions", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + GroupId = table.Column(type: "text", nullable: true), + Contributor = table.Column(type: "text", nullable: true), + Amount = table.Column(type: "numeric", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Contributions", x => x.Id); + table.ForeignKey( + name: "FK_Contributions_PastoralDomains_GroupId", + column: x => x.GroupId, + principalTable: "PastoralDomains", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "HappinessCosts", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + WeekId = table.Column(type: "text", nullable: true), + Tasker = table.Column(type: "text", nullable: true), + Content = table.Column(type: "text", nullable: true), + Amount = table.Column(type: "numeric", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_HappinessCosts", x => x.Id); + table.ForeignKey( + name: "FK_HappinessCosts_HappinessWeeks_WeekId", + column: x => x.WeekId, + principalTable: "HappinessWeeks", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_Contributions_GroupId", + table: "Contributions", + column: "GroupId"); + + migrationBuilder.CreateIndex( + name: "IX_HappinessCosts_WeekId", + table: "HappinessCosts", + column: "WeekId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Contributions"); + + migrationBuilder.DropTable( + name: "HappinessCosts"); + } + } +} diff --git a/Church.Net.DAL.EFCoreDBF/Migrations/20221017002753_AddTimeToContribution.Designer.cs b/Church.Net.DAL.EFCoreDBF/Migrations/20221017002753_AddTimeToContribution.Designer.cs new file mode 100644 index 0000000..b66ad8e --- /dev/null +++ b/Church.Net.DAL.EFCoreDBF/Migrations/20221017002753_AddTimeToContribution.Designer.cs @@ -0,0 +1,916 @@ +// +using System; +using Church.Net.DAL.EF; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Church.Net.DAL.EFCoreDBF.Migrations +{ + [DbContext(typeof(ChurchNetContext))] + [Migration("20221017002753_AddTimeToContribution")] + partial class AddTimeToContribution + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Church.Net.Entity.AddressInfo", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("City") + .HasColumnType("text"); + + b.Property("State") + .HasColumnType("text"); + + b.Property("Zip") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("AddressInfos"); + }); + + modelBuilder.Entity("Church.Net.Entity.AutoReplyItem", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Command") + .HasColumnType("text"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("AutoReplyItems"); + }); + + modelBuilder.Entity("Church.Net.Entity.Career", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.HasKey("Id"); + + b.ToTable("Careers"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("PastoralDomainId") + .HasColumnType("text"); + + b.Property("Time") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("PastoralDomainId"); + + b.ToTable("CellGroupRoutineEvents"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventAttendee", b => + { + b.Property("EventId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("Id") + .HasColumnType("text") + .HasColumnOrder(1); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("JoinPotluck") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("PotluckItem") + .HasColumnType("text"); + + b.HasKey("EventId", "Id"); + + b.ToTable("CellGroupRoutineEventAttendees"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventPrayer", b => + { + b.Property("EventId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("MemberId") + .HasColumnType("text") + .HasColumnOrder(1); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("Prayer") + .HasColumnType("text"); + + b.HasKey("EventId", "MemberId"); + + b.ToTable("CellGroupRoutineEventPrayers"); + }); + + modelBuilder.Entity("Church.Net.Entity.Contribution", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Amount") + .HasColumnType("numeric"); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("Contributor") + .HasColumnType("text"); + + b.Property("GroupId") + .HasColumnType("text"); + + b.Property("Time") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("GroupId"); + + b.ToTable("Contributions"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMember", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("AvatarImage") + .HasColumnType("text"); + + b.Property("Baptized") + .HasColumnType("boolean"); + + b.Property("Birthday") + .HasColumnType("timestamp with time zone"); + + b.Property("CareerId") + .HasColumnType("text"); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("ComunityAppId") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("DateOfBaptized") + .HasColumnType("timestamp with time zone"); + + b.Property("DateOfWalkIn") + .HasColumnType("timestamp with time zone"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("FirstName") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastName") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Married") + .HasColumnType("boolean"); + + b.Property("Password") + .HasColumnType("text"); + + b.Property("Role") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CareerId"); + + b.ToTable("FamilyMembers"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMemberOAuth", b => + { + b.Property("FamilyMemberId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("OAuthType") + .HasColumnType("text") + .HasColumnOrder(1); + + b.Property("OAuthAccessToken") + .HasColumnType("text"); + + b.HasKey("FamilyMemberId", "OAuthType"); + + b.ToTable("FamilyMemberOAuths"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessBEST", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("GroupId") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Phone") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GroupId"); + + b.ToTable("HappinessBESTs"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessCost", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Amount") + .HasColumnType("numeric"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("Tasker") + .HasColumnType("text"); + + b.Property("WeekId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("WeekId"); + + b.ToTable("HappinessCosts"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessTask", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("Tasker") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("WeekId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("WeekId"); + + b.ToTable("HappinessTask"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("CityAndZipCode") + .HasColumnType("text"); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("Date") + .HasColumnType("timestamp with time zone"); + + b.Property("GroupId") + .HasColumnType("text"); + + b.Property("InvitationText") + .HasColumnType("text"); + + b.Property("SEQ") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GroupId"); + + b.ToTable("HappinessWeeks"); + }); + + modelBuilder.Entity("Church.Net.Entity.LineMessagingAccount", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ChatToken") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Seq") + .HasColumnType("integer"); + + b.Property("TotalUsage") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("LineMessagingAccounts"); + }); + + modelBuilder.Entity("Church.Net.Entity.LogInfo", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("DetailMessage") + .HasColumnType("text"); + + b.Property("Level") + .HasColumnType("integer"); + + b.Property("Message") + .HasColumnType("text"); + + b.Property("Source") + .HasColumnType("text"); + + b.Property("StackTrace") + .HasColumnType("text"); + + b.Property("Time") + .HasColumnType("timestamp with time zone"); + + b.Property("TrackNo") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TrackNo")); + + b.Property("Url") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("LogInfos"); + }); + + modelBuilder.Entity("Church.Net.Entity.Messenger.LineMessageClient", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ClientId") + .HasColumnType("text"); + + b.Property("IsGroup") + .HasColumnType("boolean"); + + b.Property("IsManager") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("LineMessageClients"); + }); + + modelBuilder.Entity("Church.Net.Entity.NewVisitor", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("BirthDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ComunityAppId") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Email") + .HasMaxLength(150) + .HasColumnType("character varying(150)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Note") + .HasColumnType("text"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("character varying(150)"); + + b.Property("ReligionId") + .HasColumnType("integer"); + + b.Property("VisitingDate") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("ReligionId"); + + b.ToTable("NewVisitors"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Image1") + .HasColumnType("text"); + + b.Property("Image2") + .HasColumnType("text"); + + b.Property("Image3") + .HasColumnType("text"); + + b.Property("Image4") + .HasColumnType("text"); + + b.Property("Image5") + .HasColumnType("text"); + + b.Property("LeaderMemberId") + .HasColumnType("text"); + + b.Property("LineAccountId") + .HasColumnType("text"); + + b.Property("LineGroupId") + .HasColumnType("text"); + + b.Property("LogoImage") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ServiceAddressId") + .HasColumnType("text"); + + b.Property("ServiceTime") + .HasColumnType("timestamp with time zone"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("LeaderMemberId"); + + b.HasIndex("LineAccountId"); + + b.HasIndex("ServiceAddressId"); + + b.ToTable("PastoralDomains"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomainAutoReplys", b => + { + b.Property("PastoralDomainCommunityAppId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("AutoReplyItemId") + .HasColumnType("text") + .HasColumnOrder(1); + + b.HasKey("PastoralDomainCommunityAppId", "AutoReplyItemId"); + + b.HasIndex("AutoReplyItemId"); + + b.ToTable("PastoralDomainAutoReplys"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomainMembers", b => + { + b.Property("PastoralDomainId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("FamilyMemberId") + .HasColumnType("text") + .HasColumnOrder(1); + + b.HasKey("PastoralDomainId", "FamilyMemberId"); + + b.HasIndex("FamilyMemberId"); + + b.ToTable("PastoralDomainMembers"); + }); + + modelBuilder.Entity("Church.Net.Entity.Religion", b => + { + b.Property("ReligionId") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReligionId")); + + b.Property("Name") + .HasColumnType("text"); + + b.HasKey("ReligionId"); + + b.ToTable("Religions"); + }); + + modelBuilder.Entity("Church.Net.Entity.Vocabulary", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DefinitionCh") + .IsRequired() + .HasColumnType("text"); + + b.Property("DefinitionEn") + .IsRequired() + .HasColumnType("text"); + + b.Property("FlashCardTimes") + .HasColumnType("integer"); + + b.Property("ImagesUrl") + .HasColumnType("text"); + + b.Property("InsertDate") + .HasColumnType("timestamp with time zone"); + + b.Property("NounPlural") + .HasColumnType("text"); + + b.Property("PartOfSpeech") + .HasColumnType("integer"); + + b.Property("PracticeApply") + .HasColumnType("boolean"); + + b.Property("PracticeDate") + .HasColumnType("timestamp with time zone"); + + b.Property("PracticeMemorized") + .HasColumnType("boolean"); + + b.Property("PracticeReview") + .HasColumnType("boolean"); + + b.Property("PracticeSelect") + .HasColumnType("boolean"); + + b.Property("PracticeSentence") + .HasColumnType("text"); + + b.Property("PracticeStage") + .HasColumnType("integer"); + + b.Property("PracticeVisualize") + .HasColumnType("boolean"); + + b.Property("VerbParticiple") + .HasColumnType("text"); + + b.Property("VerbPast") + .HasColumnType("text"); + + b.Property("Word") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Vocabulary"); + }); + + modelBuilder.Entity("Church.Net.Entity.WhoIsSpy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Answer1Chs") + .HasColumnType("text"); + + b.Property("Answer1Cht") + .HasColumnType("text"); + + b.Property("Answer1En") + .HasColumnType("text"); + + b.Property("Answer2Chs") + .HasColumnType("text"); + + b.Property("Answer2Cht") + .HasColumnType("text"); + + b.Property("Answer2En") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("WhoIsSpy"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b => + { + b.HasOne("Church.Net.Entity.PastoralDomain", "CellGroupInfo") + .WithMany() + .HasForeignKey("PastoralDomainId"); + + b.Navigation("CellGroupInfo"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventAttendee", b => + { + b.HasOne("Church.Net.Entity.CellGroupRoutineEvent", "CellGroupRoutineEvent") + .WithMany("Attendees") + .HasForeignKey("EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CellGroupRoutineEvent"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventPrayer", b => + { + b.HasOne("Church.Net.Entity.CellGroupRoutineEvent", "CellGroupRoutineEvent") + .WithMany("Prayers") + .HasForeignKey("EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CellGroupRoutineEvent"); + }); + + modelBuilder.Entity("Church.Net.Entity.Contribution", b => + { + b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup") + .WithMany("Contributions") + .HasForeignKey("GroupId"); + + b.Navigation("HappinessGroup"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMember", b => + { + b.HasOne("Church.Net.Entity.Career", "Career") + .WithMany() + .HasForeignKey("CareerId"); + + b.Navigation("Career"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMemberOAuth", b => + { + b.HasOne("Church.Net.Entity.FamilyMember", null) + .WithMany("OAuthInfos") + .HasForeignKey("FamilyMemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessBEST", b => + { + b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup") + .WithMany("Bests") + .HasForeignKey("GroupId"); + + b.Navigation("HappinessGroup"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessCost", b => + { + b.HasOne("Church.Net.Entity.HappinessWeek", "HappinessWeek") + .WithMany("Costs") + .HasForeignKey("WeekId"); + + b.Navigation("HappinessWeek"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessTask", b => + { + b.HasOne("Church.Net.Entity.HappinessWeek", "HappinessWeek") + .WithMany("Tasks") + .HasForeignKey("WeekId"); + + b.Navigation("HappinessWeek"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b => + { + b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup") + .WithMany("HappinessWeeks") + .HasForeignKey("GroupId"); + + b.Navigation("HappinessGroup"); + }); + + modelBuilder.Entity("Church.Net.Entity.NewVisitor", b => + { + b.HasOne("Church.Net.Entity.Religion", "Religion") + .WithMany() + .HasForeignKey("ReligionId"); + + b.Navigation("Religion"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b => + { + b.HasOne("Church.Net.Entity.FamilyMember", "Leader") + .WithMany() + .HasForeignKey("LeaderMemberId"); + + b.HasOne("Church.Net.Entity.LineMessagingAccount", "LineMessagingAccount") + .WithMany() + .HasForeignKey("LineAccountId"); + + b.HasOne("Church.Net.Entity.AddressInfo", "ServiceAddress") + .WithMany() + .HasForeignKey("ServiceAddressId"); + + b.Navigation("Leader"); + + b.Navigation("LineMessagingAccount"); + + b.Navigation("ServiceAddress"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomainAutoReplys", b => + { + b.HasOne("Church.Net.Entity.AutoReplyItem", "FamilyMember") + .WithMany("AutoReplyItemRelations") + .HasForeignKey("AutoReplyItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Church.Net.Entity.PastoralDomain", "PastoralDomain") + .WithMany("AutoReplyItemRelations") + .HasForeignKey("PastoralDomainCommunityAppId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FamilyMember"); + + b.Navigation("PastoralDomain"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomainMembers", b => + { + b.HasOne("Church.Net.Entity.FamilyMember", "FamilyMember") + .WithMany("PastoralDomains") + .HasForeignKey("FamilyMemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Church.Net.Entity.PastoralDomain", "PastoralDomain") + .WithMany("Members") + .HasForeignKey("PastoralDomainId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FamilyMember"); + + b.Navigation("PastoralDomain"); + }); + + modelBuilder.Entity("Church.Net.Entity.AutoReplyItem", b => + { + b.Navigation("AutoReplyItemRelations"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b => + { + b.Navigation("Attendees"); + + b.Navigation("Prayers"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMember", b => + { + b.Navigation("OAuthInfos"); + + b.Navigation("PastoralDomains"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b => + { + b.Navigation("Costs"); + + b.Navigation("Tasks"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b => + { + b.Navigation("AutoReplyItemRelations"); + + b.Navigation("Bests"); + + b.Navigation("Contributions"); + + b.Navigation("HappinessWeeks"); + + b.Navigation("Members"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Church.Net.DAL.EFCoreDBF/Migrations/20221017002753_AddTimeToContribution.cs b/Church.Net.DAL.EFCoreDBF/Migrations/20221017002753_AddTimeToContribution.cs new file mode 100644 index 0000000..8526dfa --- /dev/null +++ b/Church.Net.DAL.EFCoreDBF/Migrations/20221017002753_AddTimeToContribution.cs @@ -0,0 +1,37 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Church.Net.DAL.EFCoreDBF.Migrations +{ + public partial class AddTimeToContribution : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Comment", + table: "Contributions", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "Time", + table: "Contributions", + type: "timestamp with time zone", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Comment", + table: "Contributions"); + + migrationBuilder.DropColumn( + name: "Time", + table: "Contributions"); + } + } +} diff --git a/Church.Net.DAL.EFCoreDBF/Migrations/20230310201522_AddTimeZoneToGroup.Designer.cs b/Church.Net.DAL.EFCoreDBF/Migrations/20230310201522_AddTimeZoneToGroup.Designer.cs new file mode 100644 index 0000000..af4183d --- /dev/null +++ b/Church.Net.DAL.EFCoreDBF/Migrations/20230310201522_AddTimeZoneToGroup.Designer.cs @@ -0,0 +1,919 @@ +// +using System; +using Church.Net.DAL.EF; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Church.Net.DAL.EFCoreDBF.Migrations +{ + [DbContext(typeof(ChurchNetContext))] + [Migration("20230310201522_AddTimeZoneToGroup")] + partial class AddTimeZoneToGroup + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Church.Net.Entity.AddressInfo", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("City") + .HasColumnType("text"); + + b.Property("State") + .HasColumnType("text"); + + b.Property("Zip") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("AddressInfos"); + }); + + modelBuilder.Entity("Church.Net.Entity.AutoReplyItem", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Command") + .HasColumnType("text"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("AutoReplyItems"); + }); + + modelBuilder.Entity("Church.Net.Entity.Career", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.HasKey("Id"); + + b.ToTable("Careers"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("PastoralDomainId") + .HasColumnType("text"); + + b.Property("Time") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("PastoralDomainId"); + + b.ToTable("CellGroupRoutineEvents"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventAttendee", b => + { + b.Property("EventId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("Id") + .HasColumnType("text") + .HasColumnOrder(1); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("JoinPotluck") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("PotluckItem") + .HasColumnType("text"); + + b.HasKey("EventId", "Id"); + + b.ToTable("CellGroupRoutineEventAttendees"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventPrayer", b => + { + b.Property("EventId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("MemberId") + .HasColumnType("text") + .HasColumnOrder(1); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("Prayer") + .HasColumnType("text"); + + b.HasKey("EventId", "MemberId"); + + b.ToTable("CellGroupRoutineEventPrayers"); + }); + + modelBuilder.Entity("Church.Net.Entity.Contribution", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Amount") + .HasColumnType("numeric"); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("Contributor") + .HasColumnType("text"); + + b.Property("GroupId") + .HasColumnType("text"); + + b.Property("Time") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("GroupId"); + + b.ToTable("Contributions"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMember", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("AvatarImage") + .HasColumnType("text"); + + b.Property("Baptized") + .HasColumnType("boolean"); + + b.Property("Birthday") + .HasColumnType("timestamp with time zone"); + + b.Property("CareerId") + .HasColumnType("text"); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("ComunityAppId") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("DateOfBaptized") + .HasColumnType("timestamp with time zone"); + + b.Property("DateOfWalkIn") + .HasColumnType("timestamp with time zone"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("FirstName") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastName") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Married") + .HasColumnType("boolean"); + + b.Property("Password") + .HasColumnType("text"); + + b.Property("Role") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CareerId"); + + b.ToTable("FamilyMembers"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMemberOAuth", b => + { + b.Property("FamilyMemberId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("OAuthType") + .HasColumnType("text") + .HasColumnOrder(1); + + b.Property("OAuthAccessToken") + .HasColumnType("text"); + + b.HasKey("FamilyMemberId", "OAuthType"); + + b.ToTable("FamilyMemberOAuths"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessBEST", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Email") + .HasColumnType("text"); + + b.Property("GroupId") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Phone") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GroupId"); + + b.ToTable("HappinessBESTs"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessCost", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Amount") + .HasColumnType("numeric"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("Tasker") + .HasColumnType("text"); + + b.Property("WeekId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("WeekId"); + + b.ToTable("HappinessCosts"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessTask", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("Tasker") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("WeekId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("WeekId"); + + b.ToTable("HappinessTask"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasColumnType("text"); + + b.Property("CityAndZipCode") + .HasColumnType("text"); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("Date") + .HasColumnType("timestamp with time zone"); + + b.Property("GroupId") + .HasColumnType("text"); + + b.Property("InvitationText") + .HasColumnType("text"); + + b.Property("SEQ") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("GroupId"); + + b.ToTable("HappinessWeeks"); + }); + + modelBuilder.Entity("Church.Net.Entity.LineMessagingAccount", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ChatToken") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Seq") + .HasColumnType("integer"); + + b.Property("TotalUsage") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("LineMessagingAccounts"); + }); + + modelBuilder.Entity("Church.Net.Entity.LogInfo", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("DetailMessage") + .HasColumnType("text"); + + b.Property("Level") + .HasColumnType("integer"); + + b.Property("Message") + .HasColumnType("text"); + + b.Property("Source") + .HasColumnType("text"); + + b.Property("StackTrace") + .HasColumnType("text"); + + b.Property("Time") + .HasColumnType("timestamp with time zone"); + + b.Property("TrackNo") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TrackNo")); + + b.Property("Url") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("LogInfos"); + }); + + modelBuilder.Entity("Church.Net.Entity.Messenger.LineMessageClient", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("ClientId") + .HasColumnType("text"); + + b.Property("IsGroup") + .HasColumnType("boolean"); + + b.Property("IsManager") + .HasColumnType("boolean"); + + b.Property("Name") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("LineMessageClients"); + }); + + modelBuilder.Entity("Church.Net.Entity.NewVisitor", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Address") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("BirthDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ComunityAppId") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Email") + .HasMaxLength(150) + .HasColumnType("character varying(150)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Note") + .HasColumnType("text"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("character varying(150)"); + + b.Property("ReligionId") + .HasColumnType("integer"); + + b.Property("VisitingDate") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("ReligionId"); + + b.ToTable("NewVisitors"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Image1") + .HasColumnType("text"); + + b.Property("Image2") + .HasColumnType("text"); + + b.Property("Image3") + .HasColumnType("text"); + + b.Property("Image4") + .HasColumnType("text"); + + b.Property("Image5") + .HasColumnType("text"); + + b.Property("LeaderMemberId") + .HasColumnType("text"); + + b.Property("LineAccountId") + .HasColumnType("text"); + + b.Property("LineGroupId") + .HasColumnType("text"); + + b.Property("LogoImage") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("ServiceAddressId") + .HasColumnType("text"); + + b.Property("ServiceTime") + .HasColumnType("timestamp with time zone"); + + b.Property("TimeZone") + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("LeaderMemberId"); + + b.HasIndex("LineAccountId"); + + b.HasIndex("ServiceAddressId"); + + b.ToTable("PastoralDomains"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomainAutoReplys", b => + { + b.Property("PastoralDomainCommunityAppId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("AutoReplyItemId") + .HasColumnType("text") + .HasColumnOrder(1); + + b.HasKey("PastoralDomainCommunityAppId", "AutoReplyItemId"); + + b.HasIndex("AutoReplyItemId"); + + b.ToTable("PastoralDomainAutoReplys"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomainMembers", b => + { + b.Property("PastoralDomainId") + .HasColumnType("text") + .HasColumnOrder(0); + + b.Property("FamilyMemberId") + .HasColumnType("text") + .HasColumnOrder(1); + + b.HasKey("PastoralDomainId", "FamilyMemberId"); + + b.HasIndex("FamilyMemberId"); + + b.ToTable("PastoralDomainMembers"); + }); + + modelBuilder.Entity("Church.Net.Entity.Religion", b => + { + b.Property("ReligionId") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ReligionId")); + + b.Property("Name") + .HasColumnType("text"); + + b.HasKey("ReligionId"); + + b.ToTable("Religions"); + }); + + modelBuilder.Entity("Church.Net.Entity.Vocabulary", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DefinitionCh") + .IsRequired() + .HasColumnType("text"); + + b.Property("DefinitionEn") + .IsRequired() + .HasColumnType("text"); + + b.Property("FlashCardTimes") + .HasColumnType("integer"); + + b.Property("ImagesUrl") + .HasColumnType("text"); + + b.Property("InsertDate") + .HasColumnType("timestamp with time zone"); + + b.Property("NounPlural") + .HasColumnType("text"); + + b.Property("PartOfSpeech") + .HasColumnType("integer"); + + b.Property("PracticeApply") + .HasColumnType("boolean"); + + b.Property("PracticeDate") + .HasColumnType("timestamp with time zone"); + + b.Property("PracticeMemorized") + .HasColumnType("boolean"); + + b.Property("PracticeReview") + .HasColumnType("boolean"); + + b.Property("PracticeSelect") + .HasColumnType("boolean"); + + b.Property("PracticeSentence") + .HasColumnType("text"); + + b.Property("PracticeStage") + .HasColumnType("integer"); + + b.Property("PracticeVisualize") + .HasColumnType("boolean"); + + b.Property("VerbParticiple") + .HasColumnType("text"); + + b.Property("VerbPast") + .HasColumnType("text"); + + b.Property("Word") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Vocabulary"); + }); + + modelBuilder.Entity("Church.Net.Entity.WhoIsSpy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Answer1Chs") + .HasColumnType("text"); + + b.Property("Answer1Cht") + .HasColumnType("text"); + + b.Property("Answer1En") + .HasColumnType("text"); + + b.Property("Answer2Chs") + .HasColumnType("text"); + + b.Property("Answer2Cht") + .HasColumnType("text"); + + b.Property("Answer2En") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("WhoIsSpy"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b => + { + b.HasOne("Church.Net.Entity.PastoralDomain", "CellGroupInfo") + .WithMany() + .HasForeignKey("PastoralDomainId"); + + b.Navigation("CellGroupInfo"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventAttendee", b => + { + b.HasOne("Church.Net.Entity.CellGroupRoutineEvent", "CellGroupRoutineEvent") + .WithMany("Attendees") + .HasForeignKey("EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CellGroupRoutineEvent"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventPrayer", b => + { + b.HasOne("Church.Net.Entity.CellGroupRoutineEvent", "CellGroupRoutineEvent") + .WithMany("Prayers") + .HasForeignKey("EventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CellGroupRoutineEvent"); + }); + + modelBuilder.Entity("Church.Net.Entity.Contribution", b => + { + b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup") + .WithMany("Contributions") + .HasForeignKey("GroupId"); + + b.Navigation("HappinessGroup"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMember", b => + { + b.HasOne("Church.Net.Entity.Career", "Career") + .WithMany() + .HasForeignKey("CareerId"); + + b.Navigation("Career"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMemberOAuth", b => + { + b.HasOne("Church.Net.Entity.FamilyMember", null) + .WithMany("OAuthInfos") + .HasForeignKey("FamilyMemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessBEST", b => + { + b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup") + .WithMany("Bests") + .HasForeignKey("GroupId"); + + b.Navigation("HappinessGroup"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessCost", b => + { + b.HasOne("Church.Net.Entity.HappinessWeek", "HappinessWeek") + .WithMany("Costs") + .HasForeignKey("WeekId"); + + b.Navigation("HappinessWeek"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessTask", b => + { + b.HasOne("Church.Net.Entity.HappinessWeek", "HappinessWeek") + .WithMany("Tasks") + .HasForeignKey("WeekId"); + + b.Navigation("HappinessWeek"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b => + { + b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup") + .WithMany("HappinessWeeks") + .HasForeignKey("GroupId"); + + b.Navigation("HappinessGroup"); + }); + + modelBuilder.Entity("Church.Net.Entity.NewVisitor", b => + { + b.HasOne("Church.Net.Entity.Religion", "Religion") + .WithMany() + .HasForeignKey("ReligionId"); + + b.Navigation("Religion"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b => + { + b.HasOne("Church.Net.Entity.FamilyMember", "Leader") + .WithMany() + .HasForeignKey("LeaderMemberId"); + + b.HasOne("Church.Net.Entity.LineMessagingAccount", "LineMessagingAccount") + .WithMany() + .HasForeignKey("LineAccountId"); + + b.HasOne("Church.Net.Entity.AddressInfo", "ServiceAddress") + .WithMany() + .HasForeignKey("ServiceAddressId"); + + b.Navigation("Leader"); + + b.Navigation("LineMessagingAccount"); + + b.Navigation("ServiceAddress"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomainAutoReplys", b => + { + b.HasOne("Church.Net.Entity.AutoReplyItem", "FamilyMember") + .WithMany("AutoReplyItemRelations") + .HasForeignKey("AutoReplyItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Church.Net.Entity.PastoralDomain", "PastoralDomain") + .WithMany("AutoReplyItemRelations") + .HasForeignKey("PastoralDomainCommunityAppId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FamilyMember"); + + b.Navigation("PastoralDomain"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomainMembers", b => + { + b.HasOne("Church.Net.Entity.FamilyMember", "FamilyMember") + .WithMany("PastoralDomains") + .HasForeignKey("FamilyMemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Church.Net.Entity.PastoralDomain", "PastoralDomain") + .WithMany("Members") + .HasForeignKey("PastoralDomainId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FamilyMember"); + + b.Navigation("PastoralDomain"); + }); + + modelBuilder.Entity("Church.Net.Entity.AutoReplyItem", b => + { + b.Navigation("AutoReplyItemRelations"); + }); + + modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b => + { + b.Navigation("Attendees"); + + b.Navigation("Prayers"); + }); + + modelBuilder.Entity("Church.Net.Entity.FamilyMember", b => + { + b.Navigation("OAuthInfos"); + + b.Navigation("PastoralDomains"); + }); + + modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b => + { + b.Navigation("Costs"); + + b.Navigation("Tasks"); + }); + + modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b => + { + b.Navigation("AutoReplyItemRelations"); + + b.Navigation("Bests"); + + b.Navigation("Contributions"); + + b.Navigation("HappinessWeeks"); + + b.Navigation("Members"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Church.Net.DAL.EFCoreDBF/Migrations/20230310201522_AddTimeZoneToGroup.cs b/Church.Net.DAL.EFCoreDBF/Migrations/20230310201522_AddTimeZoneToGroup.cs new file mode 100644 index 0000000..25f7027 --- /dev/null +++ b/Church.Net.DAL.EFCoreDBF/Migrations/20230310201522_AddTimeZoneToGroup.cs @@ -0,0 +1,25 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Church.Net.DAL.EFCoreDBF.Migrations +{ + public partial class AddTimeZoneToGroup : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TimeZone", + table: "PastoralDomains", + type: "text", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "TimeZone", + table: "PastoralDomains"); + } + } +} diff --git a/Church.Net.DAL.EFCoreDBF/Migrations/ChurchNetContextModelSnapshot.cs b/Church.Net.DAL.EFCoreDBF/Migrations/ChurchNetContextModelSnapshot.cs index 3aa6d0d..b4e9bb7 100644 --- a/Church.Net.DAL.EFCoreDBF/Migrations/ChurchNetContextModelSnapshot.cs +++ b/Church.Net.DAL.EFCoreDBF/Migrations/ChurchNetContextModelSnapshot.cs @@ -146,6 +146,33 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations b.ToTable("CellGroupRoutineEventPrayers"); }); + modelBuilder.Entity("Church.Net.Entity.Contribution", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Amount") + .HasColumnType("numeric"); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("Contributor") + .HasColumnType("text"); + + b.Property("GroupId") + .HasColumnType("text"); + + b.Property("Time") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("GroupId"); + + b.ToTable("Contributions"); + }); + modelBuilder.Entity("Church.Net.Entity.FamilyMember", b => { b.Property("Id") @@ -253,6 +280,30 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations b.ToTable("HappinessBESTs"); }); + modelBuilder.Entity("Church.Net.Entity.HappinessCost", b => + { + b.Property("Id") + .HasColumnType("text"); + + b.Property("Amount") + .HasColumnType("numeric"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("Tasker") + .HasColumnType("text"); + + b.Property("WeekId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("WeekId"); + + b.ToTable("HappinessCosts"); + }); + modelBuilder.Entity("Church.Net.Entity.HappinessTask", b => { b.Property("Id") @@ -492,6 +543,9 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations b.Property("ServiceTime") .HasColumnType("timestamp with time zone"); + b.Property("TimeZone") + .HasColumnType("text"); + b.Property("Type") .HasColumnType("integer"); @@ -688,6 +742,15 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations b.Navigation("CellGroupRoutineEvent"); }); + modelBuilder.Entity("Church.Net.Entity.Contribution", b => + { + b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup") + .WithMany("Contributions") + .HasForeignKey("GroupId"); + + b.Navigation("HappinessGroup"); + }); + modelBuilder.Entity("Church.Net.Entity.FamilyMember", b => { b.HasOne("Church.Net.Entity.Career", "Career") @@ -715,6 +778,15 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations b.Navigation("HappinessGroup"); }); + modelBuilder.Entity("Church.Net.Entity.HappinessCost", b => + { + b.HasOne("Church.Net.Entity.HappinessWeek", "HappinessWeek") + .WithMany("Costs") + .HasForeignKey("WeekId"); + + b.Navigation("HappinessWeek"); + }); + modelBuilder.Entity("Church.Net.Entity.HappinessTask", b => { b.HasOne("Church.Net.Entity.HappinessWeek", "HappinessWeek") @@ -822,6 +894,8 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b => { + b.Navigation("Costs"); + b.Navigation("Tasks"); }); @@ -831,6 +905,8 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations b.Navigation("Bests"); + b.Navigation("Contributions"); + b.Navigation("HappinessWeeks"); b.Navigation("Members"); diff --git a/Church.Net.Entity2/Contribution.cs b/Church.Net.Entity2/Contribution.cs new file mode 100644 index 0000000..b2143ab --- /dev/null +++ b/Church.Net.Entity2/Contribution.cs @@ -0,0 +1,23 @@ +using Church.Net.Entity.Interface; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.Text; +using System.ComponentModel; + +namespace Church.Net.Entity +{ + public class Contribution : IEntity + { + [ForeignKey("HappinessGroup")] + public string GroupId { get; set; } + public PastoralDomain HappinessGroup { get; set; } + [Key] + public string Id { get; set; } + public string Contributor { get; set; } + public decimal Amount { get; set; } + public string Comment { get; set; } + public DateTime Time { get; set; } + } +} diff --git a/Church.Net.Entity2/HappinessWeek.cs b/Church.Net.Entity2/HappinessWeek.cs index dfcd781..b856a61 100644 --- a/Church.Net.Entity2/HappinessWeek.cs +++ b/Church.Net.Entity2/HappinessWeek.cs @@ -29,6 +29,7 @@ namespace Church.Net.Entity [NotMapped] public string Topic { get; set; } public virtual ICollection Tasks { get; set; } + public virtual ICollection Costs { get; set; } public string Comment { get; set; } } @@ -58,4 +59,18 @@ namespace Church.Net.Entity public string Tasker { get; set; } public string Content { get; set; } } + public class HappinessCost : IEntity + { + [ForeignKey("HappinessWeek")] + public string WeekId { get; set; } + public HappinessWeek HappinessWeek { get; set; } + [Key] + public string Id { get; set; } + public string Tasker { get; set; } + public string Content { get; set; } + public decimal Amount { get; set; } + } + + + } diff --git a/Church.Net.Entity2/PastoralDomain.cs b/Church.Net.Entity2/PastoralDomain.cs index b78b09e..41a407a 100644 --- a/Church.Net.Entity2/PastoralDomain.cs +++ b/Church.Net.Entity2/PastoralDomain.cs @@ -16,7 +16,7 @@ namespace Church.Net.Entity HappinessGroup, CellGroupCoworker, ChurchCoworker, - Person = 99 + Administrator = 99 } public class PastoralDomain : IEntity, IMessengerClient { @@ -57,9 +57,11 @@ namespace Church.Net.Entity public DomainType Type { get; set; } public DateTime? ServiceTime { get; set; } + public string TimeZone { get; set; } public virtual ICollection Bests { get; set; } public virtual ICollection HappinessWeeks { get; set; } - + public virtual ICollection Contributions { get; set; } + [JsonIgnore] public virtual ICollection Members { get; set; } [JsonIgnore] diff --git a/Church.Net.Utility/DateTimeHelper.cs b/Church.Net.Utility/DateTimeHelper.cs index 0199656..f4c2200 100644 --- a/Church.Net.Utility/DateTimeHelper.cs +++ b/Church.Net.Utility/DateTimeHelper.cs @@ -16,13 +16,32 @@ namespace Church.Net.Utility int daysToAdd = ((int)day - (int)start.DayOfWeek + 7) % 7; return start.AddDays(daysToAdd); } - public static DateTime Now() + public static DateTime Now(string timeZoneCode=null) { + TimeZoneInfo timeZone; + if (null== timeZoneCode) + { + timeZone = pacificZone; + } + else + { + timeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneCode); + } return TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, pacificZone); } - public static DateTime Today() + public static DateTime Today(string timeZoneCode = null) { - return Now().Date; + return Now(timeZoneCode).Date; + } + public static DateTime ToUtc(this DateTime time,string timeZoneCode) + { + TimeZoneInfo timeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneCode); + return TimeZoneInfo.ConvertTimeToUtc(time, timeZone); + } + public static DateTime ToLocal(this DateTime time, string timeZoneCode) + { + TimeZoneInfo timeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneCode); + return TimeZoneInfo.ConvertTimeFromUtc(time, timeZone); } } } diff --git a/Church.Net.Utility/TokenHelper.cs b/Church.Net.Utility/TokenHelper.cs index 7d5f1c6..434e645 100644 --- a/Church.Net.Utility/TokenHelper.cs +++ b/Church.Net.Utility/TokenHelper.cs @@ -24,6 +24,9 @@ namespace Church.Net.Utility { byte[] data = Convert.FromBase64String(token); DateTime when = DateTime.FromBinary(BitConverter.ToInt64(data, 0)); +#if DEBUG + when = DateTime.Today.AddDays(1); +#endif if (when >= DateTime.Now) { string userId = Encoding.ASCII.GetString(data.Skip(8).ToArray()); diff --git a/LineMessaging/Apis/LineMessagePushApi.cs b/LineMessaging/Apis/LineMessagePushApi.cs index 518a2bb..7f920c8 100644 --- a/LineMessaging/Apis/LineMessagePushApi.cs +++ b/LineMessaging/Apis/LineMessagePushApi.cs @@ -118,6 +118,23 @@ namespace LineMessaging }); } + + public async Task PushJsonMessage(string to, string jsonMessage) + { + if (to == null) + { + throw new ArgumentNullException(nameof(to)); + } + + if (jsonMessage == null) + { + throw new ArgumentNullException(nameof(jsonMessage)); + } + + await Post(LineMessagePushApiPath, + "{\r\n \"to\": \""+ to + "\",\r\n \"messages\":["+ jsonMessage + "]\r\n}" + ); + } public async Task MulticastMessage(LineMulticastMessage multicastMessage) { if (multicastMessage == null) diff --git a/LineMessaging/LineMessagingClient.cs b/LineMessaging/LineMessagingClient.cs index 8d68f0c..1220b7d 100644 --- a/LineMessaging/LineMessagingClient.cs +++ b/LineMessaging/LineMessagingClient.cs @@ -156,7 +156,15 @@ namespace LineMessaging { if (body != null) { - string jsonContent = JsonConvert.SerializeObject(body, serializerSettings); + string jsonContent; + if (body is string) + { + jsonContent = body.ToString(); + } + else + { + jsonContent = JsonConvert.SerializeObject(body, serializerSettings); + } message.Content = new StringContent(jsonContent); message.Content.Headers.ContentType = MediaTypeJson; diff --git a/LineMessaging/MessageData/LineActionObject.cs b/LineMessaging/MessageData/LineActionObject.cs index 57f9122..0a062f8 100644 --- a/LineMessaging/MessageData/LineActionObject.cs +++ b/LineMessaging/MessageData/LineActionObject.cs @@ -46,8 +46,28 @@ namespace LineMessaging public ActionType Type => ActionType.Uri; [JsonProperty("label")] public string Label { get; set; } + private string _uri; + [JsonProperty("uri")] - public string Uri { get; set; } + public string Uri + { + get { return _uri; } + set { + + if (value.IndexOf("?") == -1) + { + value += "?openExternalBrowser=1"; + } + else + { + value += "&openExternalBrowser=1"; + } + + _uri = value; + } + } + + } public class DatetimepickerAction : ILineAction diff --git a/LineMessaging/MessageData/LineFlexObject.cs b/LineMessaging/MessageData/LineFlexObject.cs index f4b406d..7c777a8 100644 --- a/LineMessaging/MessageData/LineFlexObject.cs +++ b/LineMessaging/MessageData/LineFlexObject.cs @@ -3,6 +3,7 @@ using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; +using System.Drawing; using System.Linq; using System.Runtime.Serialization; using System.Text; @@ -108,11 +109,16 @@ namespace LineMessaging } public class LineFlexButton : ILineFlexObject { + public LineFlexButton() + { + Height = FlexObjectSize.md; + } public FlexObjectType Type => FlexObjectType.Button; [JsonRequired] public ILineAction Action { get; set; } public FlexObjectButtonStype Style { get; set; } //public FlexObjectSize Size { get; set; } + public FlexObjectSize Height { get; set; } } public class LineFlexImage : ILineFlexObject { diff --git a/WebAPI/Controllers/ApiControllerBase.cs b/WebAPI/Controllers/ApiControllerBase.cs index 24495e0..85dadc7 100644 --- a/WebAPI/Controllers/ApiControllerBase.cs +++ b/WebAPI/Controllers/ApiControllerBase.cs @@ -41,12 +41,12 @@ namespace WebAPI.Controllers } [HttpPost] - public virtual async Task CreateOrUpdate([FromBody] T entity) + public virtual async Task CreateOrUpdate([FromBody] T entity) { return await Task.Run(() => { logic.CreateOrUpdate(entity, out string id); - return id; + return entity; }); } [HttpPost] @@ -109,11 +109,12 @@ namespace WebAPI.Controllers } [HttpPost] - public virtual async Task CreateOrUpdate([FromBody] T entity) + public virtual async Task CreateOrUpdate([FromBody] T entity) { return await Task.Run(() => { - return logic.CreateOrUpdate(entity); + logic.CreateOrUpdate(entity); + return entity; }); } [HttpPost] diff --git a/WebAPI/Controllers/BestController.cs b/WebAPI/Controllers/BestController.cs index b4ee822..71a04ea 100644 --- a/WebAPI/Controllers/BestController.cs +++ b/WebAPI/Controllers/BestController.cs @@ -96,7 +96,7 @@ namespace WebAPI.Controllers [HttpPost] public int UpdateBestWeek(HappinessWeek week) { - return weekLogic.CreateOrUpdate(week,out string id); + return cellGroupLogic.UpdateWeekInfo(week); } private Font arialFont; diff --git a/WebAPI/Controllers/ContributionController.cs b/WebAPI/Controllers/ContributionController.cs new file mode 100644 index 0000000..d2c3fc4 --- /dev/null +++ b/WebAPI/Controllers/ContributionController.cs @@ -0,0 +1,16 @@ +using Church.Net.Entity; +using Microsoft.AspNetCore.Mvc; +using WebAPI.Logics.Interface; + +namespace WebAPI.Controllers +{ + [Route("[controller]/[action]")] + [ApiController] + public class ContributionController : ApiControllerBase + { + public ContributionController(ICrudLogic logic) : base(logic) + { + } + + } +} diff --git a/WebAPI/Controllers/HappinessCostController.cs b/WebAPI/Controllers/HappinessCostController.cs new file mode 100644 index 0000000..3da3204 --- /dev/null +++ b/WebAPI/Controllers/HappinessCostController.cs @@ -0,0 +1,18 @@ + +using Church.Net.Entity; +using Microsoft.AspNetCore.Mvc; +using WebAPI.Logics.Interface; + +namespace WebAPI.Controllers +{ + [Route("[controller]/[action]")] + [ApiController] + public class HappinessCostController : ApiControllerBase + { + + public HappinessCostController(ICrudLogic logic) : base(logic) + { + } + + } +} diff --git a/WebAPI/Controllers/LineMessageController.cs b/WebAPI/Controllers/LineMessageController.cs index ef32299..b007cfc 100644 --- a/WebAPI/Controllers/LineMessageController.cs +++ b/WebAPI/Controllers/LineMessageController.cs @@ -24,6 +24,7 @@ using Jint.Native; using WebAPI.Services.Interfaces; using Church.Net.DAL.EFCoreDBF.Migrations; using Church.Net.DAL.EFCoreDBF; +using WebAPI.Logics; // For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 namespace WebAPI.Controllers @@ -36,16 +37,19 @@ namespace WebAPI.Controllers private readonly LineAutoBotService lineAutoBotService; private readonly ILoggingService loggingService; private readonly ICrudDAL crudDAL; + private readonly PastoralDomainLogic pastoralDomainLogic; public LineMessageController( LineAutoBotService lineAutoBotService, ILoggingService loggingService, - ICrudDAL crudDAL + ICrudDAL crudDAL, + PastoralDomainLogic pastoralDomainLogic ) { this.lineAutoBotService = lineAutoBotService; this.loggingService = loggingService; this.crudDAL = crudDAL; + this.pastoralDomainLogic = pastoralDomainLogic; } //private ChurchNetContext dbContext = new ChurchNetContext(); //// GET: api/ @@ -109,11 +113,11 @@ namespace WebAPI.Controllers } - //[HttpGet] - //public Task PushCommandMessage(string groupToken, string command) - //{ - // return lineAutoBotService.PushCommandMessage(EnumHelper.GetEnumValueFromDescription(groupToken), "#" + command); - //} + [HttpGet] + public Task PushCommandMessage(string groupId, string command) + { + return lineAutoBotService.PushCommandMessage(pastoralDomainLogic.GetById(groupId), "#" + command); + } } diff --git a/WebAPI/Controllers/PastoralDomainController.cs b/WebAPI/Controllers/PastoralDomainController.cs index 80fe5aa..a0e2047 100644 --- a/WebAPI/Controllers/PastoralDomainController.cs +++ b/WebAPI/Controllers/PastoralDomainController.cs @@ -2,28 +2,39 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Church.Net.DAL.EF; using Church.Net.Entity; using WebAPI.Logics; using WebAPI.Logics.Interface; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; namespace WebAPI.Controllers { [Route("[controller]/[action]")] + [Authorize] [ApiController] public class PastoralDomainController : ApiControllerBase { + private readonly PastoralDomainLogic logic; + public PastoralDomainController(PastoralDomainLogic logic) : base(logic) { + this.logic = logic; } + [HttpGet] + public Task> GetCurrentUserPastoralDomain() + { + return Task.Run(() => + { + return logic.GetCurrentUserPastoralDomain(); + }); + } } [Route("[controller]/[action]")] [ApiController] + [Authorize] public class DomainMemberShipController : CombinedKeyApiControllerBase { public DomainMemberShipController(ICombinedKeyCrudLogic logic) : base(logic) @@ -43,5 +54,29 @@ namespace WebAPI.Controllers return 1; } + [HttpGet] + public int AddMemberIntoGroup(string domainId, string memberId) + { + return logic.CreateOrUpdate(new PastoralDomainMembers() { PastoralDomainId = domainId, FamilyMemberId = memberId }); + } + + [HttpGet] + public int RemoveMemberFromGroup(string domainId, string memberId) + { + return logic.Delete(r => r.PastoralDomainId == domainId && r.FamilyMemberId == memberId); + } + + [HttpPost] + public int UpdateMembersInGroup(PastoralDomain domain) + { + logic.Delete(r => r.PastoralDomainId == domain.Id); + foreach (var member in domain.FamilyMembers) + { + //logic.Delete(r => r.FamilyMemberId == relation.FamilyMemberId); + logic.Create(new PastoralDomainMembers() { PastoralDomainId = domain.Id, FamilyMemberId = member.Id }); + } + return 1; + } + } } diff --git a/WebAPI/Controllers/PingController.cs b/WebAPI/Controllers/PingController.cs index b39d6a0..66ce1f1 100644 --- a/WebAPI/Controllers/PingController.cs +++ b/WebAPI/Controllers/PingController.cs @@ -113,7 +113,7 @@ namespace WebAPI.Controllers var templateMessage = new LineTemplateMessage(); var addPrayerBtn = new UriAction() { - Uri = "https://happiness.tours/CellGroup/prayer?openExternalBrowser=1", + Uri = "https://happiness.tours/CellGroup/prayer", Label = "Prayer" }; templateMessage.AltText = "代禱事項"; diff --git a/WebAPI/Logics/MemberLogic.cs b/WebAPI/Logics/MemberLogic.cs new file mode 100644 index 0000000..a30c1cd --- /dev/null +++ b/WebAPI/Logics/MemberLogic.cs @@ -0,0 +1,23 @@ +using Church.Net.DAL.EFCoreDBF; +using Church.Net.Entity; +using WebAPI.Logics.Core; +using WebAPI.Logics.Interface; + +namespace WebAPI.Logics +{ + public class MemberLogic : LogicBase, ICrudLogic + { + public MemberLogic( + LogicService logicService, + ICrudDAL crudDAL + ) : base(logicService, crudDAL) + { + } + + public override void BeforeUpdate(FamilyMember entity) + { + + entity.Password = crudDAL.First(m => m.Id == entity.Id).Password; + } + } +} diff --git a/WebAPI/Logics/PastoralDomainLogic.cs b/WebAPI/Logics/PastoralDomainLogic.cs index a914a4c..88500c8 100644 --- a/WebAPI/Logics/PastoralDomainLogic.cs +++ b/WebAPI/Logics/PastoralDomainLogic.cs @@ -17,37 +17,40 @@ namespace WebAPI.Logics string[] weekTopics = new string[] { "真幸福", "真相大白", "萬世巨星", "幸福連線", "當上帝來敲門", "十字架的勝利", "釋放與自由", "幸福的教會" }; private readonly IServiceScopeFactory serviceScopeFactory; private readonly ICrudDAL eventCrudDAL; - private readonly ICombinedKeyCrudDAL attendeeCrudDAL; private readonly ICrudDAL memberCrudDAL; private readonly ICrudDAL addressCrudDAL; private readonly ICombinedKeyCrudDAL pastoralDomainMemberDAL; private readonly ICrudDAL weekCrudDAL; private readonly ICrudDAL bestCrudDAL; private readonly ICrudDAL weekTaskCrudDAL; + private readonly ICrudDAL happinessCostCrudDAL; + private readonly ICrudDAL contributionCrudDAL; public PastoralDomainLogic( IServiceScopeFactory serviceScopeFactory, LogicService logicService, ICrudDAL crudDAL, ICrudDAL eventCrudDAL, - ICombinedKeyCrudDAL attendeeCrudDAL, ICrudDAL memberCrudDAL, ICrudDAL addressCrudDAL, ICombinedKeyCrudDAL pastoralDomainMemberDAL, ICrudDAL weekCrudDAL, ICrudDAL bestCrudDAL, - ICrudDAL weekTaskCrudDAL + ICrudDAL weekTaskCrudDAL, + ICrudDAL contributionCrudDALL, + ICrudDAL happinessCostCrudDAL ) : base(logicService, crudDAL) { this.serviceScopeFactory = serviceScopeFactory; this.eventCrudDAL = eventCrudDAL; - this.attendeeCrudDAL = attendeeCrudDAL; this.memberCrudDAL = memberCrudDAL; this.addressCrudDAL = addressCrudDAL; this.pastoralDomainMemberDAL = pastoralDomainMemberDAL; this.weekCrudDAL = weekCrudDAL; this.bestCrudDAL = bestCrudDAL; this.weekTaskCrudDAL = weekTaskCrudDAL; + this.happinessCostCrudDAL = happinessCostCrudDAL; + this.contributionCrudDAL = contributionCrudDALL; } @@ -57,20 +60,26 @@ namespace WebAPI.Logics public override IEnumerable GetAll(Func filter = null) { var list = base.GetAll(filter); - foreach (var item in list) + foreach (var group in list) { - if (!string.IsNullOrEmpty(item.ServiceAddressId)) + if (!string.IsNullOrEmpty(group.ServiceAddressId)) { - item.ServiceAddress = addressCrudDAL.GetById(item.ServiceAddressId); + group.ServiceAddress = addressCrudDAL.GetById(group.ServiceAddressId); } else { - item.ServiceAddress = new AddressInfo(); + group.ServiceAddress = new AddressInfo(); } - if (item.Type == DomainType.HappinessGroup) + if (group.Type == DomainType.HappinessGroup) { - GetHappinessGroupInfo(item); + GetHappinessGroupInfo(group); } + + group.FamilyMembers = + memberCrudDAL.GetAllById( + pastoralDomainMemberDAL.GetAll(d => d.PastoralDomainId == group.Id).Select(d => d.FamilyMemberId).ToList() + ).ToList(); + group.Contributions = contributionCrudDAL.GetAll(d => d.GroupId == group.Id).ToList(); } return list; } @@ -91,31 +100,42 @@ namespace WebAPI.Logics public CellGroupRoutineEvent GetComingEvent(string domainId = null) { + PastoralDomain cellGroup; if (domainId == null) { - var cellGroup = GetCurrentUserCellGroup(); + cellGroup = GetCurrentUserCellGroup(); if (cellGroup != null) { domainId = cellGroup.Id; - var _event = eventCrudDAL.GetDbSet().OrderByDescending(e => e.Time) - .Include(e => e.Attendees).Include(e => e.Prayers) - .Where(e => e.PastoralDomainId == domainId).FirstOrDefault(); - return _event; + //var _event = eventCrudDAL.GetDbSet().OrderByDescending(e => e.Time) + // .Include(e => e.Attendees).Include(e => e.Prayers) + // .Where(e => e.PastoralDomainId == domainId).FirstOrDefault(); + //return _event; } } + else + { + cellGroup= crudDAL.GetById(domainId); + } if (domainId != null) { var _event = eventCrudDAL.GetDbSet().Where(e => e.PastoralDomainId == domainId && e.Time >= DateTime.UtcNow) .Include(e => e.Attendees).Include(e => e.Prayers).FirstOrDefault(); if (_event == null) { + var serviceLocalTime = cellGroup.ServiceTime.Value.ToUniversalTime().ToLocal(cellGroup.TimeZone); + var serviceWeekDay = serviceLocalTime.DayOfWeek; + var nextServiceTime = DateTimeHelper.GetNextWeekday(DateTimeHelper.Today(cellGroup.TimeZone), DayOfWeek.Friday) + .AddHours(serviceLocalTime.Hour).AddMinutes(serviceLocalTime.Minute); + + _event = new CellGroupRoutineEvent() { Id = Format.Get33BaseGuid(), - Time = DateTimeHelper.GetNextWeekday(DateTime.Today, DayOfWeek.Friday).AddHours(19).AddMinutes(30), + Time = nextServiceTime.ToUtc(cellGroup.TimeZone), Address = "1881 Forest Dr., Azusa, CA 91702", Attendees = new List(), PastoralDomainId = domainId @@ -167,7 +187,17 @@ namespace WebAPI.Logics if (!string.IsNullOrWhiteSpace(logicService.CurrentUserId)) { var ids = pastoralDomainMemberDAL.GetAll(p => p.FamilyMemberId == logicService.CurrentUserId).Select(p => p.PastoralDomainId); - return crudDAL.GetAll(p => ids.Contains(p.Id)); + var list = crudDAL.GetAll(p => ids.Contains(p.Id)); + + foreach (var group in list) + { + if (group.Type == DomainType.HappinessGroup) + { + GetHappinessGroupInfo(group); + } + group.Contributions = contributionCrudDAL.GetAll(d => d.GroupId == group.Id).ToList(); + } + return list; } return null; } @@ -231,10 +261,11 @@ namespace WebAPI.Logics foreach (var week in group.HappinessWeeks) { week.Topic = weekTopics[week.SEQ - 1]; - week.Tasks = weekTaskCrudDAL.GetAll(t => t.WeekId == week.Id).ToList(); + week.Tasks = weekTaskCrudDAL.GetAll(t => t.WeekId == week.Id).OrderBy(t => t.Type).ToList(); + week.Costs = happinessCostCrudDAL.GetAll(t => t.WeekId == week.Id).ToList(); } - group.Bests = bestCrudDAL.GetAll(b => b.GroupId == group.Id).ToList(); + group.Bests = bestCrudDAL.GetAll(b => b.GroupId == group.Id).OrderBy(b => b.Name).ToList(); } } } diff --git a/WebAPI/Services/AutoReplyCommands/ArArkCellGroupDinner.cs b/WebAPI/Services/AutoReplyCommands/ArArkCellGroupDinner.cs index 6480e6a..ee8b0d1 100644 --- a/WebAPI/Services/AutoReplyCommands/ArArkCellGroupDinner.cs +++ b/WebAPI/Services/AutoReplyCommands/ArArkCellGroupDinner.cs @@ -32,6 +32,7 @@ namespace WebAPI.Services.AutoReplyCommands public IEnumerable Commands => COMMANDS; public IEnumerable SupportGroups => GROUPS; public string ReplyTextMessage => null; + public string ReplyJsonMessage => null; public IEnumerable LineMessage { @@ -178,7 +179,7 @@ namespace WebAPI.Services.AutoReplyCommands { Action = new UriAction() { - Uri = "https://happiness.tours/CellGroup/dinner?openExternalBrowser=1", + Uri = $"https://happiness.tours/myapp/dinner/{pastoralDomain.Id}", Label = "我的菜單" } } diff --git a/WebAPI/Services/AutoReplyCommands/ArArkCellGroupInfo.cs b/WebAPI/Services/AutoReplyCommands/ArArkCellGroupInfo.cs index 3274af4..9760e6d 100644 --- a/WebAPI/Services/AutoReplyCommands/ArArkCellGroupInfo.cs +++ b/WebAPI/Services/AutoReplyCommands/ArArkCellGroupInfo.cs @@ -28,6 +28,8 @@ namespace WebAPI.Services.AutoReplyCommands public IEnumerable SupportGroups => GROUPS; public IEnumerable LineMessage => null; + public string ReplyJsonMessage => null; + public void Initialize(PastoralDomain pastoralDomain = null) { this.pastoralDomain = pastoralDomain; diff --git a/WebAPI/Services/AutoReplyCommands/ArArkCellGroupPrayer.cs b/WebAPI/Services/AutoReplyCommands/ArArkCellGroupPrayer.cs index f9730a3..ddf6456 100644 --- a/WebAPI/Services/AutoReplyCommands/ArArkCellGroupPrayer.cs +++ b/WebAPI/Services/AutoReplyCommands/ArArkCellGroupPrayer.cs @@ -77,6 +77,7 @@ namespace WebAPI.Services.AutoReplyCommands public IEnumerable Commands => COMMANDS; public IEnumerable SupportGroups => GROUPS; public string ReplyTextMessage => null; + public string ReplyJsonMessage => null; public IEnumerable LineMessage { get @@ -215,7 +216,7 @@ namespace WebAPI.Services.AutoReplyCommands { Action = new UriAction() { - Uri = "https://happiness.tours/CellGroup/prayer?openExternalBrowser=1", + Uri = $"https://happiness.tours/myapp/prayer/{pastoralDomain.Id}", Label = "我的代禱事項" } } @@ -236,6 +237,7 @@ namespace WebAPI.Services.AutoReplyCommands } public bool Enabled(PastoralDomain pastoralDomain = null, string command = null) { + this.pastoralDomain = pastoralDomain; return COMMANDS.Any(c => c.IndexOf(command) == 0); } } diff --git a/WebAPI/Services/AutoReplyCommands/ArChurchInfo.cs b/WebAPI/Services/AutoReplyCommands/ArChurchInfo.cs index 32e4d93..5983e1b 100644 --- a/WebAPI/Services/AutoReplyCommands/ArChurchInfo.cs +++ b/WebAPI/Services/AutoReplyCommands/ArChurchInfo.cs @@ -24,11 +24,13 @@ namespace WebAPI.Services.AutoReplyCommands public string ReplyTextMessage => MESSAGES; public IEnumerable LineMessage => null; + public string ReplyJsonMessage => null; IEnumerable IAutoReplyCommand.SupportGroups => GROUPS; public bool Enabled(PastoralDomain pastoralDomain = null, string command = null) { + //this.pastoralDomain = pastoralDomain; return COMMANDS.Any(c => c.IndexOf(command, StringComparison.OrdinalIgnoreCase) == 0); } diff --git a/WebAPI/Services/AutoReplyCommands/ArHappinessBEST.cs b/WebAPI/Services/AutoReplyCommands/ArHappinessBEST.cs index a1daf5d..f91fa60 100644 --- a/WebAPI/Services/AutoReplyCommands/ArHappinessBEST.cs +++ b/WebAPI/Services/AutoReplyCommands/ArHappinessBEST.cs @@ -32,6 +32,7 @@ namespace WebAPI.Services.AutoReplyCommands public IEnumerable Commands => COMMANDS; public IEnumerable SupportGroups => GROUPS; public string ReplyTextMessage => null; + public string ReplyJsonMessage => null; public IEnumerable LineMessage { @@ -83,7 +84,8 @@ namespace WebAPI.Services.AutoReplyCommands Text = $"親愛的 {best.Name},想邀請你來參加這周的幸福聚會唷! 這是這周的邀請函!\n\nhttps://happiness.tours/invitation/{best.Id}", Label = best.Name, //InputOption= "openKeyboard" - } + }, + Height = FlexObjectSize.sm, } ); diff --git a/WebAPI/Services/AutoReplyCommands/ArHappinessGroupTask.cs b/WebAPI/Services/AutoReplyCommands/ArHappinessGroupTask.cs index 992859b..6e502e0 100644 --- a/WebAPI/Services/AutoReplyCommands/ArHappinessGroupTask.cs +++ b/WebAPI/Services/AutoReplyCommands/ArHappinessGroupTask.cs @@ -28,138 +28,14 @@ namespace WebAPI.Services.AutoReplyCommands }; private readonly PastoralDomainLogic logic; - public string Description => "顯示幸福小組分工表 #代表周數"; + public string Description => "顯示幸福小組分工表 #代表周數 9顯示所有分工"; public IEnumerable Commands => COMMANDS; public IEnumerable SupportGroups => GROUPS; public string ReplyTextMessage => null; - - public IEnumerable LineMessage - { - get - { - var random = new Random(); - - List list = new List(); - string title = $"W{weekSeq} {week.Topic} 分工表"; - string imageUrl = $"https://happiness.tours/assets/images/HappinessGroup/week0{weekSeq}.jpg"; - var flexMessage = new LineFlexMessage(); - flexMessage.AltText = title; - - #region Header - var headerContent = flexMessage.Contents.InitHeader(); - headerContent.Add( - new LineFlexText(title) - { - Size = FlexObjectSize.lg, - Weight = FlexObjectTextWeidht.Bold, - Align = "center" - }); - #endregion - #region Hero - flexMessage.Contents.InitHero() - .Add( - new LineFlexImage(imageUrl) - { - Size = FlexObjectSize.full, - AspectRatio = "1.5:1" - } - ); - #endregion - #region Body - - var bodyContent = flexMessage.Contents.InitBody(); - - TimeSpan ts = week.Date - DateTime.Now; - Console.WriteLine("No. of Minutes (Difference) = {0}", ts.TotalMinutes); - bodyContent.Add( - new LineFlexText($"再過 {ts.TotalMinutes.ToString("N0")} 分鐘,就是萬眾期待的幸福小組啦!!!") - { - Size = FlexObjectSize.md, - Weight = FlexObjectTextWeidht.Regular, - OffsetBottom = FlexObjectSize.xxl, - Wrap = true - }); - //bodyContent.Add( - // new LineFlexText($"{_event.Time.ToString("MM/dd HH:mm tt")} 準時開飯唷!!") - // { - // Size = FlexObjectSize.md, - // Weight = FlexObjectTextWeidht.Regular, - // OffsetBottom = FlexObjectSize.xl, - // Wrap = true - // }); - - bodyContent.Add( - new LineFlexText("分工明細") - { - Size = FlexObjectSize.md, - Weight = FlexObjectTextWeidht.Bold, - OffsetBottom = FlexObjectSize.md - }); - //$"目前暫無禱告事項唷, 趕快來新增代禱事項吧!!" - List comments = new List(); - - foreach (var a in week.Tasks) - { - var name = string.IsNullOrEmpty(a.Tasker)?"N/A": a.Tasker;// logic.GetMemberFirstNameById(a.MemberId); - - var baseLineBox = new LineFlexBox() - { - Layout = FlexObjectBoxLayout.Baseline, - }; - baseLineBox.Contents.Add( - new LineFlexText(a.Type.EnumToDescriptionString()) - { - Size = FlexObjectSize.sm, - Color = "#aaaaaa", - Flex = 3 - }); - baseLineBox.Contents.Add( - new LineFlexText( - $"{name}" - - ) - { - Size = FlexObjectSize.sm, - Color = "#666666", - Flex = 3, - Wrap = true - }); - baseLineBox.Contents.Add( - new LineFlexText( - $"內容:{a.Content}" - - ) - { - Size = FlexObjectSize.sm, - Color = "#666666", - Flex = 7, - Wrap = true - }); - bodyContent.Add(baseLineBox); - - } - - bodyContent.Add(new LineFlexSeparator()); - #endregion - #region Footer - //flexMessage.Contents.InitFooter() - // .Add( - // new LineFlexButton() - // { - // Action = new UriAction() - // { - // Uri = "https://happiness.tours/CellGroup/dinner?openExternalBrowser=1", - // Label = "我的菜單" - // } - // } - // ); - - #endregion - - list.Insert(0, flexMessage); - return list; - } - } + public string ReplyJsonMessage => jsonMessage; + private string jsonMessage; + private IEnumerable lineMessages; + public IEnumerable LineMessage => lineMessages; public void Initialize(PastoralDomain pastoralDomain = null) { @@ -170,7 +46,7 @@ namespace WebAPI.Services.AutoReplyCommands public bool Enabled(PastoralDomain pastoralDomain = null, string command = null) { - if (pastoralDomain != null && COMMANDS.Any(c => c.IndexOf(command) == 0)) + if (pastoralDomain != null && command.IndexOf("分工")>-1) { this.pastoralDomain = pastoralDomain; @@ -190,10 +66,288 @@ namespace WebAPI.Services.AutoReplyCommands week = pastoralDomain.HappinessWeeks.Where(w => w.Date >= DateTime.UtcNow).FirstOrDefault(); weekSeq = week.SEQ; } + + if (week != null) + { + PrepareLineMessage(); + } + else + { + PrepareAllTaskMessage(); + } + + + return true; }; return false; } + + private void PrepareAllTaskMessage() + { + this.lineMessages = null; + StringBuilder messageContent = new StringBuilder(); + + + messageContent.AppendLine("{ "); + messageContent.AppendLine(" \"altText\": \"幸福小組 8 週分工\", "); + messageContent.AppendLine(" \"type\": \"flex\", "); + messageContent.AppendLine(" \"contents\": { "); + messageContent.AppendLine(" \"type\": \"carousel\", "); + messageContent.AppendLine(" \"contents\": [ "); + + + foreach (var week in pastoralDomain.HappinessWeeks.OrderBy(w => w.SEQ)) + { + + messageContent.AppendLine("{ "); + messageContent.AppendLine(" \"type\": \"bubble\", "); + messageContent.AppendLine(" \"header\": { "); + messageContent.AppendLine(" \"type\": \"box\", "); + messageContent.AppendLine(" \"layout\": \"vertical\", "); + messageContent.AppendLine(" \"contents\": [ "); + messageContent.AppendLine(" { "); + messageContent.AppendLine(" \"type\": \"text\", "); + messageContent.AppendLine($" \"text\": \"W{week.SEQ} {week.Topic} 分工表\", "); + messageContent.AppendLine(" \"flex\": 0, "); + messageContent.AppendLine(" \"size\": \"lg\", "); + messageContent.AppendLine(" \"weight\": \"bold\", "); + messageContent.AppendLine(" \"wrap\": false, "); + messageContent.AppendLine(" \"align\": \"center\" "); + messageContent.AppendLine(" } "); + messageContent.AppendLine(" ], "); + messageContent.AppendLine(" \"paddingAll\": \"sm\" "); + messageContent.AppendLine(" }, "); + messageContent.AppendLine(" \"hero\": { "); + messageContent.AppendLine(" \"type\": \"box\", "); + messageContent.AppendLine(" \"layout\": \"vertical\", "); + messageContent.AppendLine(" \"contents\": [ "); + messageContent.AppendLine(" { "); + messageContent.AppendLine(" \"type\": \"image\", "); + messageContent.AppendLine($" \"url\": \"https://happiness.tours/assets/images/HappinessGroup/week0{week.SEQ}.jpg\", "); + messageContent.AppendLine(" \"size\": \"full\", "); + messageContent.AppendLine(" \"aspectRatio\": \"1.5:1\" "); + messageContent.AppendLine(" } "); + messageContent.AppendLine(" ] "); + messageContent.AppendLine(" }, "); + messageContent.AppendLine(" \"body\": { "); + messageContent.AppendLine(" \"type\": \"box\", "); + messageContent.AppendLine(" \"layout\": \"vertical\", "); + messageContent.AppendLine(" \"contents\": [ "); + messageContent.AppendLine(" { "); + messageContent.AppendLine(" \"type\": \"text\", "); + messageContent.AppendLine(" \"text\": \"分工明細\", "); + messageContent.AppendLine(" \"flex\": 0, "); + messageContent.AppendLine(" \"size\": \"md\", "); + messageContent.AppendLine(" \"offsetBottom\": \"md\", "); + messageContent.AppendLine(" \"weight\": \"bold\", "); + messageContent.AppendLine(" \"wrap\": false "); + messageContent.AppendLine(" }, "); + + foreach (var task in week.Tasks) + { + messageContent.AppendLine(" { "); + messageContent.AppendLine(" \"type\": \"box\", "); + messageContent.AppendLine(" \"layout\": \"baseline\", "); + messageContent.AppendLine(" \"contents\": [ "); + messageContent.AppendLine(" { "); + messageContent.AppendLine(" \"type\": \"text\", "); + messageContent.AppendLine($" \"text\": \"{task.Type.EnumToDescriptionString()}\", "); + messageContent.AppendLine(" \"flex\": 3, "); + messageContent.AppendLine(" \"size\": \"sm\", "); + messageContent.AppendLine(" \"weight\": \"regular\", "); + messageContent.AppendLine(" \"color\": \"#aaaaaa\", "); + messageContent.AppendLine(" \"wrap\": false "); + messageContent.AppendLine(" }, "); + messageContent.AppendLine(" { "); + messageContent.AppendLine(" \"type\": \"text\", "); + messageContent.AppendLine($" \"text\": \"{task.Tasker} \", "); + messageContent.AppendLine(" \"flex\": 3, "); + messageContent.AppendLine(" \"size\": \"sm\", "); + messageContent.AppendLine(" \"weight\": \"regular\", "); + messageContent.AppendLine(" \"color\": \"#666666\", "); + messageContent.AppendLine(" \"wrap\": true "); + messageContent.AppendLine(" }, "); + messageContent.AppendLine(" { "); + messageContent.AppendLine(" \"type\": \"text\", "); + messageContent.AppendLine($" \"text\": \"內容:{task.Content}\", "); + messageContent.AppendLine(" \"flex\": 7, "); + messageContent.AppendLine(" \"size\": \"sm\", "); + messageContent.AppendLine(" \"weight\": \"regular\", "); + messageContent.AppendLine(" \"color\": \"#666666\", "); + messageContent.AppendLine(" \"wrap\": true "); + messageContent.AppendLine(" } "); + messageContent.AppendLine(" ] "); + messageContent.AppendLine(" }, "); + } + + + messageContent.AppendLine(" { "); + messageContent.AppendLine(" \"type\": \"separator\", "); + messageContent.AppendLine(" \"margin\": \"md\" "); + messageContent.AppendLine(" } "); + messageContent.AppendLine(" ], "); + messageContent.AppendLine(" \"paddingBottom\": \"none\" "); + messageContent.AppendLine(" }, "); + messageContent.AppendLine(" \"footer\": { "); + messageContent.AppendLine(" \"type\": \"box\", "); + messageContent.AppendLine(" \"layout\": \"vertical\", "); + messageContent.AppendLine(" \"contents\": [ "); + messageContent.AppendLine(" { "); + messageContent.AppendLine(" \"type\": \"button\", "); + messageContent.AppendLine(" \"action\": { "); + messageContent.AppendLine(" \"type\": \"uri\", "); + messageContent.AppendLine(" \"label\": \"管理分工\", "); + messageContent.AppendLine($" \"uri\": \"https://happiness.tours/myapp/happinessWeeks/395BBPTU4NG3F?openExternalBrowser={week.SEQ}\" "); + messageContent.AppendLine(" }, "); + messageContent.AppendLine(" \"style\": \"link\", "); + messageContent.AppendLine(" \"height\": \"md\" "); + messageContent.AppendLine(" } "); + messageContent.AppendLine(" ], "); + messageContent.AppendLine(" \"paddingAll\": \"none\" "); + messageContent.AppendLine(" } "); + if (week.SEQ < 8) + { + messageContent.AppendLine(" }, "); + } + else + { + messageContent.AppendLine(" } "); + } + + } + + messageContent.AppendLine(" ] "); + messageContent.AppendLine(" } "); + messageContent.AppendLine(" } "); + this.jsonMessage = messageContent.ToString(); + } + + private void PrepareLineMessage() + { + + var random = new Random(); + + List list = new List(); + string title = $"W{weekSeq} {week.Topic} 分工表"; + string imageUrl = $"https://happiness.tours/assets/images/HappinessGroup/week0{weekSeq}.jpg"; + var flexMessage = new LineFlexMessage(); + flexMessage.AltText = title; + + #region Header + var headerContent = flexMessage.Contents.InitHeader(); + headerContent.Add( + new LineFlexText(title) + { + Size = FlexObjectSize.lg, + Weight = FlexObjectTextWeidht.Bold, + Align = "center" + }); + #endregion + #region Hero + flexMessage.Contents.InitHero() + .Add( + new LineFlexImage(imageUrl) + { + Size = FlexObjectSize.full, + AspectRatio = "1.5:1" + } + ); + #endregion + #region Body + + var bodyContent = flexMessage.Contents.InitBody(); + + TimeSpan ts = week.Date - DateTime.Now; + Console.WriteLine("No. of Minutes (Difference) = {0}", ts.TotalMinutes); + bodyContent.Add( + new LineFlexText($"再過 {ts.TotalMinutes.ToString("N0")} 分鐘,就是萬眾期待的幸福小組啦!!!") + { + Size = FlexObjectSize.md, + Weight = FlexObjectTextWeidht.Regular, + OffsetBottom = FlexObjectSize.xxl, + Wrap = true + }); + //bodyContent.Add( + // new LineFlexText($"{_event.Time.ToString("MM/dd HH:mm tt")} 準時開飯唷!!") + // { + // Size = FlexObjectSize.md, + // Weight = FlexObjectTextWeidht.Regular, + // OffsetBottom = FlexObjectSize.xl, + // Wrap = true + // }); + + bodyContent.Add( + new LineFlexText("分工明細") + { + Size = FlexObjectSize.md, + Weight = FlexObjectTextWeidht.Bold, + OffsetBottom = FlexObjectSize.md + }); + //$"目前暫無禱告事項唷, 趕快來新增代禱事項吧!!" + List comments = new List(); + + foreach (var a in week.Tasks) + { + var name = string.IsNullOrEmpty(a.Tasker) ? "N/A" : a.Tasker;// logic.GetMemberFirstNameById(a.MemberId); + + var baseLineBox = new LineFlexBox() + { + Layout = FlexObjectBoxLayout.Baseline, + }; + baseLineBox.Contents.Add( + new LineFlexText(a.Type.EnumToDescriptionString()) + { + Size = FlexObjectSize.sm, + Color = "#aaaaaa", + Flex = 3 + }); + baseLineBox.Contents.Add( + new LineFlexText( + $"{name}" + + ) + { + Size = FlexObjectSize.sm, + Color = "#666666", + Flex = 3, + Wrap = true + }); + baseLineBox.Contents.Add( + new LineFlexText( + $"內容:{a.Content}" + + ) + { + Size = FlexObjectSize.sm, + Color = "#666666", + Flex = 7, + Wrap = true + }); + bodyContent.Add(baseLineBox); + + } + + bodyContent.Add(new LineFlexSeparator()); + #endregion + #region Footer + flexMessage.Contents.InitFooter() + .Add( + new LineFlexButton() + { + Action = new UriAction() + { + Uri = $"https://happiness.tours/myapp/happinessWeeks/{pastoralDomain.Id}", + Label = "管理分工" + } + } + ); + + #endregion + + list.Insert(0, flexMessage); + this.lineMessages = list; + } } } diff --git a/WebAPI/Services/Interfaces/IAutoReplyCommand.cs b/WebAPI/Services/Interfaces/IAutoReplyCommand.cs index e678eb6..5a561a6 100644 --- a/WebAPI/Services/Interfaces/IAutoReplyCommand.cs +++ b/WebAPI/Services/Interfaces/IAutoReplyCommand.cs @@ -13,6 +13,7 @@ namespace WebAPI.Services.Interfaces string Description { get; } IEnumerable Commands { get; } string ReplyTextMessage { get; } + string ReplyJsonMessage { get; } IEnumerable SupportGroups { get; } IEnumerable LineMessage { get; } bool Enabled(PastoralDomain pastoralDomain = null, string command = null); diff --git a/WebAPI/Services/Interfaces/IScheduledTask.cs b/WebAPI/Services/Interfaces/IScheduledTask.cs index 8b98a7a..47d52a3 100644 --- a/WebAPI/Services/Interfaces/IScheduledTask.cs +++ b/WebAPI/Services/Interfaces/IScheduledTask.cs @@ -8,6 +8,7 @@ namespace WebAPI.Services.Interfaces { public interface IScheduledTask { + static DateTime? NextRunningTime { get; set; } string Description { get; } bool CheckTime(DateTime time); Task RunTask(); diff --git a/WebAPI/Services/LineAutoBotService.cs b/WebAPI/Services/LineAutoBotService.cs index 6ec51d0..3da4561 100644 --- a/WebAPI/Services/LineAutoBotService.cs +++ b/WebAPI/Services/LineAutoBotService.cs @@ -1,4 +1,5 @@ -using Church.Net.Entity; +using Church.Net.DAL.EFCoreDBF; +using Church.Net.Entity; using Church.Net.Entity.Messenger; using Church.Net.Utility; using LineMessaging; @@ -35,6 +36,7 @@ namespace WebAPI.Services private readonly ILoggingService loggingService; private readonly ICrudLogic clientLogic; private readonly LineMessagingAccountLogic lineMessagingAccountLogic; + private readonly ICrudDAL lineAccountCrudDAL; private string chatToken; private PastoralDomain cellGroup; @@ -43,13 +45,15 @@ namespace WebAPI.Services IEnumerable autoReplyCommands, ILoggingService loggingService, ICrudLogic clientLogic, - LineMessagingAccountLogic lineMessagingAccountLogic + LineMessagingAccountLogic lineMessagingAccountLogic, + ICrudDAL lineAccountCrudDAL ) { this.autoReplyCommands = autoReplyCommands; this.loggingService = loggingService; this.clientLogic = clientLogic; this.lineMessagingAccountLogic = lineMessagingAccountLogic; + this.lineAccountCrudDAL = lineAccountCrudDAL; } public void SendTextMessage(string text, LineGroup target) { @@ -96,6 +100,35 @@ namespace WebAPI.Services return false; } } + public async Task ReplyJsonMessage(string lineId, string jsonMessage) + { + var test = new LineMessagingClient(this.chatToken); + + //var replyMessage = new LineReplyMessage() { ReplyToken = replyToken }; + //var messages = new List(); + //foreach (var message in textMessages) + //{ + // messages.Add(new LineTextMessage() { Text = message }); + //} + //replyMessage.Messages = messages; + //test.ReplyMessage(replyMessage); + + try + { + await test.PushJsonMessage(lineId, jsonMessage); + return true; + } + catch (Exception ex) + { + this.loggingService.Error(ex, "ReplyTextMessage:75", jsonMessage); + + if (ex.Message == "You have reached your monthly limit.") + { + this.SendTextMessage("Line Bot Exist Monthly Limit!!!", LineGroup.Chris); + } + return false; + } + } public async Task ReplyLineMessage(string lineId, IEnumerable lineMessages) { var test = new LineMessagingClient(this.chatToken); @@ -212,6 +245,10 @@ namespace WebAPI.Services { await ReplyLineMessage(target, autoReply.LineMessage); } + else if (autoReply.ReplyJsonMessage != null) + { + await ReplyJsonMessage(target, autoReply.ReplyJsonMessage); + } else { await ReplyTextMessage(replyToken, autoReply.ReplyTextMessage); @@ -260,7 +297,7 @@ namespace WebAPI.Services { try { - + cellGroup = group; if (command.IndexOf("#") == 0) { command = command.ToLower().Substring(1); @@ -271,15 +308,18 @@ namespace WebAPI.Services if (autoReply != null) { - if (autoReply.LineMessage != null) + this.chatToken = this.lineAccountCrudDAL.First(x => x.Id == group.LineAccountId)?.ChatToken; + if (false == string.IsNullOrEmpty(this.chatToken)) { - await ReplyLineMessage(cellGroup.LineGroupId, autoReply.LineMessage); + if (autoReply.LineMessage != null) + { + await ReplyLineMessage(cellGroup.LineGroupId, autoReply.LineMessage); + } + else + { + await ReplyTextMessage(cellGroup.LineGroupId, autoReply.ReplyTextMessage); + } } - else - { - await ReplyTextMessage(cellGroup.LineGroupId, autoReply.ReplyTextMessage); - } - return true; } //else if (command == "help" || command == "?") diff --git a/WebAPI/Services/ScheduledTask/MorningPrayer.cs b/WebAPI/Services/ScheduledTask/MorningPrayer.cs index 6a43d8f..11b63db 100644 --- a/WebAPI/Services/ScheduledTask/MorningPrayer.cs +++ b/WebAPI/Services/ScheduledTask/MorningPrayer.cs @@ -11,7 +11,8 @@ namespace WebAPI.Services.ScheduledTask private readonly LineAutoBotService lineAutoBotService; private readonly ILoggingService loggingService; private readonly PastoralDomainLogic pastoralDomainLogic; - private DateTime? nextRunningTime = null; + + public static DateTime? NextRunningTime = null; public MorningPrayer( LineAutoBotService lineAutoBotService, ILoggingService loggingService, @@ -21,19 +22,19 @@ namespace WebAPI.Services.ScheduledTask this.lineAutoBotService = lineAutoBotService; this.loggingService = loggingService; this.pastoralDomainLogic = pastoralDomainLogic; - this.SetNextRunningTime(); + //this.SetNextRunningTime(); } public string Description => "Sent out Ark Morning Prayer"; public bool CheckTime(DateTime time) { - if(nextRunningTime == null) + if(NextRunningTime == null) { this.SetNextRunningTime(); - return true; + return false; } - return time >= nextRunningTime.Value; + return time >= NextRunningTime.Value; } public Task RunTask() @@ -53,8 +54,8 @@ namespace WebAPI.Services.ScheduledTask } private void SetNextRunningTime() { - nextRunningTime = DateTimeHelper.Today().AddDays(1).AddHours(8); - loggingService.Log($"Scheduled Task {this.Description}", nextRunningTime.Value); + NextRunningTime = DateTimeHelper.Today().AddDays(1).AddHours(8); + loggingService.Log($"Scheduled Task {this.Description}", NextRunningTime.Value); } } } diff --git a/WebAPI/Startup.cs b/WebAPI/Startup.cs index f20f8ef..c957683 100644 --- a/WebAPI/Startup.cs +++ b/WebAPI/Startup.cs @@ -70,7 +70,8 @@ namespace WebAPI services.AddDbContext(options => options.UseNpgsql( //Configuration.GetConnectionString() - "Host=192.168.86.131;Port=49154;Database=ChurchSandbox;Username=chris;Password=1124" + //"Host=192.168.86.131;Port=49154;Database=ChurchSandbox;Username=chris;Password=1124" + "Host=192.168.86.131;Port=49154;Database=Church;Username=chris;Password=1124" )); services.AddScoped(); @@ -94,8 +95,7 @@ namespace WebAPI services.AddScoped(); services.AddScoped(); services.AddScoped(); - - + services.AddScoped, MemberLogic>(); services.AddHostedService(); //services.AddMvc(o=>o.Filters.Add(typeof(HandleExceptionFilter))); //services.AddMvc(o => o.Filters.Add(new HandleExceptionFilter(services.BuildServiceProvider().GetService())));