private void PostaviVrijeme() { Danas = Takvim.Danas; Application.Current.Dispatcher.Invoke( () => { GlavniSat.Time = DateTime.Now; Datum.RedText.Text = DateTime.Today.ToLongDateString(); Datum.SetDatum(Takvim.DrzavniPraznik); DatumHidzretski.SetHidzretskiDatum(Takvim.VjerskiPraznik); Datum.StyleDatum(); if (Danas == null) { return; } SetZora(); SetStyle(Podne, "Podne", Danas.Podne, Danas.Ikindija); SetStyle(Ikindija, "Ikindija", Danas.Ikindija, Danas.Aksam); SetStyle(Aksam, "Akšam", Danas.Aksam, Danas.Jacija); SetJacija(); }); }
/// <summary> /// 计算中奖情况 /// </summary> /// <param name="issueCode"></param> /// <param name="openResult"></param> /// <param name="item"></param> protected override void IssueCalculate(string issueCode, string openResult, BasicModel.LotteryBasic.BetDetail item) { //大小单双1,2,3,4,5 openResult = openResult.Replace(",", ""); if (openResult.Length == 5) { openResult = openResult.Remove(0, 3); } else { openResult = openResult.Remove(0, 1); } var res = openResult.Select(m => Convert.ToInt32(m.ToString())); var temp = item.BetContent.Split(','); var wd = res.First() >= 5 ? Da.ToString() : Xiao.ToString(); var wds = res.First() % 2 == 0 ? Shuang.ToString() : Dan.ToString(); var qd = res.Last() >= 5 ?Da.ToString(): Xiao.ToString(); var qds = res.Last() % 2 == 0 ? Shuang.ToString() : Dan.ToString(); var count = 0; count = temp[0].Split('-').Count(m => "-" + m.ToString() == wd || "-" + m.ToString() == wds) * temp[1].Split('-').Count(m => "-" + m.ToString() == qd || "-" + m.ToString() == qds); if (count > 0) { item.IsMatch = true; var stepAmt = 0m; item.WinMoney = TotalWinMoney(item, GetBaseAmt(item, ref stepAmt), stepAmt, count); } }
public HomeIndexVM() { Dani = new List <Dan>(); for (int i = 0; i < 7; i++) { //INICIJALIZACIJA Dana u sedmici Dan dan = new Dan(); dan.Value = i; DateTime danas = DateTime.Today; danas = danas.AddDays(i); //if (danas.DayOfWeek == DayOfWeek.Sunday) // dan.DanUSedmici="Nedjelja"; //else if (danas.DayOfWeek == DayOfWeek.Monday) // dan.DanUSedmici = "Ponedjeljak"; //else if (danas.DayOfWeek == DayOfWeek.Tuesday) // dan.DanUSedmici = "Utorak"; //else if (danas.DayOfWeek == DayOfWeek.Wednesday) // dan.DanUSedmici = "Srijeda"; //else if (danas.DayOfWeek == DayOfWeek.Thursday) // dan.DanUSedmici = "Četvrtak"; //else if (danas.DayOfWeek == DayOfWeek.Friday) // dan.DanUSedmici = "Petak"; //else if (danas.DayOfWeek == DayOfWeek.Saturday) // dan.DanUSedmici = "Subota"; dan.DanUSedmici = HelperMetode.DanUsedmiciBosanski(danas); Dani.Add(dan); } }
public async Task <IHttpActionResult> PutDan(int id, Dan dan) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != dan.DanId) { return(BadRequest()); } db.Entry(dan).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DanExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public static Dan Min(Dan a, Dan b) { bool r = a.distance < b.distance; // if (!r) MyStrategy.De("better "+b.distance); return(r? a : b); }
public static bool DodajEmisijuDnevnomRasporedu(TvProgram tvProgram, Emisija emisija, DnevniRaspored raspored, Dan i) { if (ProvjeriPripadnostEmisijeProgramu(tvProgram, emisija) == false) { return(false); } var daniEmisije = emisija.Dani.Count > 0; //ako ima dane, a trenutni dan nije taj dan if (daniEmisije && !emisija.Dani.Contains(i)) { Console.WriteLine("Emisija se ne izvodi u odabranom danu"); return(false); } //prioritet emisije 1. ( emisija ima i dan i pocetak emitiranja if (DodajPrioritetne(tvProgram, emisija, raspored, out var dodajEmisijuDnevnomRasporedu)) { return(dodajEmisijuDnevnomRasporedu); } //za sve ostale if (DodajPreostale(tvProgram, emisija, raspored)) { return(true); } return(false); }
public DanDetailsPage(Dan dan) { BindingContext = model = new DanDetailsViewModel { Dan = dan }; InitializeComponent(); }
public void kreirajOsnovniRaspored(List <Program> listaProgram, List <EmitiranjeEmisija> listaEmisija, TvProgrami program) { RasporedEmisija = new TvProgrami(program.Id, program.Naziv, program.Pocetak, program.Kraj, program.NazivDatoteke); Dan d = new Dan(1, "Ponedjeljak"); RasporedEmisija.Add(new DanComposite(d)); program.listaDana.Add(new DanComposite(d)); d = new Dan(2, "Utorak"); program.listaDana.Add(new DanComposite(d)); RasporedEmisija.Add(new DanComposite(d)); d = new Dan(3, "Srijeda"); RasporedEmisija.Add(new DanComposite(d)); program.listaDana.Add(new DanComposite(d)); d = new Dan(4, "Cetvrtak"); RasporedEmisija.Add(new DanComposite(d)); program.listaDana.Add(new DanComposite(d)); d = new Dan(5, "Petak"); RasporedEmisija.Add(new DanComposite(d)); program.listaDana.Add(new DanComposite(d)); d = new Dan(6, "Subota"); RasporedEmisija.Add(new DanComposite(d)); program.listaDana.Add(new DanComposite(d)); d = new Dan(7, "Nedjelja"); RasporedEmisija.Add(new DanComposite(d)); program.listaDana.Add(new DanComposite(d)); emisijeSPocetkom(listaProgram, listaEmisija); program.listaDana = ((TvProgrami)RasporedEmisija).listaDana; }
/// <summary> /// 计算中奖情况 /// </summary> /// <param name="issueCode"></param> /// <param name="openResult"></param> /// <param name="item"></param> protected override void IssueCalculate(string issueCode, string openResult, BasicModel.LotteryBasic.BetDetail item) { //大小单双6,8,0,1,5 单双单 var res = openResult.Remove(0, 4).Split(',').Select(m => Convert.ToInt32(m)).ToList(); var temp = item.BetContent.Split(','); var bd = res[0] >= 5 ? Da.ToString() : Xiao.ToString(); var bds = res[0] % 2 == 0 ? Shuang.ToString() : Dan.ToString(); var sd = res[1] >= 5 ? Da.ToString() : Xiao.ToString(); var sds = res[1] % 2 == 0 ? Shuang.ToString(): Dan.ToString(); var gd = res[2] >= 5 ? Da.ToString(): Xiao.ToString(); var gds = res[2] % 2 == 0 ? Shuang.ToString() : Dan.ToString(); var count = 0; count = temp[0].Split('-').Count(m => "-" + m.ToString() == bd || "-" + m.ToString() == bds) * temp[1].Split('-').Count(m => "-" + m.ToString() == sd || "-" + m.ToString() == sds) * temp[2].Split('-').Count(m => "-" + m.ToString() == gd || "-" + m.ToString() == gds); if (count > 0) { item.IsMatch = true; var stepAmt = 0m; item.WinMoney = TotalWinMoney(item, GetBaseAmt(item, ref stepAmt), stepAmt, count); } }
private static void DodajDaneSEmisijamaProgramu(IBuilderProgram programBuilder, Program program, ref int redniBroj) { for (int i = 1; i <= 7; i++) { Dan dan = new Dan(Enum.GetName(typeof(Enumeracije.Dani), i)); List <EmisijePrograma> listaProgramaOdredenogDana = new List <EmisijePrograma>(); List <EmisijePrograma> emisijeSPocetkomIDanom = program.EmisijePrograma .Where(e => e.DaniUTjednu.Contains(i) && e.ImaPočetak).OrderBy(e => e.Pocetak).ToList(); listaProgramaOdredenogDana = programBuilder.DodajEmisijeSaDanimaIPocetkom(program, emisijeSPocetkomIDanom, listaProgramaOdredenogDana); List <EmisijePrograma> emisijeSDanomBezPocetka = program.EmisijePrograma .Where(e => e.DaniUTjednu.Contains(i) && !e.ImaPočetak).OrderBy(e => e.Pocetak).ToList(); listaProgramaOdredenogDana = programBuilder.DodajEmisijeSaDanimaBezPocetka(program, emisijeSDanomBezPocetka, listaProgramaOdredenogDana); List <EmisijePrograma> emisijeBezDanaIBezPocetka = program.EmisijePrograma .Where(e => e.DaniUTjednu.Count == 0 && !e.ImaPočetak).ToList(); listaProgramaOdredenogDana = programBuilder.DodajEmisijeBezDanaIPocetka(program, emisijeBezDanaIBezPocetka, listaProgramaOdredenogDana); foreach (var emisijaPrograma in listaProgramaOdredenogDana) { emisijaPrograma.RedniBroj = redniBroj; redniBroj++; emisijaPrograma.DodajElementRasporeda(emisijaPrograma); dan.DodajElementRasporeda(emisijaPrograma); } program.DodajElementRasporeda(dan); } }
public int CompareTo(object o) { Dan d = (Dan)o; double dd = (distance - d.distance); return(dd < 0 ? -1 : dd > 0 ? 1 : 0); }
private Dan LoadDanFromXml(SecurityElement element) { Dan dan = new Dan { ResourseId = StrParser.ParseHexInt(element.Attribute("ResourseId"), 0), Type = TypeNameContainer <_DanType> .Parse(element.Attribute("Type"), 0), Name = StrParser.ParseStr(element.Attribute("Name"), string.Empty) }; if (element.Children != null) { foreach (SecurityElement element2 in element.Children) { string tag = element2.Tag; if (tag != null) { if (tag == "LevelInfo") { dan.LevelInfos.Add(this.LoadLevelInfoFromXml(element2)); } else if (tag == "BreakthoughtInfo") { goto Label_00AE; } } continue; Label_00AE: dan.BreakthoughtInfos.Add(this.LoadBreakthoughtInfoFromXml(element2)); } } return(dan); }
public ActionResult DeleteConfirmed(int id) { Dan dan = db.Dan.Find(id); db.Dan.Remove(dan); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "DanId,Naziv")] Dan dan) { if (ModelState.IsValid) { db.Entry(dan).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dan)); }
public IHttpActionResult GetTenDan(int idDan) { Dan dan = db.Dans.Find(idDan); if (dan == null) { return(NotFound()); } return(Ok(dan.ho_ten)); }
public async Task <IHttpActionResult> GetDan(int id) { Dan dan = await db.Dan.FindAsync(id); if (dan == null) { return(NotFound()); } return(Ok(dan)); }
public ActionResult Create([Bind(Include = "DanId,Naziv")] Dan dan) { if (ModelState.IsValid) { db.Dan.Add(dan); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dan)); }
public IHttpActionResult GetDanLogin(string email, string password) { Dan dan = db.Dans.Where(d => d.email == email).FirstOrDefault(); if (dan == null || dan.pass_word != password) { return(NotFound()); } return(Ok(dan)); }
public DanComposite getDan(int i) { foreach (DanComposite d in listaDana) { Dan dan = d.Dan; if (dan.Id == i) { return(d); } } return(null); }
public IHttpActionResult PostDan(Dan dan) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Dans.Add(dan); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = dan.ma_dan }, dan)); }
public async Task <IHttpActionResult> PostDan(Dan dan) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Dan.Add(dan); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = dan.DanId }, dan)); }
// GET: Dans/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Dan dan = db.Dan.Find(id); if (dan == null) { return(HttpNotFound()); } return(View(dan)); }
public IHttpActionResult DeleteDan(int id) { Dan dan = db.Dans.Find(id); if (dan == null) { return(NotFound()); } db.Dans.Remove(dan); db.SaveChanges(); return(Ok(dan)); }
public MainPage() { InitializeComponent(); Button.Clicked += (sender, e) => { Dan.Url = URL.Text; Dan.StarStream(); }; ButtonStop.Clicked += (sender, e) => { Dan.StopStream(); }; Dan.OnConnectionSuccesStream += OnStartStream; }
public async Task <IHttpActionResult> DeleteDan(int id) { Dan dan = await db.Dan.FindAsync(id); if (dan == null) { return(NotFound()); } db.Dan.Remove(dan); await db.SaveChangesAsync(); return(Ok(dan)); }
public override int GetHashCode() { unchecked { int result = 14; if (Dan != null) { result = 29 * result + Dan.GetHashCode(); } if (Mesec != null) { result = 29 * result + Mesec.GetHashCode(); } if (Godina != null) { result = 29 * result + Godina.GetHashCode(); } return(result); } }
public IActionResult SpremiPlanIProgram(AdministracijaDodajPlanIProgramVM model) { if (!ModelState.IsValid) { model.Kategorije = service.getKategorije().Select(k => new SelectListItem { Value = k.ID.ToString(), Text = k.Naziv }).ToList(); return(View("DodajPlanIProgram", model)); } PlanIProgram planIProgram = new PlanIProgram { KategorijaID = model.KategorijaId, Naziv = model.Naziv, Opis = model.Opis }; service.DodajPlanIProgram(planIProgram); for (int i = 1; i <= model.BrojSedmica; i++) { Sedmica sedmica = new Sedmica { PlanIProgramID = planIProgram.ID, RedniBroj = i }; service.DodajSedmicu(sedmica); for (int j = 1; j <= 7; j++) { Dan dan = new Dan { SedmicaID = sedmica.ID, RedniBroj = j }; service.DodajDan(dan); } } return(RedirectToAction("PrikazPlanIProgram", new { planID = planIProgram.ID })); }
public static bool CollideWithArena(ref Vec a, bool verb) { double rimbalzo; if (a.r == 1) { rimbalzo = rules.ROBOT_ARENA_E; } else { rimbalzo = rules.BALL_ARENA_E; } Dan dta = a.DanToArena(); double penet = a.r - dta.distance; if (penet <= 0) { return(false); } if (verb) { De("penet=" + penet); } a.DoAdd(dta.normal.Mul(penet)); double vel = a.VelocityVec().Dot(dta.normal) - a.rcs; if (vel < 0) { Vec zs = dta.normal.Mul(-vel * (1 + rimbalzo)); if (verb) { De("vel added " + zs.x + " " + zs.y + " " + zs.z); } a.AddVelocity(zs); return(true); } return(false); }
public ActionResult SavePin(CreatePinVM model) { if (!ModelState.IsValid) { return(Json(new { Message = "You messed up" })); } var userid = User.Identity.GetUserId(); var user = db.Users.Find(userid); var dan = new Dan() { Owner = user, CreatedOn = DateTime.UtcNow, Description = model.Description, PhotoUrl = model.PhotoUrl, LinkUrl = string.IsNullOrEmpty(model.LinkUrl) ? model.PhotoUrl : model.LinkUrl }; db.Dans.Add(dan); db.SaveChanges(); var result = new { dan.PhotoUrl, dan.LinkUrl, DanId = dan.Id, CreatedOn = dan.CreatedOn.Humanize(), dan.Description, CreatedBy = dan.Owner.UserName, NumOfComments = dan.Comments.Count() }; return(Json(result)); }
private async Task PostaviVrijeme() { Danas = Takvim.Danas; await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, () => { GlavniSat.Time = DateTime.Now; Datum.SetDatum(Takvim.DrzavniPraznik); DatumHidzretski.SetHidzretskiDatum(Takvim.VjerskiPraznik); if (Danas == null) { return; } SetZora(); SetStyle(Podne, "Podne ", Danas.Podne, Danas.Ikindija); SetStyle(Ikindija, "Ikindija", Danas.Ikindija, Danas.Aksam); SetStyle(Aksam, "Akšam ", Danas.Aksam, Danas.Jacija); SetJacija(); }); }