public DataRow UpdateRow(BasePostObject input, UpdateKind updateKind) { DataRow row; if (updateKind == UpdateKind.Insert) { SetCommands(AdapterCommand.Insert); row = NewRow(); } else { SetCommands(AdapterCommand.Update); row = SelectRowWithKeys(input.Info.ReportId); } row.BeginEdit(); input.Info.AddToDataRow(row, WriteSettings); if (updateKind == UpdateKind.Insert) row["ReportId"] = CreateUniId(); //row["Company"] = input.Info.Company; //row["ReportName"] = input.Info.ReportName; //row["ReportType"] = input.Info.ReportType; //row["ReportDate"] = input.Info.ReportDate.ToString("yyyyMM"); row["ReportData"] = input.WriteXml(); UpdateTrackField(updateKind, row); row.EndEdit(); UpdateDatabase(); return row; }
public void UpdateTrackField(UpdateKind status, DataRow row) { TkDebug.AssertArgumentNull(row, "row", this); // 保证在工作线程中,该代码不会出错。工作线程中UserId要报错 object userId = DBNull.Value; try { userId = BaseGlobalVariable.UserId; } catch { } switch (status) { case UpdateKind.Insert: row["CreateDate"] = row["UpdateDate"] = DateTime.Now; row["CreateId"] = row["UpdateId"] = userId; break; case UpdateKind.Update: row["UpdateDate"] = DateTime.Now; row["UpdateId"] = userId; break; } }
public override bool DeSerialize(byte[] data, Pointer p) { base.DeSerialize(data, p); Phase = BitPacker.GetSerializableWispObject(data, p) as Phase; PhaseUpdateKind = (PacketPhaseUpdate.UpdateKind)BitPacker.GetByte(data, p); return true; }
internal void DeleteRow(DataRow row, UpdateKind invokeMethod, DataSet postDataSet, IInputData inputData) { fUpdatingArgs.SetProperties(row, UpdateKind.Delete, invokeMethod, null, postDataSet, inputData); UpdateRow(fUpdatingArgs); row.Delete(); }
/// <summary> /// Updates Kind /// </summary> /// <param name="viewModel">Injected <see cref="UpdateKind"/></param> /// <returns>Instance of <see cref="Task{ViewKind}"/></returns> public async Task <ViewKind> UpdateKind(UpdateKind @viewModel) { await CheckName(@viewModel); Kind @Kind = await FindKindById(@viewModel.Id); @Kind.Name = @viewModel.Name; @Kind.ImageUri = @viewModel.ImageUri; try { Context.Kind.Update(@Kind); await Context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { await CheckName(@viewModel); } // Log string @logData = @Kind.GetType().Name + " with Id " + @Kind.Id + " was modified at " + DateTime.Now.ToShortTimeString(); Logger.WriteUpdateItemLog(@logData); return(Mapper.Map <ViewKind>(@Kind)); }
public override bool DeSerialize(byte[] data, Pointer p) { base.DeSerialize(data, p); Phase = BitPacker.GetSerializableWispObject(data, p) as Phase; PhaseUpdateKind = (PacketPhaseUpdate.UpdateKind)BitPacker.GetByte(data, p); return(true); }
/// <summary> /// Checks Name /// </summary> /// <param name="viewModel">Injected <see cref="UpdateKind"/></param> /// <returns>Instance of <see cref="Task{Kind}"/></returns> public async Task <Kind> CheckName(UpdateKind @viewModel) { Kind @Kind = await Context.Kind .TagWith("CheckName") .AsNoTracking() .FirstOrDefaultAsync(x => x.Name == @viewModel.Name && x.Id != viewModel.Id); if (@Kind != null) { // Log string @logData = @Kind.GetType().Name + " with Name " + @Kind.Name + " was already found at " + DateTime.Now.ToShortTimeString(); Logger.WriteGetItemFoundLog(@logData); throw new Exception(@Kind.GetType().Name + " with Name " + @viewModel.Name + " already exists"); } return(Kind); }
private void CopyInsertTable(DataTable postTable, bool isInsert, UpdateKind invokeMethod, IInputData inputData) { SetCommands(AdapterCommand.Insert); DataTable dstTable = HostTable; if (dstTable == null) { dstTable = SelectTableStructure(); } DataRow dstRow; int i = 0; foreach (DataRow srcRow in postTable.Rows) { bool isInsertRow = false; if (!isInsert || dstTable.Rows.Count <= i) { dstRow = dstTable.NewRow(); isInsertRow = true; } else { dstRow = dstTable.Rows[i]; } CopyRow(srcRow, dstRow, i++); if (isInsertRow) { dstTable.Rows.Add(dstRow); } fUpdatingArgs.SetProperties(dstRow, UpdateKind.Insert, invokeMethod, srcRow, null, inputData); UpdateRow(fUpdatingArgs); } }
public void ChangeKillCount(object obj) { //Debug.Log("ChangeKillCount"); m_currentKillNum = (ushort)obj; // Stateupdate=true; CurrentState = UpdateKind.UpdateKill; ChangeState(CurrentState); }
public void ChangeHitCount(object obj) { //Debug.Log("ChangeHitCount"); m_currentHitNum = (ushort)obj; CoolDownTime = DefaultTime; CurrentState = UpdateKind.UpdateHit; ChangeState(CurrentState); }
internal void SetProperties(DataRow row, UpdateKind status, UpdateKind invokeMethod, DataRow postDataRow, DataSet postDataSet, IInputData inputData) { Row = row; Status = status; InvokeMethod = invokeMethod; PostDataRow = postDataRow; PostDataSet = postDataRow == null ? postDataSet : postDataRow.Table.DataSet; InputData = inputData; }
private List<CorpUser> GetList(UpdateKind kind) { List<CorpUser> list; if (fDictionary.TryGetValue(kind, out list)) return list; list = new List<CorpUser>(); fDictionary.Add(kind, list); return list; }
/// <summary> /// 拷贝合并的数据 /// </summary> /// <param name="postTable">提交的数据表,可以为空</param> /// <param name="postDataSet">提交的数据集</param> private void CopyMergeTable(DataTable postTable, DataSet postDataSet, IInputData inputData) { SetCommands(AdapterCommand.All); DataTable dstTable = HostTable; if (dstTable == null) { dstTable = SelectTableStructure(); } if (postTable == null) { foreach (DataRow row in dstTable.Rows) { DeleteRow(row, UpdateKind.Update, postDataSet, inputData); } return; } SetPrimaryKeys(postTable); SetPrimaryKeys(dstTable); int i = 0; foreach (DataRow row in postTable.Rows) { UpdateKind status = UpdateKind.Update; DataRow dstRow = FindRow(dstTable, row); bool isInsert = (dstRow == null); if (dstRow == null) { dstRow = dstTable.NewRow(); status = UpdateKind.Insert; } CopyRow(row, dstRow, i++); fUpdatingArgs.SetProperties(dstRow, status, UpdateKind.Update, row, null, inputData); UpdateRow(fUpdatingArgs); if (isInsert) { dstTable.Rows.Add(dstRow); } } foreach (DataRow row in dstTable.Rows) { if (row.RowState == DataRowState.Added) { continue; } DataRow srcRow = FindRow(postTable, row); if (srcRow == null) { DeleteRow(row, UpdateKind.Update, postDataSet, inputData); } } }
/// <summary> /// Initializes a new instance of the ResolverConfig class. /// </summary> public ResolverConfig(TableResolver resolver, PageStyle style, UpdateKind kind, UpdateMode mode, bool disposeResolver) { TkDebug.AssertArgumentNull(resolver, "resolver", this); Resolver = resolver; resolver.UpdateMode = mode; Kind = kind; Mode = mode; Style = style; fDisposeResolver = disposeResolver; }
public void Reveal(Vector2 position, UpdateKind reveal) { var update = WorldToTextureSpace(position); if (reveal == UpdateKind.Reveal) { updateOn.Add(update); } else { updateOff.Add(update); } }
private List <CorpUser> GetList(UpdateKind kind) { List <CorpUser> list; if (fDictionary.TryGetValue(kind, out list)) { return(list); } list = new List <CorpUser>(); fDictionary.Add(kind, list); return(list); }
private void CopyDelInsTable(DataTable postTable, UpdateKind invokeMethod, IInputData inputData) { SetCommands(AdapterCommand.Insert); DataTable dstTable = HostTable; int i = 0; foreach (DataRow srcRow in postTable.Rows) { DataRow dstRow = dstTable.NewRow(); CopyRow(srcRow, dstRow, i++); fUpdatingArgs.SetProperties(dstRow, UpdateKind.Insert, invokeMethod, srcRow, null, inputData); UpdateRow(fUpdatingArgs); dstTable.Rows.Add(dstRow); } }
public object Process(IDbDataSource host, IFieldUpload upload, DataRow row, UpdateKind kind) { switch (kind) { case UpdateKind.Insert: string path = row[upload.ServerPathField].ToString(); if (!string.IsNullOrEmpty(path)) { return(InsertAttachment(host, upload, row, path)); } break; case UpdateKind.Update: string originalPath = row[upload.ServerPathField, DataRowVersion.Original].ToString(); string newPath = row[upload.ServerPathField].ToString(); if (originalPath != newPath) { if (string.IsNullOrEmpty(originalPath)) { // 原先没有,当前实际是新建 return(InsertAttachment(host, upload, row, newPath)); } else if (string.IsNullOrEmpty(newPath)) { // 现在没有,当前实际是删除 var result = DeleteAttachment(host, upload, row, originalPath); row[upload.FileNameField] = DBNull.Value; return(result); } else { // 原先和现在都有,当前实际是覆盖 return(UpdateAttachment(host, upload, row, originalPath, newPath)); } } break; case UpdateKind.Delete: if (row[upload.ContentField] != DBNull.Value) { return(DeleteAttachment(host, upload, row, row[upload.ServerPathField].ToString())); } break; } return(null); }
internal List <FieldInfoEventArgs> GetFieldInfo(UpdateKind status) { List <FieldInfoEventArgs> result = new List <FieldInfoEventArgs>(); foreach (IFieldInfo fieldInfo in FieldList) { SqlPosition position = fieldInfo.IsAutoInc ? SqlPosition.None : SqlPosition.Update; if (IsKey(fieldInfo.NickName)) { position |= SqlPosition.Where; } FieldInfoEventArgs args = new FieldInfoEventArgs(fieldInfo, status, position); result.Add(args); OnSetFieldInfo(args); } return(result); }
private void CheckPartitionAndRowKeys(string partitionKey, string rowKey, UpdateKind updateType) { if (partitionKey == null || rowKey == null) { throw new TableServiceGeneralException(TableServiceError.PropertiesNeedValue, null); } bool flag = (updateType == UpdateKind.Insert || updateType == UpdateKind.InsertOrMerge ? true : updateType == UpdateKind.InsertOrReplace); if (flag && partitionKey.Length > 255) { throw new TableKeyTooLargeException(KeyType.PartitionKey); } if (flag && rowKey.Length > 255) { throw new TableKeyTooLargeException(KeyType.RowKey); } }
protected virtual async Task <bool> StartUpdateWhenReady(UpdateKind updateKind, Guid token, [CallerMemberName] string callName = "") { if (callName != "") { CurrentUpdateMethod = callName; if (TaskStatus.ContainsKey(token)) { TaskStatus[token] = updateKind; } else { TaskStatus.Add(token, updateKind); } SetDatabaseStatus(); } return(await Task.FromResult(true)); }
internal UpdateSummary( UpdateKind kind, DateTimeOffset startTime, string message, IDictionary <string, string> environment, IDictionary <string, ConfigValue> config, UpdateState result, DateTimeOffset endTime, int?version, string?deployment, IDictionary <OperationType, int>?resourceChanges) { this.Kind = kind; this.StartTime = startTime; this.Message = message; this.Environment = environment.ToImmutableDictionary(); this.Config = config.ToImmutableDictionary(); this.Result = result; this.EndTime = endTime; this.Version = version; this.Deployment = deployment; this.ResourceChanges = resourceChanges?.ToImmutableDictionary(); }
public ApplicationUpdate(DateTime datePublished, string title, string htmlBody, Version currentVersion, Version updateVersion, Uri downloadLink, UpdateKind kind, string updaterArguments, bool isRestartRequired) { paths = PlatformTypes.New <IPathProvider>(); DatePublished = datePublished; Title = title = title != null ? title : string.Empty; HtmlBody = htmlBody = htmlBody != null ? htmlBody : string.Empty; CurrentVersion = currentVersion; UpdateVersion = updateVersion; DownloadLink = downloadLink; Kind = kind; UpdaterArguments = updaterArguments != null ? updaterArguments : string.Empty; IsRestartRequired = isRestartRequired; var targetDir = Path.Combine(paths.ApplicationDataFolder, "updates"); if (!Directory.Exists(targetDir)) { Directory.CreateDirectory(targetDir); } // XXX TODO - Problems on non-windows plats? Do we care? UpdateFileLocalPath = Path.Combine(targetDir, Path.GetFileName(DownloadLink.LocalPath)); }
public ApplicationUpdate(DateTime datePublished, string title, string htmlBody, Version currentVersion, Version updateVersion, Uri downloadLink, UpdateKind kind, string updaterArguments, bool isRestartRequired) { DatePublished = datePublished; Title = title = title != null ? title : string.Empty; HtmlBody = htmlBody = htmlBody != null ? htmlBody : string.Empty; CurrentVersion = currentVersion; UpdateVersion = updateVersion; DownloadLink = downloadLink; Kind = kind; UpdaterArguments = updaterArguments != null ? updaterArguments : string.Empty; IsRestartRequired = isRestartRequired; var targetDir = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); targetDir = Path.Combine(targetDir, Process.GetCurrentProcess().ProcessName); if (!Directory.Exists(targetDir)) { Directory.CreateDirectory(targetDir); } // XXX TODO - Problems on non-windows plats? Do we care? UpdateFileLocalPath = Path.Combine(targetDir, Path.GetFileName(DownloadLink.LocalPath)); }
public object Process(IDbDataSource host, IFieldUpload upload, IFieldValueAccessor provider, UpdateKind kind) { switch (kind) { case UpdateKind.Insert: string path = provider[upload.ServerPathField].ToString(); if (!string.IsNullOrEmpty(path)) { return(InsertAttachment(host, upload, provider, path)); } break; case UpdateKind.Update: string originalPath = provider.GetOriginValue(upload.ServerPathField).ToString(); string newPath = provider[upload.ServerPathField].ToString(); if (originalPath != newPath) { if (string.IsNullOrEmpty(originalPath)) { // 原先没有,当前实际是新建 return(InsertAttachment(host, upload, provider, newPath)); } else if (string.IsNullOrEmpty(newPath)) { // 现在没有,当前实际是删除 var result = DeleteAttachment(host, upload, provider, originalPath); provider.SetValue(upload.FileNameField, DBNull.Value); return(result); } else { // 原先和现在都有,当前实际是覆盖 return(UpdateAttachment(host, upload, provider, originalPath, newPath)); } } break; case UpdateKind.Delete: if (provider[upload.ContentField] != DBNull.Value) { return(DeleteAttachment(host, upload, provider, provider[upload.ServerPathField].ToString())); } break; } return(null); }
void ChangeState(UpdateKind updateKind) { if (updateKind == UpdateKind.None) { return; } if (updateKind == UpdateKind.UpdateHit) { ComCombo_Num_animator.SetInteger("state", 0); if (m_currentHitNum == 0) { // Debug.Log("清"); // Debug.Log("连击中断"); FirstHitAppear = false; FirstKillAppear = false; ComCombo_Num_animatorPlay(HitState.OnlyHit_BreakOff); Combo_Txt_animatorPlay(HitState.OnlyHit_BreakOff); Combo_KillTxt_animatorPlay(HitState.OnlyHit_BreakOff); Combo_KillNum_animatorPlay(HitState.OnlyHit_BreakOff); Combo_CD_animatorPlay(HitState.OnlyHit_BreakOff); JH_Eff_UI_Combo_KillTxt_Star.SetActive(false); JH_Eff_UI_Combo_Txt_Star.SetActive(false); if (m_currentKillNum != 0) { Combo_Txt_animatorPlay(HitState.Kill_HitBreakOff); m_currentKillNum = 0; } m_currentKillNum = 0; return; } if (m_currentKillNum < 1) { if (!FirstHitAppear) { FirstHitAppear = true; ComCombo_Num_animatorPlay(HitState.StartHit); Combo_Txt_animatorPlay(HitState.StartHit); Combo_CD_animatorPlay(HitState.StartHit); Combo_Num_Star_Lable.SetText(m_currentHitNum); //Debug.Log(" 仅连击——连击chuanxian"+m_currentHitNum); } else if (m_currentHitNum > 1) { if (JH_Eff_UI_Combo_Num_Star.activeSelf) { Combo_Num_Star_Lable.SetText(m_currentHitNum); // ComCombo_Num_animatorPlay(HitState.OnlyHit_HitAdd); //ComCombo_Num_animator.Play("Eff_lzzjshuzi"); } //Debug.Log(" 仅连击——连击增加"+m_currentHitNum); } } else { if (m_currentHitNum <= 1) { //现有连杀后有连击,报错 // Debug.Log("先有连杀后有连击,报错"); } else { Combo_Num_Star_Lable.SetText(m_currentHitNum); //Combo_Txt_animator.Play(""); // ComCombo_Num_animator.SetInteger("state",0); ComCombo_Num_animatorPlay(HitState.Kill_HitAdd); //Debug.Log("连杀——连击增加"+m_currentHitNum); } } } else if (updateKind == UpdateKind.UpdateKill) { Combo_KillNum_animatorPlay(HitState.DefultSate); if (m_currentHitNum == 0) { // Debug.Log("清0"); //Debug.Log("连击中断"); FirstHitAppear = false; FirstKillAppear = false; ComCombo_Num_animatorPlay(HitState.Kill_HitBreakOff); Combo_Txt_animatorPlay(HitState.Kill_HitBreakOff); Combo_KillTxt_animatorPlay(HitState.Kill_HitBreakOff); Combo_KillNum_animatorPlay(HitState.Kill_HitBreakOff); Combo_CD_animatorPlay(HitState.Kill_HitBreakOff); JH_Eff_UI_Combo_KillTxt_Star.SetActive(false); JH_Eff_UI_Combo_Txt_Star.SetActive(false); m_currentKillNum = 0; return; } if (m_currentHitNum < 1) { //Debug.Log("先有连杀后有连击,报错"); } else { if (!FirstKillAppear) { FirstKillAppear = true; // JH_Eff_UI_Combo_KillTxt_Star.SetActive(true); // JH_Eff_UI_Combo_KillNum_Star.SetActive(true); Combo_Txt_animatorPlay(HitState.StartKill); ComCombo_Num_animatorPlay(HitState.StartKill); Combo_KillTxt_animatorPlay(HitState.StartKill); Combo_KillNum_animatorPlay(HitState.StartKill); Combo_KillNum_Lable.SetText(m_currentKillNum); //Debug.Log("连杀__连杀出现"+m_currentKillNum); } else { Combo_KillNum_animatorPlay(HitState.Kill_KillAdd); //Combo_KillTxt_animator.SetInteger("state",6); Combo_KillNum_Lable.SetText(m_currentKillNum); //Debug.Log("连杀__连杀增加"+m_currentKillNum); } } } else { //Debug.Log("连击中断"); } }
public virtual object Process(IDbDataSource host, IFieldUpload upload, DataRow row, UpdateKind kind) { return(null); }
public async Task <TResult> StartRequestWhenReady <TKey, TResult>(TKey key, Func <TKey, Task <TResult> > getFunc, UpdateKind updateKind, TResult defaultValue, [CallerMemberName] string callName = "") { Guid token = Guid.NewGuid(); TResult retVar = defaultValue; try { if (await StartUpdateWhenReady(updateKind, token, callName)) { retVar = await getFunc(key); } } catch (Exception e) { throw e; } finally { if (IsUpdateRunning(callName)) { EndRequest(token, callName); } } return(retVar); }
public async Task <TResult> StartRequestWhenReady <TKey, TResult>(TKey key, Func <TKey, Task <TResult> > getFunc, UpdateKind updateKind, [CallerMemberName] string callName = "") where TResult : class { return(await StartRequestWhenReady(key, getFunc, updateKind, null, callName)); }
public void Add(UpdateKind kind, CorpUser user) { var list = GetList(kind); list.Add(user); }
protected override IUploadProcessor2 CreateUploadProcessor(IFieldInfoEx info, UpdateKind status) { Tk5UploadConfig upload = info.AssertUpload(); return(upload.CreateUploadProcessor2()); }
public SimpleListOperateRight(UpdateKind operators) { fOperators = operators; }
/// <summary> /// Initializes a new instance of the UpdatingEventArgs class. /// </summary> public UpdatingEventArgs(DataRow row, UpdateKind status, UpdateKind invokeMethod, DataSet postDataSet, DataRow postDataRow, IInputData inputData) { SetProperties(row, status, invokeMethod, postDataRow, postDataSet, inputData); }