예제 #1
0
        public SalaahTime GetSalaahTime(Masjid masjid, DateTime Val)
        {
            if (masjid.SalaahTimesType == SalaahTimesType.ScheduleTime)
            {
                var FirstTry = masjid.SalaahTimes
                               .Where(s => s.DayNumber <= Val.DayOfYear &&
                                      s.Type == SalaahTimesType.ScheduleTime)
                               .OrderByDescending(x => x.DayNumber)
                               .FirstOrDefault();

                if (FirstTry == null)
                {
                    FirstTry = masjid.SalaahTimes
                               .Where(s => s.TimeDate.Year <= Val.Year &&
                                      s.Type == SalaahTimesType.ScheduleTime)
                               .OrderBy(x => x.DayNumber)
                               .FirstOrDefault();
                }

                return(FirstTry);
            }
            else
            {
                return(masjid.SalaahTimes
                       .Where(s => s.DayNumber == Val.DayOfYear &&
                              s.TimeDate.Year <= Val.Year &&
                              s.Type == SalaahTimesType.DailyTime)
                       .OrderByDescending(x => x.TimeDate.Year)
                       .OrderByDescending(x => x.DayNumber)
                       .FirstOrDefault());
            }
        }
예제 #2
0
        public IActionResult Masjid(MasjidEditViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var user = _userManager.GetUserAsync(User).Result;

            if (user == null | (user.MasjidId != model.Id && !user.IsSuperUser))
            {
                throw new ApplicationException($"Unable to update the masjid");
            }

            Masjid masjid = Repository.Find <Masjid>(s => s.Id == model.Id).FirstOrDefault();

            masjid.LastUpdate = DateTime.UtcNow;

            _mapper.Map(model, masjid);

            Repository.Update(masjid);

            StatusMessage = "The Masjid has been updated";
            return(RedirectToAction(nameof(Masjid)));
        }
예제 #3
0
        public IActionResult PerpetualTimes(double Latitude, double Longitude, double TimeZone)
        {
            Masjid TempMasjid = new Masjid();

            TempMasjid.Latitude  = Latitude;
            TempMasjid.Longitude = Longitude;

            TempMasjid.TimeZoneDiff = TimeZone;

            cPerpetualTime Time = new cPerpetualTime(DateTime.Now, TempMasjid, true);

            var _json = new
            {
                sehriEnds = Time.SehriEnds.ToString("HH:mm"),
                fajr      = Time.Fajr.ToString("HH:mm"),
                sunrise   = Time.Sunrise.ToString("HH:mm"),
                ishraaq   = Time.Ishraaq.ToString("HH:mm"),
                zawaal    = Time.Zawaal.ToString("HH:mm"),
                dhuhr     = Time.Dhuhr.ToString("HH:mm"),
                asar1     = Time.AsrShafi.ToString("HH:mm"),
                asar2     = Time.AsrShafi.ToString("HH:mm"),
                sunset    = Time.Sunset.ToString("HH:mm"),
                maghrib   = Time.Maghrib.ToString("HH:mm"),
                isha      = Time.Isha.ToString("HH:mm"),
            };

            return(Json(_json));
        }
예제 #4
0
        public string MasjidDelete(string Id)
        {
            if (!IsSuperUser())
            {
                return("Unauthorised");
            }

            try
            {
                List <Notice> Notices = Repository.Find <Notice>(s => s.MasjidId == Id).ToList();

                List <SalaahTime> SalaahTimes = Repository.Find <SalaahTime>(s => s.MasjidId == Id).ToList();

                Masjid Masjid = Repository.Find <Masjid>(s => s.Id == Id).FirstOrDefault();

                Repository.DeleteMultiple(Notices);

                Repository.DeleteMultiple(SalaahTimes);

                Repository.Delete(Masjid);

                return("Successful");
            }
            catch (Exception ex)
            {
                return("Failed " + ex.Message);
            }
        }
예제 #5
0
        public string PostAddMasjid(MasjidViewModel MasjidVM)
        {
            try
            {
                if (MasjidVM.SecurityQuestion != "6")
                {
                    return("Fail - Security Question");
                }

                Masjid Masjid = new Masjid();
                Masjid.Name    = MasjidVM.Name;
                Masjid.Town    = MasjidVM.Town;
                Masjid.Country = MasjidVM.Country;

                //Masjid.TimeZone = MasjidVM.TimeZone;
                Masjid.TimeZoneId = MasjidVM.TimeZoneId;

                Masjid.Address        = MasjidVM.Address;
                Masjid.Contact        = MasjidVM.Contact;
                Masjid.GeneralInfo    = MasjidVM.GeneralInfo;
                Masjid.LadiesFacility = MasjidVM.LadiesFacility;

                Masjid.Latitude  = MasjidVM.Latitude;
                Masjid.Longitude = MasjidVM.Longitude;

                Masjid = _taqweemService.MasjidCreate(Masjid);

                return("Successful");
            }
            catch (Exception ex)
            {
                return("Fail" + ex.Message);
            }
        }
