private void gridSection_RowEditEnded(object sender, Telerik.Windows.Controls.GridViewRowEditEndedEventArgs e) { if (e.EditAction == GridViewEditAction.Cancel) { return; } if (e.EditOperationType == GridViewEditOperationType.Insert) { try { db.SaveChanges(); binddatagrid(); } catch { MessageBox.Show("Invalid"); } } else if (e.EditOperationType == GridViewEditOperationType.Edit) { try { foreach (var data in gridSection.SelectedItems) { t_DepartmentalSection myData = data as t_DepartmentalSection; sectcode = myData.SectCode; sectname = myData.SectName; t_DepartmentalSection sec = db.t_DepartmentalSection.First(p => p.DeptCode == Department.SelectedValue.ToString() && p.SectCode == sectcode); sec.SectName = sectname; db.SaveChanges(); binddatagrid(); } } catch { } } }
private void RadGridView1_RowEditEnded(object sender, Telerik.Windows.Controls.GridViewRowEditEndedEventArgs e) { SunSeven.Models.HSOrderHistory lOrderHistory = e.EditedItem as SunSeven.Models.HSOrderHistory; DataSource.Order lOrder = lDataContext.Orders.FirstOrDefault(p => p.Id == lOrderHistory.OrderId); if (lOrder != null) { try { lOrder.EmpDeliveryId = lOrderHistory.DeliveryPersonId; lOrder.EmployeeId = lOrderHistory.SalesPersonId; DataSource.Invoice lInvoice = lDataContext.Invoices.Single(p => p.Id == lOrder.InvoiceId); if (lInvoice != null) { lInvoice.DeliveryDate = lOrderHistory.DeliveryDate; lInvoice.EmpDeliveryId = lOrderHistory.DeliveryPersonId; lInvoice.Description = lOrderHistory.Description; lDataContext.SubmitChanges(); } if (lOrder != null) { lOrder.Description = lOrderHistory.InternalComment; lDataContext.SubmitChanges(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void gridView_RowEditEnded(object sender, Telerik.Windows.Controls.GridViewRowEditEndedEventArgs e) { // if the user pressed ESC key // after an INS key if (e.EditAction == GridViewEditAction.Cancel) { if (e.Row.GetType() == typeof(Telerik.Windows.Controls.GridView.GridViewNewRow)) { (sender as RadGridView).Items.Remove(e.Row.Item); } return; } if (e.EditOperationType == GridViewEditOperationType.Insert) { var newData = e.NewData; if (newData != null) { if (e.EditAction == Telerik.Windows.Controls.GridView.GridViewEditAction.Commit) { } } return; } if (e.EditOperationType == GridViewEditOperationType.Edit) { } }
private void RadGridView1_RowEditEnded(object sender, Telerik.Windows.Controls.GridViewRowEditEndedEventArgs e) { DataSource.Invoice gridInvoice = e.NewData as DataSource.Invoice; DataSource.Order orgOrder = lDataContext.Orders.Single(p => p.InvoiceId == gridInvoice.Id); DataSource.Invoice orgInvoice = lDataContext.Invoices.Single(p => p.Id == gridInvoice.Id); if (orgOrder != null) { orgOrder.Description = gridInvoice.Description; orgInvoice.Status = gridInvoice.Status; try { lDataContext.SubmitChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void gridView_RowEditEnded(object sender, Telerik.Windows.Controls.GridViewRowEditEndedEventArgs e) { // TODO: //Pais newPais = null; if (e.EditAction == GridViewEditAction.Cancel) { e.UserDefinedErrors.Clear(); return; } if (e.EditOperationType == GridViewEditOperationType.Insert) { GridViewRow row = e.Row; if (e.Row is GridViewNewRow) { object cellValue = e.OldValues; //this.genericLocalidades.Insert(e.NewData); } return; } if (e.EditOperationType == GridViewEditOperationType.Edit) { GridViewRow row = e.Row; if (e.Source is GridViewComboBoxColumn) { var one = "alas"; } IDictionary <string, object> cellOldValues = e.OldValues; object cellNewValues = e.NewData; // Issue when changing an item in any Combo Box //this.genericLocalidades.Update(e.NewData); } }
public async void BroadCastGridView_RowEditEnded(object sender, Telerik.Windows.Controls.GridViewRowEditEndedEventArgs e) { if (e.EditAction == Telerik.Windows.Controls.GridView.GridViewEditAction.Commit) { if (e.EditOperationType == Telerik.Windows.Controls.GridView.GridViewEditOperationType.Insert) { Log.Debug("插入标签项."); TagInfo tagInfoData = e.NewData as TagInfo; TagInfo result = await tagInfoService.Add(tagInfoData); if (result != null) { RadWindow.Alert(new DialogParameters { Header = "标签管理", Content = "新建标签成功!" }); Log.Debug("新建公告{0}成功.", tagInfoData.TagName); //插入记录后更新列表 IsBusy = true; } else { RadWindow.Alert(new DialogParameters { Header = "标签管理", Content = "新建标签失败!" }); } } else { Log.Debug("更新标签项."); TagInfo tagInfoData = e.NewData as TagInfo; TagInfo result = await tagInfoService.Update(tagInfoData); if (result != null) { RadWindow.Alert(new DialogParameters { Header = "标签管理", Content = "更新标签成功!" }); Log.Debug("修改标签{0}成功.", (e.NewData as TagInfo).TagName); //插入记录后更新列表 IsBusy = true; } else { RadWindow.Alert(new DialogParameters { Header = "标签管理", Content = "更新标签失败!" }); } } } else if (e.EditAction == Telerik.Windows.Controls.GridView.GridViewEditAction.Cancel) { // do nothing } }
private void gridView_RowEditEnded(object sender, Telerik.Windows.Controls.GridViewRowEditEndedEventArgs e) { // TODO: //Pais newPais = null; if (e.EditAction == GridViewEditAction.Cancel) { e.UserDefinedErrors.Clear(); return; } if (e.EditOperationType == GridViewEditOperationType.Insert) { GridViewRow row = e.Row; if (e.Row is GridViewNewRow) { object cellValue = e.NewData; // TODO: /* * newPais = e.NewData as Pais; * if (newPais == null) * { * return; * }*/ // Some sort of validation here // empty fields, etc // this is entity specific // The UI should handle this /* * if (string.IsNullOrEmpty(newPais.nombre)) * { * return; * }*/ // TODO: ...... /* this.customViewModel.InsertEntity<Pais>(newPais, "Paises"); */ //System.Windows.MessageBox.Show(string.Format("New Pais: {0} {1}", newPais.id, newPais.nombre)); } return; } if (e.EditOperationType == GridViewEditOperationType.Edit) { GridViewRow row = e.Row; /* * newPais = e.NewData as Pais; * if (newPais == null) * { * return; * }*/ // TODO: /* this.customViewModel.UpdateEntity<Pais>(newPais); */ } }