public async Task SetBlackAsync(BlackInfo salaryinfo, string id = null, CancellationToken cle = default(CancellationToken)) { if (salaryinfo == null) { throw new ArgumentNullException(nameof(salaryinfo)); } if (id != null) { HumanInfo buildings = new HumanInfo() { Id = id, StaffStatus = StaffStatus.Leave }; Context.Attach(buildings); var entry = Context.Entry(buildings); entry.Property(x => x.StaffStatus).IsModified = true; } if (Context.BlackInfos.Any(x => x.IDCard == salaryinfo.IDCard)) { Context.Attach(salaryinfo); Context.Update(salaryinfo); } else { Context.Add(salaryinfo); } await Context.SaveChangesAsync(cle); }
public async Task DeleteBlackAsync(BlackInfo monthinfo, CancellationToken cancellationToken = default(CancellationToken)) { if (monthinfo == null) { throw new ArgumentNullException(nameof(monthinfo)); } Context.Remove(monthinfo); await Context.SaveChangesAsync(cancellationToken); }
private async void Hamta() { try { ProgressRing1.Visibility = Visibility.Visible; int GruppID = 0; int FtgId = 0; var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; Object valueGrupp = localSettings.Values["grupp"]; DateTime today = DateTime.Today; if (valueGrupp == null) { // No data } else { GruppID = int.Parse(valueGrupp.ToString()); } Object valueFtgId = localSettings.Values["id"]; if (valueFtgId == null) { // No data } else { FtgId = int.Parse(valueFtgId.ToString()); } ServiceBlackSoapClient klient = new ServiceBlackSoapClient(); var s = await klient.getTVjsonAsync(FtgId, GruppID, today); string ss = s.Body.getTVjsonResult; var j = JsonConvert.DeserializeObject <List <BlackInfo> >(ss); foreach (var item in j) { BlackInfo b = new BlackInfo(); b.ForetagsID = item.ForetagsID; string HTML = "<!DOCTYPE html>" + "<html>" + "<head>" + "<title> BLACKTV </title>" + "<meta charset = utf - 8 />" + "<meta name = viewport content = width = device - width, initial - scale = 1.0, maximum - scale = 1.0, user - scalable = no/>" + "<!--Latest compiled and minified CSS -->" + "<link rel = stylesheet href='ms-appx-web:///Resources/bootstrap.min.css'>" + "<!--Optional theme-- >" + "<link rel = stylesheet href='ms-appx-web:///Resources/bootstrap-theme.min.css'>" + "<script src='ms-appx-web:///Resources/jquery-3.1.0.min.js'></script>" + "<!--Latest compiled and minified JavaScript -->" + "<script src ='ms-appx-web:///Resources/bootstrap.min.js'></script>" + "</head >" + "<body >" + item.info + "</body></html > "; b.info = HTML; b.Video = item.Video; B.Add(b); } iAntal = B.Count; iNu = 0; visare.NavigateToString(B[iNu].info); timer.Start(); } catch (Exception x) { string s = x.Message.ToString(); } }
/// <summary> /// /// </summary> /// <param name="data"></param> public void Add(BlackInfo data) { Cache.SetCache(data.Id, data, data.UnfreezeTime - DateTime.Now, ExpireType.Absolute); }