예제 #6
0
        public ActionResult Add()
        {
            string name    = Request["name"];
            string address = Request["address"];
            string area    = Request["area"];
            string fajar   = Request["fajar"] + " : " + Request["fajar1"] + " " + Request["fajar2"];
            var    zohar   = Request["zohar"] + " : " + Request["zohar1"] + " " + Request["zohar2"];
            var    asar    = Request["asar"] + " : " + Request["asar1"] + " " + Request["asar2"];
            var    magrib  = Request["magrib"] + " : " + Request["magrib1"] + " " + Request["magrib2"];
            var    esha    = Request["esha"] + " : " + Request["esha1"] + " " + Request["esha2"];
            Masjid m       = new Masjid();

            m.Address = address;
            m.Name    = name;
            m.Area    = area;
            m.Fajar   = fajar;
            m.Zohar   = zohar;
            m.Asar    = asar;
            m.Magrib  = magrib;
            m.Esha    = esha;
            dc.Masjids.InsertOnSubmit(m);
            dc.SubmitChanges();

            return(RedirectToAction("index"));
        }
예제 #7
0
        public IActionResult PerpetualCalendarPrinter(string Id)
        {
            Masjid Masjid = Repository
                            .Find <Masjid>(s => s.Id == Id)
                            .FirstOrDefault();

            cPerpCalendar Model = new cPerpCalendar(Masjid);

            return(View(Model));
        }
예제 #8
0
        public async Task <IActionResult> Register(RegisterViewModel model, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                ApplicationUser ExistingUser = _userManager.FindByEmailAsync(model.Email).Result;

                if (ExistingUser != null)
                {
                    _logger.LogInformation("Username already exists with that email");
                    return(RedirectToLocal(returnUrl));
                }

                if (model.MasjidId == null)
                {
                    _logger.LogInformation("No Masjid specified");
                    return(RedirectToLocal(returnUrl));
                }

                Masjid masjid = Repository.Find <Masjid>(s => s.Id == model.MasjidId).FirstOrDefault();

                if (masjid == null | masjid.AllowRegistration == false)
                {
                    _logger.LogInformation("Unable to register with the specified Masjid");
                    return(RedirectToLocal(returnUrl));
                }

                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email, MasjidId = model.MasjidId, FullName = model.FullName
                };
                var result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    _logger.LogInformation("User created a new account with password.");

                    var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                    code = HttpUtility.UrlEncode(code);

                    var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme);
                    await _emailSender.SendEmailConfirmationAsync(model.Email, callbackUrl);

                    await _signInManager.SignInAsync(user, isPersistent : false);

                    _logger.LogInformation("User created a new account with password.");
                    return(RedirectToLocal(returnUrl));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
예제 #9
0
        public IActionResult Masjid()
        {
            ApplicationUser user = _userManager.GetUserAsync(User).Result;

            Masjid masjid = Repository.Find <Masjid>(s => s.Id == user.MasjidId).FirstOrDefault();

            MasjidEditViewModel Model = new MasjidEditViewModel();

            _mapper.Map(masjid, Model);

            return(View(Model));
        }
예제 #10
0
        public SalaahTime NextSalaahTime(Masjid masjid, DateTime Val)
        {
            SalaahTime Time;

            if (masjid.SalaahTimesType == SalaahTimesType.ScheduleTime)
            {
                Time = masjid.SalaahTimes
                       .Where(s => s.DayNumber > Val.DayOfYear &&
                              s.Type == SalaahTimesType.ScheduleTime)
                       .OrderBy(x => x.DayNumber)
                       .FirstOrDefault();

                if (Time == null)
                {
                    Time = masjid.SalaahTimes
                           .Where(s => s.Type == SalaahTimesType.ScheduleTime)
                           .OrderBy(x => x.DayNumber)
                           .FirstOrDefault();

                    if (Time != null)
                    {
                        Time.TimeDate = new DateTime(Val.Year + 1, 1, 1);
                        Time.TimeDate = Time.TimeDate.AddDays(Time.DayNumber - 1);
                    }
                }
            }
            else
            {
                Time = masjid.SalaahTimes
                       .Where(s => s.DayNumber > Val.DayOfYear &&
                              s.Type == SalaahTimesType.DailyTime &&
                              s.TimeDate.Year <= Val.Year &&
                              s.IsATimeChange == true)
                       .OrderByDescending(s => s.TimeDate.Year)
                       .OrderBy(x => x.DayNumber)
                       .FirstOrDefault();

                if (Time == null)
                {
                    Time = masjid.SalaahTimes
                           .Where(s => s.Type == SalaahTimesType.DailyTime &&
                                  s.TimeDate.Year <= Val.Year + 1 &&
                                  s.IsATimeChange == true)
                           .OrderByDescending(s => s.TimeDate.Year)
                           .OrderBy(x => x.DayNumber)
                           .FirstOrDefault();
                }
            }

            return(Time);
        }
예제 #11
0
        public IActionResult SalaahCalendarDaily(string Id)
        {
            Masjid Masjid = Repository
                            .Find <Masjid>(s => s.Id == Id)
                            .FirstOrDefault();

            if (Masjid.SalaahTimesType == SalaahTimesType.ScheduleTime)
            {
                return(RedirectToAction("SalaahCalendar", "Home", new { Id = Id }));
            }

            cSalaahCalendar Model = new cSalaahCalendar(Masjid, _context);

            return(View(Model));
        }
