public IActionResult Index() { if (!HttpContext.Request.Query.TryGetValue("lat", out StringValues lat)) { return(BadRequest("lat must be sent")); } if (!HttpContext.Request.Query.TryGetValue("lng", out StringValues lng)) { return(BadRequest("lng must be sent")); } if (!HttpContext.Request.Query.TryGetValue("tz", out StringValues tz)) { return(BadRequest("tz must be sent")); } if (!double.TryParse(lat, out double dblLat)) { return(BadRequest("lat is an incorrect double")); } if (!double.TryParse(lng, out double dblLng)) { return(BadRequest("lng is an incorrect double")); } if (!double.TryParse(tz, out double dblTZ)) { return(BadRequest("tz is an incorrect double")); } var dt = DateTime.Now; if (HttpContext.Request.Query.TryGetValue("dt", out StringValues strdt)) { if (!DateTime.TryParse(strdt, out dt)) { return(BadRequest("dt is an incorrect double")); } } var p = new PrayTime(); p.setCalcMethod(PrayTime.Jafari); Console.WriteLine($"lat: { dblLat}"); Times = p.getDatePrayerTimes(dt.Year, dt.Month, dt.Day, dblLng, dblLat, dblTZ, 7); return(Ok(Times)); }
static void Main ( string [ ] args ) { PrayerTime p = new PrayTime(); double lo = 25; double la = 55; int y = 0 , m = 0 , d = 0 , tz = 0; DateTime cc = DateTime.Now; y = cc.Year; m = cc.Month; d = cc.Day; tz = TimeZone.CurrentTimeZone.GetUtcOffset(new DateTime (y,m,d)).Hours; String [] s ; p.setCalcMethod ( 2 ); p . setAsrMethod ( 0 ); s = p . getDatePrayerTimes ( y , m , d , lo , la , tz ); for(int i = 0 ; i < s.Length ; ++i ) { Console . WriteLine ( s [ i ] ); } }
static void Main(string [] args) { PrayerTime p = new PrayTime(); double lo = 25; double la = 55; int y = 0, m = 0, d = 0, tz = 0; DateTime cc = DateTime.Now; y = cc.Year; m = cc.Month; d = cc.Day; tz = TimeZone.CurrentTimeZone.GetUtcOffset(new DateTime(y, m, d)).Hours; String [] s; p.setCalcMethod(2); p.setAsrMethod(0); s = p.getDatePrayerTimes(y, m, d, lo, la, tz); for (int i = 0; i < s.Length; ++i) { Console.WriteLine(s [i]); } }
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result) { // #1 var activity = await result as Activity; string receivedMSG = (activity.Text).ToLower(); // #2 IMessageActivity reply = context.MakeMessage(); reply.Recipient = reply.Recipient; reply.Type = "message"; // #3 PrayTime p = new PrayTime(); string[] s = p.getDatePrayerTimes(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 24.7136, 46.6753, 3); // #4.1 if (iftar.Any(w => receivedMSG.Contains(w))) { if (time.Any(w => receivedMSG.Contains(w))) { reply.Text = ($"{s[5]} وقت أذان المغرب"); await context.PostAsync(reply); } else if (place.Any(w => receivedMSG.Contains(w))) { reply.AttachmentLayout = "carousel"; Attachment[] attachments = getTenants(); for (int i = 0; i < attachments.Length; i++) { reply.Attachments.Add(attachments[i]); } await context.PostAsync(reply); } else { reply.Text = ($"وضح لي أكثر. هل تسأل عن وقت الإفطار، أو مكان للإفطار؟"); await context.PostAsync(reply); } } // #4.2 else if (imsak.Any(w => receivedMSG.Contains(w))) { reply.Text = ($"{s[0]} وقت أذان الفجر"); await context.PostAsync(reply); } // #4.3 else if (tents.Any(w => receivedMSG.Contains(w))) { reply.AttachmentLayout = "carousel"; Attachment[] attachments = getTenants(); for (int i = 0; i < attachments.Length; i++) { reply.Attachments.Add(attachments[i]); } await context.PostAsync(reply); } // #4.4 else { CardImage cimage = new CardImage() { Url = "http://ar.assabile.com/media/category/310x242/date-ramadan-debut-ramadan-min.png" }; HeroCard card = new HeroCard() { Title = "أهلا بك في متحدث رمضان الآلي.", Subtitle = "تستطيع أن تسألني عن: وقت الفطور، وقت الإمساك، الخيمات الرمضانية.", Images = { cimage } }; // Add the card as an attachment of the reply Attachment plAttachment = card.ToAttachment(); reply.Attachments.Add(plAttachment); await context.PostAsync(reply); } // #5 context.Wait(MessageReceivedAsync); }