public Category Update(UpdateCmd command) { Category result = null; if (command.IsValid()) { result = _categoryRepository.GetById(command.Id); if (!_categoryRepository.Notification.HasNotifications) { command.Apply(ref result); _categoryRepository.Add(result); } if (_categoryRepository.Notification.HasNotifications) { Notification.AddNotifications(_categoryRepository.Notification.Notifications); } } else { command.Undo(ref result); Notification.AddNotifications(command.Validation); } return(result); }
/// <summary> /// 创建更新命令对象 /// </summary> /// <returns></returns> protected StockCmd CreateUpdateCmd(IDvTable Table) { StockCmd isert = new UpdateCmd(); isert.CreateCmd(Table); return(isert); }
// Update is called once per frame void Update() { lock (VersionUpdateManager.updateCmdList) { int index = VersionUpdateManager.updateCmdList.Count - 1; for (; index >= 0; index--) { UpdateCmd cmd = VersionUpdateManager.updateCmdList[index]; switch (cmd.cmdType) { case UpdateCmdType.GetStreamAssetInfo: this.StartCoroutine(VersionUpdateManager.Instance.GetStreamAssetInfo()); break; case UpdateCmdType.StreamAssetInit: this.StartCoroutine(VersionUpdateManager.Instance.StreamAssetInit()); break; case UpdateCmdType.LoadVersionList: this.StartCoroutine(VersionUpdateManager.Instance.LoadVersionList()); break; case UpdateCmdType.UpdateVersionFinish: Debug.Log("load level Stratup"); Application.LoadLevel("Startup"); break; case UpdateCmdType.UpdateMessageTips: this.ShowMessageTips((UpdateVersionTipsScript.TipMessageStruct)cmd.obj); break; case UpdateCmdType.ChangeVersionLabel: this.ChangeVersionLabel((int)cmd.obj); break; default: break; } VersionUpdateManager.updateCmdList.RemoveAt(index); } } if (labLoading != null) { labLoading.text = loadInfo; } if (ProgressBar != null) { ProgressBar.value = ProgressPeracent; } if (labCheckingTips != null) { labCheckingTips.gameObject.SetActive(isShowUpdateCheckingTips); labCheckingTips.text = checkingTipsString; } }
public ViewAViewModel(ITaskEntryService taskService, ITaskEntryRepository taskEntryRepo) { _taskService = taskService; _taskEntryRepo = taskEntryRepo; UpdateCmd.ObservesProperty(() => SelectedTaskEntry); DeleteCmd.ObservesProperty(() => SelectedTaskEntry); }
/// <summary> /// /// </summary> /// <param name="cmdStr"></param> /// <returns></returns> internal static ICmd ParseSqlCmdString(string cmdStr, CoreEA.ICoreEAHander dbe) { ICmd curCmd = null; if (string.IsNullOrEmpty(cmdStr)) { ProcessException.DisplayErrors(new Exception("Empty Command")); return(null); } try { cmdStr = cmdStr.TrimStart(); cmdStr = cmdStr.TrimEnd(); //Can't to lower , otherwise the insert data will never 大写 //cmdText = cmdText.ToLower(); string tempCmdText = cmdStr.ToLower(); if (tempCmdText.StartsWith("select")) { curCmd = new SelectCmd(dbe); } else if (tempCmdText.StartsWith("insert")) { curCmd = new InsertCmd(dbe); } else if (tempCmdText.StartsWith("update")) { curCmd = new UpdateCmd(dbe); } else if (tempCmdText.StartsWith("delete")) { curCmd = new DeleteCmd(dbe); } else if (tempCmdText.StartsWith("alter") || (tempCmdText.StartsWith("drop"))) { curCmd = new SpecialCmd(dbe); } else if (tempCmdText.StartsWith("create")) { curCmd = new CreateCmd(dbe); } else if (tempCmdText.StartsWith("sp_rename")) { curCmd = new SpecialCmd(dbe); } else { curCmd = null; //throw new Exception("ErrorMsg_CannotParseSqlCmd".GetFromResourece()); } } catch (Exception ee) { ProcessException.DisplayErrors(ee); } return(curCmd); }
/// <summary> /// Update the given Lemma in the repository. The Lemma must already exist!! /// </summary> /// <param name="val"></param> public void Update(T val) { UpdateCmd.Parameters.Add(Database.CreateParameter("@id", val.Id, UpdateCmd)); UpdateCmd.Parameters.Add(Database.CreateParameter("@word", val.Word, UpdateCmd)); object[] rec = ConstructRecordFrom(val); for (int i = 0; i < ColumNames.Count(); ++i) { UpdateCmd.Parameters.Add(Database.CreateParameter("@" + ColumNames[i], rec[i], UpdateCmd)); } UpdateCmd.ExecuteNonQuery(); }
IEnumerator serverInit() { yield return(new WaitForSeconds(1.0f)); // wait for the server to load if (Cmd.all.getCommand <UpdateCmd>().updateCheck) { UpdateCmd.checkForUpdates(false); // check for ServerMod updates } Cmd.all.getCommand <SettingsCmd>().showNewSettings(); // show any new settings yield break; }
public static void AddUpdateCmd(UpdateCmdType cmdType, object obj = null) { UpdateCmd cmd = new UpdateCmd(); cmd.cmdType = cmdType; cmd.obj = obj; lock (updateCmdList) { updateCmdList.Add(cmd); } }
public LemmaRepository(LemmaDatabase db, string tableName, string[] columnNames) { Database = db; TableName = tableName; ColumNames = columnNames; InsertCmd = db.CreateCommand("insert into " + TableName + "(word," + string.Join(",", columnNames) + ") values(@word, @" + string.Join(", @", columnNames) + ")"); InsertCmd.Prepare(); string[] columnSetters = columnNames.Select(x => x + "=@" + x).ToArray(); // x=@x UpdateCmd = db.CreateCommand("update " + TableName + " set word=@word, " + string.Join(", ", columnSetters) + " where id=@id"); UpdateCmd.Prepare(); DeleteCmd = db.CreateCommand("delete from " + TableName + " where id=@id"); DeleteCmd.Prepare(); CountCmd = db.CreateCommand("select count(*) from " + TableName); CountCmd.Prepare(); SelectByIdCmd = db.CreateCommand("select * from " + TableName + " where id=@id"); SelectByIdCmd.Prepare(); SelectPageOfDataCmd = db.CreateCommand("select * from " + TableName + " limit @pageSize offset @offset"); SelectPageOfDataCmd.Prepare(); }
public bool DoSave() { ObservableCollection <JuncMesage> datas = (ObservableCollection <JuncMesage>)JUNCDG.DataContext; foreach (JuncMesage msg in datas) { try { ParseData(msg); } catch (Exception ex) { System.Console.WriteLine(ex.ToString()); string str = ""; if (ex is ExceptionProcess) { str += ((ExceptionProcess)ex).getReson() + "\n"; } MessageBox.Show(str + "设置数据格式错误:" + msg.ItemName + " " + msg.ValueName); return(false); } } UpdateCmd cmd = new UpdateCmd(); JuncRev rev = new JuncRev(); rev.ListJunc = new List <CJuncInfo>(); rev.ListJuncExt = new List <CJuncExtInfo>(); rev.ListJunc.Add(mJunc); rev.ListJuncExt.Add(mJuncext); cmd.SetReceiver(rev); cmd.Execute(); return(true); }
public async Task <IActionResult> PutMovie(Guid id, UpdateCmd comando) { if (id != comando.Id) { return(BadRequest()); } //_context.Entry(movie).State = EntityState.Modified; try { this._notificationContext.Clear(); if (!comando.IsValid()) { this._notificationContext.AddNotifications(comando.ValidationResult); return(CreatedAtAction("GetMovie", comando)); } //await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
internal static void Register(CommandLineApplication app, Func <ILogger> getLogger) { app.Command("update", UpdateCmd => { UpdateCmd.Command("source", SourceCmd => { CommandArgument name = SourceCmd.Argument( "name", Strings.SourcesCommandNameDescription); CommandOption source = SourceCmd.Option( "-s|--source", Strings.SourcesCommandSourceDescription, CommandOptionType.SingleValue); CommandOption username = SourceCmd.Option( "-u|--username", Strings.SourcesCommandUserNameDescription, CommandOptionType.SingleValue); CommandOption password = SourceCmd.Option( "-p|--password", Strings.SourcesCommandPasswordDescription, CommandOptionType.SingleValue); CommandOption storePasswordInClearText = SourceCmd.Option( "--store-password-in-clear-text", Strings.SourcesCommandStorePasswordInClearTextDescription, CommandOptionType.NoValue); CommandOption validAuthenticationTypes = SourceCmd.Option( "--valid-authentication-types", Strings.SourcesCommandValidAuthenticationTypesDescription, CommandOptionType.SingleValue); CommandOption configfile = SourceCmd.Option( "--configfile", Strings.Option_ConfigFile, CommandOptionType.SingleValue); SourceCmd.HelpOption("-h|--help"); SourceCmd.Description = Strings.UpdateSourceCommandDescription; SourceCmd.OnExecute(() => { var args = new UpdateSourceArgs() { Name = name.Value, Source = source.Value(), Username = username.Value(), Password = password.Value(), StorePasswordInClearText = storePasswordInClearText.HasValue(), ValidAuthenticationTypes = validAuthenticationTypes.Value(), Configfile = configfile.Value(), }; UpdateSourceRunner.Run(args, getLogger); return(0); }); }); UpdateCmd.HelpOption("-h|--help"); UpdateCmd.Description = Strings.Update_Description; UpdateCmd.OnExecute(() => { app.ShowHelp("update"); return(0); }); }); }
public void Update(FAKategorie faKategorie) { FillCommandParameter(UpdateCmd, faKategorie); int x = UpdateCmd.ExecuteNonQuery(); }
internal static void Register(CommandLineApplication app, Func <ILogger> getLogger) { app.Command("update", UpdateCmd => { UpdateCmd.Command("source", SourceCmd => { CommandArgument name = SourceCmd.Argument( "name", Strings.SourcesCommandNameDescription); CommandOption source = SourceCmd.Option( "-s|--source", Strings.SourcesCommandSourceDescription, CommandOptionType.SingleValue); CommandOption username = SourceCmd.Option( "-u|--username", Strings.SourcesCommandUsernameDescription, CommandOptionType.SingleValue); CommandOption password = SourceCmd.Option( "-p|--password", Strings.SourcesCommandPasswordDescription, CommandOptionType.SingleValue); CommandOption storePasswordInClearText = SourceCmd.Option( "--store-password-in-clear-text", Strings.SourcesCommandStorePasswordInClearTextDescription, CommandOptionType.NoValue); CommandOption validAuthenticationTypes = SourceCmd.Option( "--valid-authentication-types", Strings.SourcesCommandValidAuthenticationTypesDescription, CommandOptionType.SingleValue); CommandOption configfile = SourceCmd.Option( "--configfile", Strings.Option_ConfigFile, CommandOptionType.SingleValue); SourceCmd.HelpOption("-h|--help"); SourceCmd.Description = Strings.UpdateSourceCommandDescription; SourceCmd.OnExecute(() => { var args = new UpdateSourceArgs() { Name = name.Value, Source = source.Value(), Username = username.Value(), Password = password.Value(), StorePasswordInClearText = storePasswordInClearText.HasValue(), ValidAuthenticationTypes = validAuthenticationTypes.Value(), Configfile = configfile.Value(), }; UpdateSourceRunner.Run(args, getLogger); return(0); }); }); UpdateCmd.Command("client-cert", ClientCertCmd => { CommandOption packagesource = ClientCertCmd.Option( "-s|--package-source", Strings.Option_PackageSource, CommandOptionType.SingleValue); CommandOption path = ClientCertCmd.Option( "--path", Strings.Option_Path, CommandOptionType.SingleValue); CommandOption password = ClientCertCmd.Option( "--password", Strings.Option_Password, CommandOptionType.SingleValue); CommandOption storepasswordincleartext = ClientCertCmd.Option( "--store-password-in-clear-text", Strings.Option_StorePasswordInClearText, CommandOptionType.NoValue); CommandOption storelocation = ClientCertCmd.Option( "--store-location", Strings.Option_StoreLocation, CommandOptionType.SingleValue); CommandOption storename = ClientCertCmd.Option( "--store-name", Strings.Option_StoreName, CommandOptionType.SingleValue); CommandOption findby = ClientCertCmd.Option( "--find-by", Strings.Option_FindBy, CommandOptionType.SingleValue); CommandOption findvalue = ClientCertCmd.Option( "--find-value", Strings.Option_FindValue, CommandOptionType.SingleValue); CommandOption force = ClientCertCmd.Option( "-f|--force", Strings.Option_Force, CommandOptionType.NoValue); CommandOption configfile = ClientCertCmd.Option( "--configfile", Strings.Option_ConfigFile, CommandOptionType.SingleValue); ClientCertCmd.HelpOption("-h|--help"); ClientCertCmd.Description = Strings.UpdateClientCertCommandDescription; ClientCertCmd.OnExecute(() => { var args = new UpdateClientCertArgs() { PackageSource = packagesource.Value(), Path = path.Value(), Password = password.Value(), StorePasswordInClearText = storepasswordincleartext.HasValue(), StoreLocation = storelocation.Value(), StoreName = storename.Value(), FindBy = findby.Value(), FindValue = findvalue.Value(), Force = force.HasValue(), Configfile = configfile.Value(), }; UpdateClientCertRunner.Run(args, getLogger); return(0); }); }); UpdateCmd.HelpOption("-h|--help"); UpdateCmd.Description = Strings.Update_Description; UpdateCmd.OnExecute(() => { app.ShowHelp("update"); return(0); }); }); }
static void Main(string[] args) { // CUser user = (CUser)(Assembly.Load(filepath).CreateInstance(filepath + ".DBClass." + "CUser")); // if (user != null) // { // System.Console.WriteLine(user.ToString()); // System.Console.ReadLine(); // } InsertCmd icmd = new InsertCmd(); LoadCmd lcmd = new LoadCmd(); SelectCmd scmd = new SelectCmd(); UpdateCmd ucmd = new UpdateCmd(); DeleteCmd dcmd = new DeleteCmd(); ClearCmd ccmd = new ClearCmd(); #region test TUser // UserRev userrev = new UserRev(); // CUser u = new CUser(); // u.UserName = "******"; // u.UserType = 1; // u.PassWord = "******"; // List<CUser> listuser = new List<CUser>(); // listuser.Add(u); // userrev.ListUser = listuser; // icmd.SetReceiver(userrev); // icmd.Execute(); // lcmd.SetReceiver(userrev); // lcmd.Execute(); // System.Console.WriteLine("Element number:{0}", userrev.ListUser.Count); // userrev.UserName = "******"; // scmd.SetReceiver(userrev); // scmd.Execute(); // System.Console.WriteLine("Element number:{0}", userrev.ListUser.Count); // userrev.ListUser.ElementAt(0).PassWord = "******"; // ucmd.SetReceiver(userrev); // ucmd.Execute(); // dcmd.SetReceiver(userrev); // dcmd.Execute(); // ccmd.SetReceiver(userrev); // ccmd.Execute(); #endregion #region test TSystemBase SystemRev sysrev = new SystemRev(); // CSystemBase sysbase = new CSystemBase(); // sysbase.SystemID = "2014722002"; // sysbase.SysName = "test system name"; // List<CSystemBase> list = new List<CSystemBase>(); // list.Add(sysbase); // sysrev.SysList = list; // icmd.SetReceiver(sysrev); // icmd.Execute(); // lcmd.SetReceiver(sysrev); // lcmd.Execute(); // System.Console.WriteLine(sysrev.SysList.Count); // // dcmd.SetReceiver(sysrev); // dcmd.Execute(); #endregion #region test PumpRev PumpRev prev = new PumpRev(); // CPumpStationInfo pump = new CPumpStationInfo(); // pump.PumpName = "testpum"; // List<CPumpStationInfo> list = new List<CPumpStationInfo>(); // list.Add(pump); // prev.ListPump = list; // icmd.SetReceiver(prev); // icmd.Execute(); // lcmd.SetReceiver(prev); // lcmd.Execute(); // System.Console.WriteLine(prev.ListPump.Count); // prev.PumpName = "testpum"; // scmd.SetReceiver(prev); // scmd.Execute(); // System.Console.WriteLine(prev.ListPump.Count); // prev.ListPump.ElementAt(0).PumpName = "Newname"; // ucmd.SetReceiver(prev); // ucmd.Execute(); // dcmd.SetReceiver(prev); // dcmd.Execute(); // ccmd.SetReceiver(prev); // ccmd.Execute(); #endregion #region test OutFallinfo OutFallRev orev = new OutFallRev(); // COutFallInfo outfall = new COutFallInfo(); // COutFallExtInfo outext = new COutFallExtInfo(); // List<COutFallInfo> listoutfall = new List<COutFallInfo>(); // List<COutFallExtInfo> listoutext = new List<COutFallExtInfo>(); // outfall.Category = 1; // outfall.SystemID = "2014722001"; // listoutfall.Add(outfall); // outext.OutFallName = "outfallname"; // listoutext.Add(outext); // orev.OutList = listoutfall; // orev.OutExtList = listoutext; // icmd.SetReceiver(orev); // icmd.Execute(); // lcmd.SetReceiver(orev); // lcmd.Execute(); // System.Console.WriteLine("OutList Number: {0},OutlistExt NUmber : {1}",orev.OutList.Count,orev.OutExtList.Count); // orev.OutExtList.ElementAt(0).OutFallName = "New Name"; // orev.OutList.ElementAt(0).ReportDept = "adasda"; // ucmd.SetReceiver(orev); // ucmd.Execute(); // dcmd.SetReceiver(orev); // dcmd.Execute(); #endregion #region test junction JuncRev jrev = new JuncRev(); //lcmd.SetReceiver(jrev); //lcmd.Execute(); //Console.WriteLine(jrev.ListJunc.Count); //CJuncInfo junc = new CJuncInfo(); //CJuncExtInfo junext = new CJuncExtInfo(); //List<CJuncInfo> listjunc = new List<CJuncInfo>(); //List<CJuncExtInfo> listjuncext = new List<CJuncExtInfo>(); //junc.Junc_Style = 1; //junc.X_Coor = 119.1232443; //junc.Y_Coor = 21.123023123; //junext.Lane_Way = "way name"; //listjuncext.Add(junext); //listjunc.Add(junc); //listjuncext.Add(junext); //jrev.ListJunc = listjunc; //icmd.SetReceiver(jrev); //icmd.Execute(); jrev.JuncName = "ShiN-W1 / LongQ-W1"; scmd.SetReceiver(jrev); scmd.Execute(); System.Console.WriteLine(jrev.ListJunc.Count); //jrev.ListJunc.ElementAt(0).SystemID = "2102323"; //jrev.ListJuncExt.ElementAt(0).Junc_Class = 2; //ucmd.SetReceiver(jrev); //ucmd.Execute(); //dcmd.SetReceiver(jrev); //dcmd.Execute(); //ccmd.SetReceiver(jrev); //ccmd.Execute(); #endregion #region test pipe PipeRev piperev = new PipeRev(); // lcmd.SetReceiver(piperev); // lcmd.Execute(); // System.Console.WriteLine(piperev.ListPipe.Count); // CPipeInfo pipe = new CPipeInfo(); // pipe.PipeName = "Y2-Y3"; // List<CPipeInfo> listpipe = new List<CPipeInfo>(); // listpipe.Add(pipe); // piperev.ListPipe = listpipe; // icmd.SetReceiver(piperev); // icmd.Execute(); //piperev.PipeName = "Y1-Y2"; //scmd.SetReceiver(piperev); //scmd.Execute(); //System.Console.WriteLine(piperev.ListPipe.Count); //System.Console.WriteLine(piperev.ListPipeExt.Count); //System.Console.WriteLine(piperev.ListUS.Count); //System.Console.WriteLine(piperev.ListLog.Count); //System.Console.WriteLine(piperev.ListVideo.Count); // ucmd.SetReceiver(piperev); // ucmd.Execute(); //piperev.ListLog.Clear(); //piperev.ListPipeExt.Clear(); //dcmd.SetReceiver(piperev); //dcmd.Execute(); #endregion System.Console.WriteLine("Done"); System.Console.ReadLine(); }