예제 #12
0
파일: MasjidBs.cs 프로젝트: adnanmjcet/JAM
        public int Save(MasjidModel model)
        {
            Masjid _tbl_masjid = new Masjid(model);

            if (model.Id != null && model.Id != 0)
            {
                _tbl_Masjid.Update(_tbl_masjid);
            }
            else
            {
                _tbl_masjid.CreatedDate = System.DateTime.Now;
                _tbl_Masjid.Insert(_tbl_masjid);
            }

            return(_tbl_masjid.Id);
        }
예제 #13
0
        public ActionResult Index()
        {
            var Jame = new Masjid()
            {
                Name    = "Jamia Masjid",
                Address = "2724 W granville ave 60659",
                PHnum   = "123456789",
                Fajr    = DateTime.Parse("5:20 AM"),
                Zuhr    = DateTime.Parse("1:15 PM"),
                Asr     = DateTime.Parse("6:30 PM"),
                Maghrib = DateTime.Parse("7:20 PM"),
                Isha    = DateTime.Parse("9:00 PM"),
            };

            var REA = new Masjid()
            {
                Name    = "Rahmat-E-Alam",
                Address = "3673 w northshore ave 60702",
                PHnum   = "91234567",
                Fajr    = DateTime.Parse("5:00 AM"),
                Zuhr    = DateTime.Parse("1:10 PM"),
                Asr     = DateTime.Parse("6:20 PM"),
                Maghrib = DateTime.Parse("7:00 PM"),
                Isha    = DateTime.Parse("9:00 PM"),
            };

            var Noor = new Masjid()
            {
                Name    = "Masjid-E-Noor",
                Address = "lol sumwhere on devon",
                PHnum   = "679374920",
                Fajr    = DateTime.Parse("5:00 AM"),
                Zuhr    = DateTime.Parse("1:10 PM"),
                Asr     = DateTime.Parse("6:20 PM"),
                Maghrib = DateTime.Parse("7:00 PM"),
                Isha    = DateTime.Parse("9:00 PM"),
            };
            List <Masjid> Masjids = new List <Masjid> {
                Noor, REA, Jame
            };
            var viewmodel = new MasjidViewModel
            {
                Masjids = Masjids
            };

            return(View(viewmodel));
        }
예제 #14
0
        public IActionResult Notices()
        {
            ApplicationUser user = _userManager.GetUserAsync(User).Result;

            Masjid masjid = Repository.Find <Masjid>(s => s.Id == user.MasjidId).FirstOrDefault();

            NoticesViewModel Model = new NoticesViewModel();

            Model.MasjidId = masjid.Id;

            Model.Notices = Repository
                            .Find <Notice>(s => s.MasjidId == masjid.Id)
                            .Include(s => s.Created)
                            .ToList();

            return(View(Model));
        }
예제 #15
0
        public MasjidInfoViewModel(Masjid pMasjid)
        {
            Markers = new Markers();

            Masjid = pMasjid;

            PerpetualTime = new cPerpetualTime(DateTime.Now, Masjid, false);

            //Static Conversions
            QiblaDistance = Math.Round(cCalculations.DistanceTo(Masjid.Latitude, Masjid.Longitude, 21.4225, 39.8262));

            QDStatute = Math.Round(QiblaDistance * 0.621371, 0);

            QDNautical = Math.Round(QiblaDistance * 0.539957, 0);

            QiblaBearing = Math.Round(cCalculations.DegreeBearing(Masjid.Latitude, Masjid.Longitude, 21.4225, 39.8262), 2);
        }
예제 #16
0
        public IActionResult SalaahTimes()
        {
            ApplicationUser user = _userManager.GetUserAsync(User).Result;

            Masjid masjid = Repository.Find <Masjid>(s => s.Id == user.MasjidId).FirstOrDefault();

            SalaahTimesViewModel Model = new SalaahTimesViewModel();

            Model.Type = masjid.SalaahTimesType;

            Model.MasjidId = masjid.Id;

            Model.SalaahTimes = Repository.Find <SalaahTime>(s => s.MasjidId == masjid.Id &&
                                                             s.Type == masjid.SalaahTimesType)
                                .ToList();

            return(View(Model));
        }
예제 #17
0
        public IActionResult MasjidAdmin(string Id)
        {
            ApplicationUser user = _userManager.GetUserAsync(User).Result;

            if (user.IsSuperUser)
            {
                Masjid masjid = Repository.Find <Masjid>(s => s.Id == Id).FirstOrDefault();

                MasjidEditViewModel Model = new MasjidEditViewModel();

                _mapper.Map(masjid, Model);

                return(View("Masjid", Model));
            }
            else
            {
                return(RedirectToAction("Masjid", "Manage"));
            }
        }
