private void tsbRefresh_Click(object sender, EventArgs e) { m_masterGrid.ReloadData(); }
public static bool 票费用保存(ArchiveOperationForm masterForm) { IBoundGrid grid = (masterForm.ArchiveDetailForm as IArchiveDetailFormWithDetailGrids).DetailGrids[0]; if (grid.DataRows.Count == 0) { return(true); } using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <费用信息>()) { try { rep.BeginTransaction(); IList <费用信息> list = (rep as Feng.NH.INHibernateRepository).List <费用信息>(NHibernate.Criterion.DetachedCriteria.For <费用信息>() .Add(NHibernate.Criterion.Expression.Eq("票Id", (Guid)grid.DataRows[0].Cells["费用实体"].Value))); Dictionary <string, 费用信息> fyxxs = new Dictionary <string, 费用信息>(); foreach (费用信息 i in list) { fyxxs[i.费用项编号] = i; } // 收 foreach (Xceed.Grid.DataRow row in grid.DataRows) { bool?b = Feng.Utils.ConvertHelper.ToBoolean(row.Cells["Submitted"].Value); if (!b.HasValue) { continue; } string fyx = (string)(row.Cells["费用项"].Value); if (!fyxxs.ContainsKey(fyx)) { 费用信息 fyxx = new 费用信息(); fyxx.票Id = (Guid)row.Cells["费用实体"].Value; fyxx.费用项编号 = (string)(row.Cells["费用项"].Value); fyxx.业务类型编号 = (int)(row.Cells["业务类型"].Value); fyxx.Submitted = b.Value; (new HdBaseDao <费用信息>()).Save(rep, fyxx); fyxxs[fyxx.费用项编号] = fyxx; // MessageForm.ShowInfo("此费用项下还未有费用,不需要打完全标志!"); } else { 费用信息 fyxx = fyxxs[fyx]; if (fyxx.Submitted != b.Value) { fyxx.Submitted = b.Value; (new HdBaseDao <费用信息>()).Update(rep, fyxx); } } } // 付 foreach (Xceed.Grid.DataRow row in grid.DataRows) { bool?b = Feng.Utils.ConvertHelper.ToBoolean(row.Cells["完全标志付"].Value); if (!b.HasValue) { continue; } string fyx = (string)(row.Cells["费用项"].Value); if (!fyxxs.ContainsKey(fyx)) { 费用信息 fyxx = new 费用信息(); fyxx.票Id = (Guid)row.Cells["费用实体"].Value; fyxx.费用项编号 = (string)(row.Cells["费用项"].Value); fyxx.业务类型编号 = (int)(row.Cells["业务类型"].Value); fyxx.完全标志付 = b.Value; (new HdBaseDao <费用信息>()).Save(rep, fyxx); fyxxs[fyxx.费用项编号] = fyxx; // MessageForm.ShowInfo("此费用项下还未有费用,不需要打完全标志!"); } else { 费用信息 fyxx = fyxxs[fyx]; if (fyxx.完全标志付 != b.Value) { fyxx.完全标志付 = b.Value; (new HdBaseDao <费用信息>()).Update(rep, fyxx); } } } rep.CommitTransaction(); masterForm.ControlManager.OnCurrentItemChanged(); grid.ReloadData(); masterForm.ControlManager.State = Feng.StateType.View; if (masterForm.ControlManager.ControlCheckExceptionProcess != null) { masterForm.ControlManager.ControlCheckExceptionProcess.ClearAllError(); } masterForm.ControlManager.EndEdit(false); return(true); } catch (Exception ex) { rep.RollbackTransaction(); ServiceProvider.GetService <IExceptionProcess>().ProcessWithNotify(ex); } return(false); } }
private void tsmRefresh_Click(object sender, EventArgs e) { m_grid.ReloadData(); }