private void myRadDataForm_EditEnding(object sender, EditEndingEventArgs e) { SysProcessView.UIHelper.AddOrUpdateRecord <RetailShoppingGuide>(myRadDataForm, _dataContext, e); if (!e.Cancel)//myRadDataForm.Mode== RadDataFormMode.AddNew && { RadGridView1.Rebind(); } }
private void myRadDataForm_EditEnding(object sender, EditEndingEventArgs e) { SysProcessView.UIHelper.AddOrUpdateRecord <OrganizationContractDiscount>(myRadDataForm, _dataContext, e); if (!e.Cancel) { RadGridView1.Rebind(); } }
private void myRadDataForm_EditEnding(object sender, EditEndingEventArgs e) { SysProcessView.UIHelper.AddOrUpdateRecord <Factory>(myRadDataForm, _dataContext, e); if (e.Cancel == false) { RadGridView1.Rebind(); } }
private void myRadDataForm_EditEnding(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndingEventArgs e) { if (myRadDataForm.CanCommitEdit && e.EditAction == EditAction.Commit) { SysProcessModel.Certification entity = (SysProcessModel.Certification)myRadDataForm.CurrentItem; var lbxMateriels = View.Extension.UIHelper.GetDataFormField <ListBox>(myRadDataForm, "lbxMateriels"); entity.Composition = SerializeHelper.XmlObject(lbxMateriels.ItemsSource);//序列化 SysProcessView.UIHelper.AddOrUpdateRecord <SysProcessModel.Certification>(myRadDataForm, _dataContext, e); if (!e.Cancel) { RadGridView1.Rebind(); } } }
private void btnUnfreeze_Click(object sender, RoutedEventArgs e) { RadButton btn = (RadButton)sender; var row = View.Extension.UIHelper.GetAncestor <GridViewRow>(btn); row.IsSelected = true; VoucherReceiveMoney dm = (VoucherReceiveMoney)btn.DataContext; var result = _dataContext.Unfreeze(dm); if (result.IsSucceed) { RadGridView1.Rebind(); var fieldFreezenStatus = View.Extension.UIHelper.GetDataFormField <DataFormDataField>(myRadDataForm, "fieldFreezenStatus"); var tbStatus = fieldFreezenStatus.Content as TextBox; BindingExpression be = tbStatus.GetBindingExpression(TextBox.TextProperty); be.UpdateTarget(); } MessageBox.Show(result.Message); }
//这方法在改变窗体大小等时候会频繁调用,更损耗性能 //protected override void OnRender(DrawingContext drawingContext) //{ // base.OnRender(drawingContext); // btnSearch_Click(null, null); //} private void myRadDataForm_EditEnding(object sender, EditEndingEventArgs e) { if (myRadDataForm.CanCommitEdit && e.EditAction == EditAction.Commit) { if (myRadDataForm.Mode == RadDataFormMode.AddNew || myRadDataForm.Mode == RadDataFormMode.Edit) { var icCardKinds = View.Extension.UIHelper.GetDataFormField <ItemsControl>(myRadDataForm, "icCardKinds"); List <VIPCardKindEntity> cks = (List <VIPCardKindEntity>)icCardKinds.ItemsSource; VIPCardBO card = (VIPCardBO)myRadDataForm.CurrentItem; card.Kinds = cks.Where(o => o.KindID != default(int)).Select(o => new VIPKind { ID = o.KindID }).ToList(); SysProcessView.UIHelper.AddOrUpdateRecord <VIPCard>(myRadDataForm, _dataContext, e); if (!e.Cancel) { card.Kinds = null;//重新从数据库里获取 RadGridView1.Rebind(); } } } }
private void btnAudit_Click(object sender, RoutedEventArgs e) { RadButton btn = (RadButton)sender; var row = View.Extension.UIHelper.GetAncestor <GridViewRow>(btn); row.IsSelected = true; var result = _dataContext.Audit((VoucherDeductMoney)btn.DataContext); if (result.IsSucceed) { RadGridView1.Rebind(); var fieldStatus = View.Extension.UIHelper.GetDataFormField <DataFormDataField>(myRadDataForm, "fieldStatus"); var tbStatus = fieldStatus.Content as TextBox; BindingExpression be = tbStatus.GetBindingExpression(TextBox.TextProperty); be.UpdateTarget(); MessageBox.Show("审核成功!"); } else { string msg = result.Message.Replace("更新", "审核"); MessageBox.Show(msg); } }
private void myRadDataForm_EditEnding(object sender, EditEndingEventArgs e) { if (myRadDataForm.CanCommitEdit && e.EditAction == EditAction.Commit) { List <SysModule> modules = new List <SysModule>(); RadTreeView tv = this.GetMPTreeView(); //由于tv.CheckedItems不会包含未展开子节点(即使子节点被选中),因此咱们换一种方式 foreach (var item in tv.CheckedItems) { ModuleTreeItem mti = (ModuleTreeItem)item; modules.Add(mti.Module); } //以下方式同样木有用 //IList dataSource = tv.ItemsSource as IList; ////dataSource是object集合,但是竟然能用ModuleTreeItem的对象去枚举,第一次知道,不知道其它集合类型会否有类似用法 //foreach (ModuleTreeItem mti in dataSource) //{ // RadTreeViewItem container = tv.ContainerFromItemRecursive(mti); // if (container != null && container.CheckState != ToggleState.Off) // { // modules.Add(mti.Module); // if (mti.Children.Count > 0) // modules.AddRange(GetCheckedChildrenModules(tv, mti)); // } //} var role = (SysRoleBO)myRadDataForm.CurrentItem; role.Modules = modules; SetOPAndIMAccess(role); RoleVM _dataContext = new RoleVM(); UIHelper.AddOrUpdateRecord <SysRole>(myRadDataForm, _dataContext, e); if (myRadDataForm.Mode == RadDataFormMode.AddNew && !e.Cancel) { RadGridView1.Rebind();//重新绑定,将创建者反馈到界面上 } } }