예제 #18
0
        public async Task <object> GetMasjidSalaahTimesById(string id)
        {
            try
            {
                Masjid masjid = await _taqweemService.MasjidGetByIdIncludedAsync(id);

                SalaahTime times = _taqweemService.GetSalaahTime(masjid, DateTime.Now);

                if (times != null)
                {
                    SalaahTimeDTO returnObject = new SalaahTimeDTO
                    {
                        MasjidId           = times.MasjidId,
                        Type               = times.Type,
                        IsATimeChange      = times.IsATimeChange,
                        TimeDate           = times.TimeDate,
                        DayNumber          = times.DayNumber,
                        FajrAdhaan         = times.FajrAdhaan,
                        FajrSalaah         = times.FajrSalaah,
                        DhuhrAdhaan        = times.DhuhrAdhaan,
                        DhuhrSalaah        = times.DhuhrSalaah,
                        JumuahAdhaan       = times.JumuahAdhaan,
                        JumuahSalaah       = times.JumuahSalaah,
                        SpecialDhuhrAdhaan = times.SpecialDhuhrAdhaan,
                        SpecialDhuhrSalaah = times.SpecialDhuhrSalaah,
                        AsrAdhaan          = times.AsrAdhaan,
                        AsrSalaah          = times.AsrSalaah,
                        IshaAdhaan         = times.IshaAdhaan,
                        IshaSalaah         = times.IshaSalaah,
                    };

                    return(returnObject);
                }

                return(null);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
예제 #19
0
        public static void Initialize(ApplicationDbContext context)
        {
            context.Database.EnsureCreated();

            // Look for any students.
            if (context.Masjids.Any())
            {
                return;   // DB has been seeded
            }

            Masjid s = new Masjid();

            s.Name       = "Masjid Muaadh bin Jabal Crosby";
            s.Town       = "Johannesburg";
            s.Country    = "South Africa";
            s.Latitude   = -26.195149;
            s.Longitude  = 27.990238;
            s.TimeZoneId = "South Africa Standard Time";

            context.Masjids.Add(s);
            context.SaveChanges();
        }
예제 #20
0
        public IActionResult OldSiteRedirect(string Id)
        {
            try
            {
                int OldId = Convert.ToInt32(Id);

                Masjid masjid = _taqweemService.MasjidGetByOldSiteId(OldId);

                if (masjid != null)
                {
                    return(RedirectToAction("MasjidInfo", "Home", new { Id = masjid.Id }));
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
예제 #21
0
        public cSalaahCalendar(Masjid pMasjid, ApplicationDbContext context)
        {
            _context   = context;
            Repository = new EFRepository(_context);

            Masjid = pMasjid;

            Months = new List <DateTime>();

            for (int i = 1; i <= 12; i++)
            {
                Months.Add(new DateTime(DateTime.Now.Year, i, 1));
            }

            Times = new List <SalaahTime>();

            if (Masjid.SalaahTimesType == SalaahTimesType.DailyTime)
            {
                Times = Repository
                        .Find <SalaahTime>(s => s.MasjidId == Masjid.Id &&
                                           s.TimeDate.Year == DateTime.Now.Year &&
                                           s.Type == SalaahTimesType.DailyTime)
                        .OrderBy(s => s.DayNumber)
                        .ToList();

                Type = SalaahTimesType.DailyTime;
            }
            else
            {
                Times = Repository
                        .Find <SalaahTime>(s => s.MasjidId == Masjid.Id &&
                                           s.Type == SalaahTimesType.ScheduleTime)
                        .OrderBy(s => s.DayNumber)
                        .ToList();

                Type = SalaahTimesType.ScheduleTime;
            }
        }
예제 #22
0
        public cPerpCalendar(Masjid pMasjid)
        {
            Masjid = pMasjid;

            Months = new List <DateTime>();

            for (int i = 1; i <= 12; i++)
            {
                Months.Add(new DateTime(DateTime.Now.Year, i, 1));
            }

            Times = new List <cPerpetualTime>();

            foreach (var Item in Months)
            {
                int Days = DateTime.DaysInMonth(DateTime.Now.Year, Item.Month);

                for (int i = 1; i <= Days; i++)
                {
                    Times.Add(new cPerpetualTime(new DateTime(DateTime.Now.Year, Item.Month, i), Masjid, false));
                }
            }
        }
예제 #23
0
 public ActionResult Masjid(Masjid masjid)
 {
     return(View(masjid));
 }
예제 #24
0
        public string UploadMasjid(IFormFile file)
        {
            try
            {
                if (!IsSuperUser())
                {
                    return("Failed");
                }

                if (ModelState.IsValid)
                {
                    using (MemoryStream stream = new MemoryStream())
                    {
                        file.CopyTo(stream);

                        byte[] byteArray = stream.ToArray();

                        Stream stream2 = new MemoryStream(byteArray);

                        var package = new ExcelPackage(stream2);

                        var z = package.Workbook.Worksheets[1];

                        ExcelWorksheet Sheet = package.Workbook.Worksheets[1];

                        List <Masjid> Masjids = new List <Masjid>();

                        for (int i = 2; i <= Sheet.Dimension.End.Row; i++)
                        {
                            try
                            {
                                var M = new Masjid();

                                M.OldSiteId = Convert.ToInt32(Sheet.Cells[i, 1].Value.ToString());

                                if (M.OldSiteId == 1)
                                {
                                    continue;
                                }

                                M.Name    = Sheet.Cells[i, 2].Value.ToString();
                                M.Town    = Sheet.Cells[i, 3].Value.ToString();
                                M.Country = Sheet.Cells[i, 4].Value.ToString();

                                M.Latitude  = Convert.ToDouble(Sheet.Cells[i, 5].Value.ToString());
                                M.Longitude = Convert.ToDouble(Sheet.Cells[i, 6].Value.ToString());

                                //M.JuristMethod = (JuristicMethod)Enum.ToObject(typeof(JuristicMethod), (int)Sheet.Cells[i, 9].Value);

                                string Ladies = Sheet.Cells[i, 10].Value.ToString();
                                if (Ladies == "Yes")
                                {
                                    M.LadiesFacility = true;
                                }
                                else
                                {
                                    M.LadiesFacility = false;
                                }

                                double Jummah = (double)Sheet.Cells[i, 11].Value;
                                if (Jummah == 1)
                                {
                                    M.JummahFacility = true;
                                }
                                else
                                {
                                    M.JummahFacility = false;
                                }

                                M.Address = Sheet.Cells[i, 12].Value == null ? "" : Sheet.Cells[i, 12].Value.ToString();

                                M.Contact = Sheet.Cells[i, 13].Value == null ? "" : Sheet.Cells[i, 13].Value.ToString();

                                M.GeneralInfo = Sheet.Cells[i, 14].Value == null ? "" : Sheet.Cells[i, 14].Value.ToString();

                                M.TimeZoneId = "South Africa Standard Time";

                                Masjids.Add(M);
                            }
                            catch (Exception ex)
                            {
                                continue;
                            }
                        }

                        Masjids = Masjids.OrderBy(s => s.OldSiteId).ToList();

                        Repository.AddMultiple(Masjids);

                        package.Dispose();
                    }

                    return("Successful");
                }
                else
                {
                    throw new Exception();
                }
            }
            catch (Exception ex)
            {
                return("Fail" + ex.Message);
            }
        }
예제 #25
0
        public cPerpetualTime(DateTime Dval, Masjid Masjid, bool IsTempMasjid)
        {
            if (!IsTempMasjid)
            {
                Masjid.TimeZoneDiff = cCalculations.GetTimeZoneDifference(Masjid.TimeZoneId, Dval);
            }

            Date = Dval;

            try
            {
                double PI = 4 * Math.Atan(1);
                double Pi = 4 * Math.Atan(1);
                double FAJR_ANGLE = 18;
                double ISHA_ANGLE = 18;
                double zSehriEnds, zFajr, zSunrise, zIshraaq, zZawaal, zAsr1, zAsr2, zSunset, zIftaar, zIsha;

                if (Masjid.JuristMethod == JuristicMethod.UniversityOfIslamicSciencesKarachi)
                {
                    FAJR_ANGLE = 18; ISHA_ANGLE = 18;
                }
                else if (Masjid.JuristMethod == JuristicMethod.MuslimWorldLeague)
                {
                    FAJR_ANGLE = 18; ISHA_ANGLE = 17;
                }
                else if (Masjid.JuristMethod == JuristicMethod.IslamicSocietyOfNorthAmerica)
                {
                    FAJR_ANGLE = 15; ISHA_ANGLE = 15;
                }
                else if (Masjid.JuristMethod == JuristicMethod.UmmAlQuraUniversityMakkah)
                {
                    FAJR_ANGLE = 18.5; ISHA_ANGLE = 0;
                }
                else if (Masjid.JuristMethod == JuristicMethod.EgyptianGeneralAuthorityOfSurvey)
                {
                    FAJR_ANGLE = 19.5; ISHA_ANGLE = 17.5;
                }
                else
                {
                    FAJR_ANGLE = 18; ISHA_ANGLE = 18;
                }

                double dblLatitude, dblLongitude, dblHeight, dblTimeZone;
                double CALC_1, CALC_2, CALC_3, CALC_4, CALC_5, CALC_6, DECLINATION;

                int GLO_YEAR = Dval.Year;// DateTime.Now.Year;
                dblLatitude  = Masjid.Latitude * (PI / 180);
                dblLongitude = Masjid.Longitude;
                dblTimeZone  = Masjid.TimeZoneDiff * 15;
                dblHeight    = Masjid.Height;

                if (dblLatitude < 0)
                {
                    dblLatitude = -1 * dblLatitude;
                }

                DateTime LOOP_DATE  = Dval;// DateTime.Now;
                int      LOOP_MONTH = LOOP_DATE.Month;
                int      LOOP_DAY   = LOOP_DATE.Day;
                int      LOOP_YEAR  = LOOP_DATE.Year;
                if (LOOP_MONTH > 2)
                {
                    LOOP_MONTH -= 3;
                }
                else
                {
                    LOOP_YEAR -= 1; LOOP_MONTH += 9;
                }
                CALC_1      = ((0 / 24) + LOOP_DAY + Math.Floor(30.6 * LOOP_MONTH + 0.5) + Math.Floor(365.25 * (LOOP_YEAR - 1976)) - 8707.5) / 36525;
                CALC_2      = 23.4393 - (0.013 * CALC_1);
                CALC_3      = 357.528 + (35999.05 * CALC_1);
                CALC_3      = CALC_3 - (360 * Math.Floor(CALC_3 / 360));
                CALC_4      = (1.915 * Math.Sin(CALC_3 * PI / 180)) + (0.02 * Math.Sin(2 * CALC_3 * PI / 180));
                CALC_5      = 280.46 + (36000.77 * CALC_1) + CALC_4;
                CALC_5      = CALC_5 - (360 * Math.Floor(CALC_5 / 360));
                CALC_6      = CALC_5 - (2.466 * Math.Sin(2 * CALC_5 * PI / 180)) + (0.053 * Math.Sin(4 * CALC_5 * PI / 180));
                DECLINATION = Math.Atan(Math.Tan(CALC_2 * PI / 180) * Math.Sin(CALC_6 * PI / 180));

                if (Masjid.Latitude < 0)
                {
                    DECLINATION = DECLINATION * -1;
                }
                double EQUATIONTIME = ((CALC_5 - CALC_4 - CALC_6) / 15);
                zZawaal = ((12 + ((dblTimeZone - dblLongitude) / 15) - EQUATIONTIME));// +0.0083333333;

                //SUNRISE AND SUNSET CALCULATIONS
                double AZIMUTH = ((Math.Sin((-0.8333 * PI / 180) - (0.0347 * Math.Sqrt(Masjid.Height) * Pi / 180)) - (Math.Sin(DECLINATION) * Math.Sin(dblLatitude))) / (Math.Cos(DECLINATION) * Math.Cos(dblLatitude)));
                AZIMUTH  = Math.Atan(-AZIMUTH / Math.Sqrt(-AZIMUTH * AZIMUTH + 1)) + (Pi / 2);
                AZIMUTH  = (180 / (15 * Pi)) * AZIMUTH;
                zSunrise = zZawaal - AZIMUTH;
                zSunset  = zZawaal + AZIMUTH;
                zIftaar  = zSunset + 0.05;

                zIshraaq = zSunrise + 0.25;
                //zIshraaq = zSunrise + 0.0833333;

                double AZIMUTH2 = (((-1) * Math.Sin(FAJR_ANGLE * (PI / 180))) - ((Math.Sin(dblLatitude) * Math.Sin(DECLINATION)))) / (Math.Cos(dblLatitude) * Math.Cos((DECLINATION)));
                AZIMUTH2   = (Math.Acos(AZIMUTH2) * (180 / PI)) / 15;
                zSehriEnds = zZawaal - AZIMUTH2 - 0.083333333333;
                zFajr      = zZawaal - AZIMUTH2;

                if (Masjid.JuristMethod == JuristicMethod.UmmAlQuraUniversityMakkah)
                {
                    zIsha = zSunset + 0.05 + 1.5;
                }
                else
                {
                    double AZIMUTH3 = (((-1) * Math.Sin(ISHA_ANGLE * (PI / 180))) - ((Math.Sin(dblLatitude) * (Math.Sin(DECLINATION))))) / (Math.Cos(dblLatitude) * Math.Cos(DECLINATION));
                    AZIMUTH3 = (Math.Acos(AZIMUTH3) * (180 / PI)) / 15;
                    zIsha    = zZawaal + AZIMUTH3;
                }

                double CALC_ASAR1 = (Math.Atan(1 / (1 + Math.Tan((dblLatitude) - (DECLINATION))))) * (180 / PI);
                CALC_ASAR1 = (Math.Sin(CALC_ASAR1 * (PI / 180))) - (Math.Sin(dblLatitude) * Math.Sin(DECLINATION));
                CALC_ASAR1 = CALC_ASAR1 / (Math.Cos(dblLatitude) * Math.Cos(DECLINATION));
                CALC_ASAR1 = (Math.Acos(CALC_ASAR1) * (180 / PI)) / 15;
                zAsr1      = zZawaal + CALC_ASAR1;

                double CALC_ASAR2 = Math.Atan(1 / (2 + (Math.Tan(((dblLatitude) - (DECLINATION)))))) * (180 / PI);
                CALC_ASAR2 = (Math.Sin(CALC_ASAR2 * (PI / 180))) - (Math.Sin(dblLatitude) * Math.Sin(DECLINATION));
                CALC_ASAR2 = CALC_ASAR2 / (Math.Cos(dblLatitude) * Math.Cos(DECLINATION));
                CALC_ASAR2 = (Math.Acos(CALC_ASAR2) * (180 / PI)) / 15;
                zAsr2      = zZawaal + CALC_ASAR2;

                int Day   = Dval.Day;
                int Month = Dval.Month;
                int Year  = Dval.Year;

                SehriEnds = DoubleToDateTime(zSehriEnds, Year, Month, Day);
                Fajr      = DoubleToDateTime(zFajr, Year, Month, Day);
                Sunrise   = DoubleToDateTime(zSunrise, Year, Month, Day);
                Ishraaq   = DoubleToDateTime(zIshraaq, Year, Month, Day);

                Zawaal    = DoubleToDateTime(zZawaal, Year, Month, Day);
                Dhuhr     = Zawaal.AddMinutes(5);
                AsrShafi  = DoubleToDateTime(zAsr1, Year, Month, Day);
                AsrHanafi = DoubleToDateTime(zAsr2, Year, Month, Day);

                Sunset = DoubleToDateTime(zSunset, Year, Month, Day);

                if (Masjid.MaghribAdhaanDelay != 0)
                {
                    Maghrib = Sunset.AddMinutes(Masjid.MaghribAdhaanDelay);
                }
                else
                {
                    Maghrib = Sunset.AddMinutes(3);
                }


                Isha = DoubleToDateTime(zIsha, Year, Month, Day);
            }
            catch (Exception ex)
            {
            }
        }
예제 #26
0
        public void DBInit()
        {
            List <Models.TimeZone> TimeZones = Repository.GetAll <Models.TimeZone>().ToList();

            if (TimeZones.Count < 1)
            {
                foreach (var Zone in TimeZoneInfo.GetSystemTimeZones())
                {
                    Models.TimeZone T = new Models.TimeZone();
                    T.Id           = Zone.Id;
                    T.DaylightName = Zone.DaylightName;
                    T.DisplayName  = Zone.DisplayName;
                    T.StandardName = Zone.StandardName;
                    T.SupportsDaylightSavingTime = Zone.SupportsDaylightSavingTime;

                    T.DefaultUTCDifference = cCalculations.GetTimeZoneDifference(T.Id, DateTime.Now);

                    TimeZones.Add(T);
                }

                Repository.AddMultiple(TimeZones);
            }

            List <Masjid> AllMasjids = Repository.GetAll <Masjid>().ToList();

            //DB INIT
            if (AllMasjids.Count < 1)
            {
                Masjid s = new Masjid();
                s.Id             = "5f3e7169-ab20-4b34-bb27-2e86eefee2c1";
                s.Name           = "Masjid Muaadh bin Jabal - Crosby";
                s.Town           = "Johannesburg";
                s.Country        = "South Africa";
                s.Latitude       = -26.195149;
                s.Longitude      = 27.990238;
                s.OldSiteId      = 1;
                s.LadiesFacility = true;
                s.JummahFacility = true;
                s.Address        = "114 Jamestown Avenue Crosby Johannesburg 2092";
                s.Contact        = "Ml R Joosub, Ml S Maanjra, Br Abdur Rasheed, Br Faizal Suffla, Br Basheer Seedat";
                s.TimeZoneId     = "South Africa Standard Time";

                Repository.Add(s);
            }
            ////

            List <ApplicationUser> Users = Repository.GetAll <ApplicationUser>().ToList();

            if (Users.Count < 1)
            {
                var OmairEmail = "*****@*****.**";

                var user = new ApplicationUser
                {
                    UserName       = OmairEmail,
                    Email          = OmairEmail,
                    Id             = "513f1fe1-8e01-4c62-b332-ee8a0f7e2c29",
                    FullName       = "Omair Kazi",
                    EmailConfirmed = true,
                    ActiveStatus   = UserStatus.Active,
                    IsSuperUser    = true,
                    CreatedAt      = new DateTime(2016, 1, 1),
                    MasjidId       = "5f3e7169-ab20-4b34-bb27-2e86eefee2c1"
                };

                var Password = "******";

                var result = _userManager.CreateAsync(user, Password).Result;
            }
        }
예제 #27
0
        //Masjid

        public Masjid MasjidCreate(Masjid masjid)
        {
            return(Repository.Add(masjid));
        }
예제 #28
0
        public Masjid GetCountDown(Masjid Masjid)
        {
            MasjidCountDown CountDown = new MasjidCountDown();

            SalaahTime Times = _taqweemService.GetSalaahTime(Masjid, DateTime.Now);

            DateTime Now = DateTime.Now;

            cPerpetualTime PepTime = new cPerpetualTime(DateTime.Now, Masjid, false);

            if (Now.TimeOfDay < Times.FajrAdhaan.TimeOfDay)
            {
                CountDown.NextSalaah = "Fajr Adhaan";
                CountDown.CountDown  = TimeDiff(Times.FajrAdhaan);
                CountDown.SalaahTime = Times.FajrAdhaan.ToString("HH:mm");
            }
            else if (Now.TimeOfDay < Times.FajrSalaah.TimeOfDay)
            {
                CountDown.NextSalaah = "Fajr Salaah";
                CountDown.CountDown  = TimeDiff(Times.FajrSalaah);
                CountDown.SalaahTime = Times.FajrSalaah.ToString("HH:mm");
            }

            // JUMMAH//
            else if (Now.TimeOfDay < Times.JumuahAdhaan.TimeOfDay &&
                     Masjid.JummahFacility &&
                     Now.DayOfWeek == DayOfWeek.Friday)
            {
                CountDown.NextSalaah = "Jumuah Adhaan";
                CountDown.CountDown  = TimeDiff(Times.JumuahAdhaan);
                CountDown.SalaahTime = Times.JumuahAdhaan.ToString("HH:mm");
            }
            else if (Now.TimeOfDay < Times.JumuahSalaah.TimeOfDay &&
                     Masjid.JummahFacility &&
                     Now.DayOfWeek == DayOfWeek.Friday)
            {
                CountDown.NextSalaah = "Jumuah Salaah";
                CountDown.CountDown  = TimeDiff(Times.JumuahSalaah);
                CountDown.SalaahTime = Times.JumuahSalaah.ToString("HH:mm");
            }

            //DHUHR//
            else if (Now.TimeOfDay < Times.DhuhrAdhaan.TimeOfDay)
            {
                CountDown.NextSalaah = "Dhuhr Adhaan";
                CountDown.CountDown  = TimeDiff(Times.DhuhrAdhaan);
                CountDown.SalaahTime = Times.DhuhrAdhaan.ToString("HH:mm");
            }
            else if (Now.TimeOfDay < Times.DhuhrSalaah.TimeOfDay)
            {
                CountDown.NextSalaah = "Dhuhr Salaah";
                CountDown.CountDown  = TimeDiff(Times.DhuhrSalaah);
                CountDown.SalaahTime = Times.DhuhrSalaah.ToString("HH:mm");
            }

            else if (Now.TimeOfDay < Times.AsrAdhaan.TimeOfDay)
            {
                CountDown.NextSalaah = "Asr Adhaan";
                CountDown.CountDown  = TimeDiff(Times.AsrAdhaan);
                CountDown.SalaahTime = Times.AsrAdhaan.ToString("HH:mm");
            }
            else if (Now.TimeOfDay < Times.AsrSalaah.TimeOfDay)
            {
                CountDown.NextSalaah = "Asr Salaah";
                CountDown.CountDown  = TimeDiff(Times.AsrSalaah);
                CountDown.SalaahTime = Times.AsrSalaah.ToString("HH:mm");
            }

            else if (Now.TimeOfDay < PepTime.Maghrib.TimeOfDay)
            {
                CountDown.NextSalaah = "Maghrib";
                CountDown.CountDown  = TimeDiff(PepTime.Maghrib);
                CountDown.SalaahTime = PepTime.Maghrib.ToString("HH:mm");
            }

            else if (Now.TimeOfDay < Times.IshaAdhaan.TimeOfDay)
            {
                CountDown.NextSalaah = "Isha Adhaan";
                CountDown.CountDown  = TimeDiff(Times.IshaAdhaan);
                CountDown.SalaahTime = Times.IshaAdhaan.ToString("HH:mm");
            }
            else if (Now.TimeOfDay < Times.IshaSalaah.TimeOfDay)
            {
                CountDown.NextSalaah = "Isha Salaah";
                CountDown.CountDown  = TimeDiff(Times.IshaSalaah);
                CountDown.SalaahTime = Times.IshaSalaah.ToString("HH:mm");
            }
            else
            {
                //Check Next Days Fajr
                SalaahTime TomorrowsTime = _taqweemService.GetSalaahTime(Masjid, DateTime.Now.AddDays(1));
                CountDown.NextSalaah = "Fajr Adhaan";
                CountDown.CountDown  = "N/A";// TimeDiff(TomorrowsTime.FajrAdhaan);
                CountDown.SalaahTime = TomorrowsTime.FajrAdhaan.ToString("HH:mm");
            }

            Masjid.CountDown = CountDown;

            return(Masjid);
        }
예제 #29
0
        public IActionResult MasjidInfo(string Id)
        {
            Masjid Info = _taqweemService.MasjidGetByIdIncluded(Id);

            MasjidInfoViewModel Model = new MasjidInfoViewModel(Info);

            Model.Markers.Marker = _taqweemService.MasjidGetAll().ToList();

            Model.Users = _taqweemService.UsersGetByMasjidId(Id);

            Model.Notices = _taqweemService.NoticesGetByMasjidIdUnhidden(Id);


            //Get current salaah time for the masjid
            Model.SalaahTime = _taqweemService.GetSalaahTime(Info, DateTime.Now);

            //Get next salaah time change for the masjid
            Model.NextSalaahTime = _taqweemService.NextSalaahTime(Info, DateTime.Now);

            if (Model.NextSalaahTime != null)
            {
                DateTime val = new DateTime(DateTime.Now.Year, 1, 1);
                val = val.AddDays(Model.NextSalaahTime.DayNumber - 1);

                if (Model.NextSalaahTime.DayNumber < DateTime.Now.DayOfYear)
                {
                    val = new DateTime(DateTime.Now.Year + 1, 1, 1);
                    val = val.AddDays(Model.NextSalaahTime.DayNumber - 1);
                }

                Model.NextPerpetualTime = new cPerpetualTime(val, Info, false);

                Model.NextSalaahTime.IsFajrTimeChange = IsTimeDifferent(
                    Model.SalaahTime.FajrAdhaan,
                    Model.SalaahTime.FajrSalaah,
                    Model.NextSalaahTime.FajrAdhaan,
                    Model.NextSalaahTime.FajrSalaah);

                Model.NextSalaahTime.IsDhuhrTimeChange = IsTimeDifferent(
                    Model.SalaahTime.DhuhrAdhaan,
                    Model.SalaahTime.DhuhrSalaah,
                    Model.NextSalaahTime.DhuhrAdhaan,
                    Model.NextSalaahTime.DhuhrSalaah);

                Model.NextSalaahTime.IsSpecialDhuhrTimeChange = IsTimeDifferent(
                    Model.SalaahTime.SpecialDhuhrAdhaan,
                    Model.SalaahTime.SpecialDhuhrSalaah,
                    Model.NextSalaahTime.SpecialDhuhrAdhaan,
                    Model.NextSalaahTime.SpecialDhuhrSalaah);

                Model.NextSalaahTime.IsJumuahTimeChange = IsTimeDifferent(
                    Model.SalaahTime.JumuahAdhaan,
                    Model.SalaahTime.JumuahSalaah,
                    Model.NextSalaahTime.JumuahAdhaan,
                    Model.NextSalaahTime.JumuahSalaah);

                Model.NextSalaahTime.IsAsrTimeChange = IsTimeDifferent(
                    Model.SalaahTime.AsrAdhaan,
                    Model.SalaahTime.AsrSalaah,
                    Model.NextSalaahTime.AsrAdhaan,
                    Model.NextSalaahTime.AsrSalaah);

                Model.NextSalaahTime.IsIshaTimeChange = IsTimeDifferent(
                    Model.SalaahTime.IshaAdhaan,
                    Model.SalaahTime.IshaSalaah,
                    Model.NextSalaahTime.IshaAdhaan,
                    Model.NextSalaahTime.IshaSalaah);
            }

            return(View(Model));
        }