public async Task <IActionResult> Edit(int id, [Bind("id,material_weight,carriage_weight,material_unit_price,carriage_unit_price,material_count_price,carriage_count_price,start_date,end_date,customer,shareholder,car,supply,material,carriage_should_count_price,service_charge,pay_time")] Transportation transportation) { if (id != transportation.id) { return(NotFound()); } if (ModelState.IsValid) { try { Customer customer = _context.customer.Where(p => p.id == transportation.customer.id).First(); transportation.customer = customer; Material material = _context.material.Where(p => p.id == transportation.material.id).First(); transportation.material = material; Shareholder shareholder = _context.shareholder.Where(p => p.id == transportation.shareholder.id).First(); transportation.shareholder = shareholder; Car car = _context.car.Where(p => p.id == transportation.car.id).First(); transportation.car = car; Supply supply = _context.supply.Where(p => p.id == transportation.supply.id).First(); transportation.supply = supply; transportation.create_time = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss"); _context.Update(transportation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TransportationExists(transportation.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(transportation)); }
public async Task <IActionResult> Edit(int id, [Bind("id,name,privileges,ding_id")] User user) { if (id != user.id) { return(NotFound()); } if (ModelState.IsValid) { try { user.create_time = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss"); _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public void TestRelationAdding() { var item = Model.Update(new ItemModel() { Name = "Phone", IsPersisted = true, }); var tag = Model.Update(new TagModel() { Name = "Wired", IsPersisted = true, }); ModelStore.Commit(); var inter = item.Tags.Add(tag); Assert.AreSame(tag, inter.To); Assert.AreEqual(tag.Id, inter.ToId); Assert.AreSame(item, inter.From); Assert.AreEqual(item.Id, inter.FromId); ModelStore.Commit(); Assert.AreSame(inter, item.Tags.Single()); Assert.AreSame(inter, tag.Items.Single()); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Title,Note,CreatedOn,CategoryId,IsDeleted,UserID")] Notes notes) { if (id != notes.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(notes); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NotesExists(notes.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(notes)); }
public void Update_ReturnsTrue_ForRepaintOnFinalElement() { Model.AddBundlesToUpdate(m_BundleInfo); Assert.IsFalse(Model.Update()); Assert.IsFalse(Model.Update()); Assert.IsTrue(Model.Update()); }
public async Task <UserModel> GetUser(string googleAccessToken) { var url = new Uri(v8Url, "me?app_name=toggl_mobile"); var httpReq = new HttpRequestMessage() { Method = HttpMethod.Get, RequestUri = url, }; httpReq.Headers.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes( string.Format("{0}:{1}", googleAccessToken, "google_access_token")))); var httpResp = await httpClient.SendAsync(httpReq) .ConfigureAwait(continueOnCapturedContext: false); PrepareResponse(httpResp); var respData = await httpResp.Content.ReadAsStringAsync() .ConfigureAwait(continueOnCapturedContext: false); var wrap = JsonConvert.DeserializeObject <Wrapper <UserModel> > (respData); return(Model.Update(wrap.Data)); }
private void ModelSaveButtonUpdate_Click(object sender, RoutedEventArgs e) { Model _Model = (Model)ModelGrid.SelectedItem; _Model.str_Description = ModelBezeichnungUpdateUpdate.Text; foreach (Hersteller item in DataController.ReturnHersteller()) { if (ModelHerstellerUpdateUpdate.Text == item.str_Name) { _Model.int_Manufacturer = item.int_ID; } } _Model.Update(); DataController.CreateDataLayer(); HerstellerGrid = _Controller.FillHerstellerGrid(HerstellerGrid, DataController.ReturnHersteller()); ModelGrid = _Controller.FillModelGrid(ModelGrid, DataController.ReturnModels()); ArticleGrid = _Controller.FillArticleGrid(ArticleGrid, DataController.ReturnLiveArtikel()); ModelNothingSelectedUpdate.Content = "Datensatz erfolgreich aktualisiert!"; ModelNothingSelectedUpdate.Foreground = Brushes.Green; ModelNothingSelectedUpdate.Visibility = Visibility.Visible; ModelSaveButtonUpdate.IsEnabled = false; }
public async Task <IActionResult> Edit(int id, [Bind("id,material_count_price,carriage_count_price")] Expenditure expenditure) { if (id != expenditure.id) { return(NotFound()); } if (ModelState.IsValid) { try { expenditure.create_time = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss"); _context.Update(expenditure); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExpenditureExists(expenditure.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(expenditure)); }
public async Task <IActionResult> Edit(int id, [Bind("id,count_price,customer")] Income income) { if (id != income.id) { return(NotFound()); } if (ModelState.IsValid) { try { Customer customer = _context.customer.Where(p => p.id == income.customer.id).First(); income.customer = customer; income.create_time = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss"); _context.Update(income); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IncomeExists(income.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(income)); }
public void TestMakeShared() { // Verify the ModelChangedMessage send count var messageCount = 0; MessageBus.Subscribe <ModelChangedMessage> ((msg) => { messageCount++; }); var model = new PlainModel(); model.PropertyChanged += (sender, e) => { if (e.PropertyName == PlainModel.PropertyIsShared) { // Check that model is present in cache Assert.That(Model.Manager.Cached <PlainModel> (), Has.Exactly(1).SameAs(model), "The newly shared object should be present in cache already."); } else if (e.PropertyName == PlainModel.PropertyId) { // Expect ID assignment } else { Assert.Fail(String.Format("Property '{0}' changed unexpectedly.", e.PropertyName)); } }; var shared = Model.Update(model); Assert.AreSame(model, shared, "Promoting to shared should return the initial model."); Assert.NotNull(model.Id, "Should have received a new unique Id."); Assert.AreEqual(messageCount, 1, "Received invalid number of OnModelChanged messages"); }
public async Task <IActionResult> Edit(int id, [Bind("id,name,address,contact,phone")] Customer customer) { if (id != customer.id) { return(NotFound()); } if (ModelState.IsValid) { try { customer.create_time = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss"); _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Email,Name,CreatedOn")] User user) { if (id != user.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name")] Category category) { if (id != category.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Edit(int id, [Bind("id,price,material")] MaterialUnitPrice materialUnitPrice) { if (id != materialUnitPrice.id) { return(NotFound()); } if (ModelState.IsValid) { try { Material material = _context.material.Where(p => p.id == materialUnitPrice.material.id).First(); materialUnitPrice.material = material; materialUnitPrice.create_time = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss"); _context.Update(materialUnitPrice); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MaterialUnitPriceExists(materialUnitPrice.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(materialUnitPrice)); }
public void TestStopOthersWhenMerging() { var oldTimeEntry = Model.Update(new TimeEntryModel() { User = AuthManager.User, State = TimeEntryState.Finished, StartTime = Time.UtcNow, StopTime = Time.UtcNow + TimeSpan.FromSeconds(60), DurationOnly = false, IsPersisted = true, ModifiedAt = new DateTime(), }); var newTimeEntry = StartNew(); Assert.AreEqual(TimeEntryState.Running, newTimeEntry.State); Assert.IsNull(newTimeEntry.StopTime); // Simulate merge from server Model.Update(new TimeEntryModel() { Id = oldTimeEntry.Id, Description = "Old time entry", User = oldTimeEntry.User, State = TimeEntryState.Running, StartTime = oldTimeEntry.StartTime, DurationOnly = oldTimeEntry.DurationOnly, IsPersisted = oldTimeEntry.IsPersisted, }); Assert.AreEqual(TimeEntryState.Running, oldTimeEntry.State); Assert.IsNull(oldTimeEntry.StopTime); Assert.AreEqual(TimeEntryState.Finished, newTimeEntry.State, "New entry not finished."); Assert.IsNotNull(newTimeEntry.StopTime, "Stop time not set for new entry."); }
public async Task <IActionResult> Edit(int id, [Bind("id,name,unit")] Material material) { if (id != material.id) { return(NotFound()); } if (ModelState.IsValid) { try { material.create_time = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss"); _context.Update(material); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MaterialExists(material.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(material)); }
public void TestStopOthersWhenContinueSame() { var oldTimeEntry = Model.Update(new TimeEntryModel() { Description = "Old time entry", User = AuthManager.User, State = TimeEntryState.Finished, StartTime = Time.UtcNow, StopTime = Time.UtcNow + TimeSpan.FromSeconds(60), DurationOnly = true, IsPersisted = true, }); var runningTimeEntry = StartNew(); Assert.AreEqual(TimeEntryState.Running, runningTimeEntry.State); Assert.IsNull(runningTimeEntry.StopTime); var newTimeEntry = oldTimeEntry.Continue(); Assert.AreSame(oldTimeEntry, newTimeEntry); Assert.AreEqual(TimeEntryState.Running, newTimeEntry.State); Assert.IsNull(newTimeEntry.StopTime); Assert.AreEqual(TimeEntryState.Finished, runningTimeEntry.State, "Old entry not finished."); Assert.IsNotNull(runningTimeEntry.StopTime, "Stop time not set for old entry."); }
public void Update() { if (From != null) { FromPath = PathEx.ApplyAllUpDirPaths(From.DllPath); } if (FromPath != null && To != null) { ProjectDescription descr = To.Dependencies.First( x => string.Equals(x.FileName, Path.GetFileNameWithoutExtension(FromPath), StringComparison.CurrentCultureIgnoreCase)); ToPath = PathEx.ApplyAllUpDirPaths(descr.Path); } if (LabelFrom != null) { LabelFrom.Value = FromPath == null ? string.Empty : Path.GetFileName(FromPath); } if (LabelTo != null) { LabelTo.Value = ToPath; } bool fromOk = FromPath != null && File.Exists(FromPath); ApplyButton.Enabled = fromOk && ToPath != null; LabelFromStatus.Value = fromOk ? Resources.Ok : Resources.Error; LabelToStatus.Value = ToPath != null ? Resources.Ok : Resources.Error; Model.Update(); }
/// <summary> /// 编辑终端信息 /// </summary> public void Edit(Model.Terminal terminal, Model.Source source1) { terminal.Update(); //循环更新附件 string[] picName = source1.SourceUrl.Replace("|$|", "&").Split(new char[] { '&' }); for (int i = 0; i < picName.Length - 1; i++) { string[] picUrl = picName[i].Replace("|#|", "|").Split(new char[] { '|' }); source1.SourceUrl = picUrl[1]; source1.SourceType = picUrl[0]; Hashtable ht = new Hashtable(); ht.Add("TerGuid", source1.TerGuid); ht.Add("SourceType", source1.SourceType); if (source1.IsExist(ht)) { source1.Update( "SourceUrl='" + source1.SourceUrl + "'", " and TerGuid='" + source1.TerGuid + "' and SourceType='" + source1.SourceType + "'"); } else { source1.CreateTime = DateTime.Now; source1.Insert(); } } }
public override T Update(T item) { var expando = SetDataForDocument(item); Model.Update(expando); return(item); }
public async Task<IActionResult> Edit(int id, [Bind("id,name,phone")] Shareholder shareholder) { if (id != shareholder.id) { return NotFound(); } if (ModelState.IsValid) { try { shareholder.create_time = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss"); _context.Update(shareholder); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShareholderExists(shareholder.id)) { return NotFound(); } else { throw; } } return RedirectToAction(nameof(Index)); } return View(shareholder); }
public void Update() { Info.Update(); Model.Update(); SkillEngine.Update(); }
public ActionResult TemplateListOfEmailAddresses() { Model model = new Model { }; model.Update(); return(View(model)); }
public void Update(ICamera camera, TimeSpan delta, TimeSpan totalTime) { if (Camera != null) { return; } Model.Update(camera, delta, totalTime); }
public override void ExecuteStep() { foreach (var fault in NondeterministicFaults) { fault.Reset(); } Model.Update(); }
public ActionResult TemplateListOfEmailAddresses_Partial(Model model) { model.Update(); if (!ModelState.IsValid) { return(PartialView(model)); } return(FormProcessed(model, this.__ResStr("ok", "OK"))); }
// Update is called once per frame void Update() { Model.Update(); while (LogQueue.Count > 0) { TextConsole.text += LogQueue.Dequeue(); } }
public void Edit(Model.Application appli,Model.SCW scw, Model.Source source1, Model.BulkFreight bulk, string bulkId) { appli.Update(); if (appli.IO == 1) { scw.Update(); } //循环更新附件 string[] picName = source1.SourceUrl.Replace("|$|", "&").Split(new char[] { '&' }); for (int i = 0; i < picName.Length - 1; i++) { string[] picUrl = picName[i].Replace("|#|", "|").Split(new char[] { '|' }); source1.SourceUrl = picUrl[1]; source1.SourceType = picUrl[0]; Hashtable ht = new Hashtable(); ht.Add("AppGuid", source1.AppGuid); ht.Add("SourceType", source1.SourceType); if (source1.IsExist(ht)) { source1.Update( "SourceUrl='" + source1.SourceUrl + "'", " and AppGuid='" + source1.AppGuid + "' and SourceType='" + source1.SourceType + "'"); } else { source1.CreateTime = DateTime.Now; source1.Insert(); } } //循环插入散装货物列表 string[] BulkId = bulkId.Split(','); string[] BfGoodsName = bulk.BfGoodsName.Split(','); string[] BfGoodsGroup = bulk.BfGoodsGroup.Split(','); string[] Class = bulk.Class.Split(','); string[] DangerousNo = bulk.DangerousNo.Split(','); string[] BfTotalWeight = bulk.BfTotalWeight.Split(','); string[] DischargingPort = bulk.DischargingPort.Split(','); string[] Position = bulk.Position.Split(','); string[] Remark = bulk.Remark.Split(','); for (int i = 0; i < BfGoodsName.Length; i++) { bulk.BfGoodsName = BfGoodsName[i]; bulk.BfGoodsGroup = BfGoodsGroup[i]; bulk.Class = Class[i]; bulk.DangerousNo = DangerousNo[i]; bulk.BfTotalWeight = BfTotalWeight[i]; bulk.DischargingPort = DischargingPort[i]; bulk.Position = Position[i]; bulk.Remark = Remark[i]; bulk.Id = Convert.ToInt32(BulkId[i]); bulk.Update(); } }
public NewProjectViewController(WorkspaceModel workspace, int color) { this.model = Model.Update(new ProjectModel() { Workspace = workspace, Color = color, IsActive = true, }); Title = "NewProjectTitle".Tr(); }
public void TestNewFutureStartChangeNoStop() { var entry = Model.Update(new TimeEntryModel() { State = TimeEntryState.New, }); entry.StartTime = Time.UtcNow.AddHours(1); Assert.AreEqual(entry.StartTime, entry.StopTime); }
public Task <TimeEntryModel> GetTimeEntry(long id) { var url = new Uri(v8Url, String.Format("time_entries/{0}", id.ToString())); var user = ServiceContainer.Resolve <AuthManager> ().User; return(GetModel <TimeEntryModel> (url, (te) => { te.User = user; return Model.Update(te); })); }
public Task <List <TimeEntryModel> > ListTimeEntries() { var url = new Uri(v8Url, "time_entries"); var user = ServiceContainer.Resolve <AuthManager> ().User; return(ListModels <TimeEntryModel> (url, (te) => { te.User = user; return Model.Update(te); })); }
public void Edit(Model.AcceptForm acceptform, Model.AD ad, Model.Client client, Model.Publish publish) { //客户信息插入或更新 Hashtable hs = new Hashtable(); hs.Add("ClientName", client.ClientName); if (client.IsExist(hs)) { client.Update( "ClientName='" + client.ClientName + "',Tel='" + client.Tel + "',Mobile='" + client.Mobile + "',Operator='" + client.Operator + "',AgencyCompany='" + client.AgencyCompany + "'", " and ClientName ='" + client.ClientName + "'"); HD.Model.Client newClient = HD.Model.Client.Instance.GetModelById(hs); acceptform.ClientGuid = newClient.ClientPGuid; } else { client.ClientPostTime = DateTime.Now; client.ClientPGuid = Public.GetGuID; client.Insert(); acceptform.ClientGuid = client.ClientPGuid; } //广告插入 ad.Update(); //先删除原来的发布形式,再循环插入发布形式 //string strSql = " and ADGuid='" + publish.ADGuid + "'"; hs.Clear(); hs.Add("ADGuid", ad.ADPGuid); publish.Delete(hs); //string StrSql = "Select * From " + DbConfig.Prefix + "Admin Where AdminName=@AdminName And AdminPass=@AdminPass And IsLock=1"; //IDataParameter[] Param = new IDataParameter[] { // DbHelper.MakeParam("@AdminName",AdminName), // DbHelper.MakeParam("@AdminPass",AdminPass) //}; string[] pubTypeName = publish.PublishType.Split(','); string[] pubTypeNu = publish.PublishQuantity.Split(','); for (int i = 0; i < pubTypeName.Length; i++) { publish.ADGuid = ad.ADPGuid; publish.PublishType = pubTypeName[i]; publish.PublishQuantity = pubTypeNu[i]; publish.Insert(); } //更新受理单信息 acceptform.Update(acceptform); }
public void Add(Model.Repair repair, Model.Reply reply) { string guid = repair.Guid; repair.Update(); Hashtable hs = new Hashtable(); hs.Add("RepairGuid", guid); if (reply.IsExist(hs)) { reply.Update( "ReplyContent='" + reply.ReplyContent + "',ReplyName='" + reply.ReplyName + "',ReplyRepairTime='" + reply.ReplyRepairTime + "'", " and RepairGuid='" + guid + "'"); } else { reply.Insert(); } }
public void UpdateBuildStatus(Model.Build build) { if (build.BuildStatus == BuildStatus.Success) { if (System.IO.Directory.Exists(build.Location.Replace(path, localMapFolder)) && System.IO.Directory.Exists(System.IO.Path.Combine(build.Location.Replace(path, localMapFolder), "install"))) { //check whether the install folder exist or not //keep as it is } else { build.BuildStatus = BuildStatus.Delete; build.Update(); } } else if (build.BuildStatus == BuildStatus.NotExist) { if (System.IO.Directory.Exists(build.Location.Replace(path, localMapFolder))) { build.BuildStatus = BuildStatus.Success; build.Update(); } else { //keep as it is } } }