public static void FyDoubleClick(object sender1, EventArgs e1) { Xceed.Grid.DataCell cell = sender1 as Xceed.Grid.DataCell; Xceed.Grid.DataRow row = cell.ParentRow as Xceed.Grid.DataRow; //if (row.ParentGrid.ReadOnly) // return; //IBoundGrid grid = (m_masterForm.ArchiveDetailForm as IArchiveDetailFormWithDetailGrids).DetailGrids[0]; ArchiveSeeForm masterForm = cell.GridControl.FindForm() as ArchiveSeeForm; if (masterForm == null) { // 通过DetailForm来的 masterForm = (cell.GridControl.FindForm() as ArchiveDetailForm).ParentForm as ArchiveSeeForm; } ArchiveOperationForm fydjForm = masterForm.Tag as ArchiveOperationForm; //if (cell.FieldName == "拟付金额" || cell.FieldName == "拟收金额" || cell.FieldName == "费用项") { if (fydjForm == null) { if (masterForm.Name == "内贸出港_票费用") { fydjForm = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("内贸出港_票费用项费用登记")) as ArchiveOperationForm; } else { fydjForm = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("业务财务_票费用项费用登记")) as ArchiveOperationForm; } masterForm.Tag = fydjForm; Dictionary <string, object> setDatanew = new Dictionary <string, object>(); fydjForm.Tag = setDatanew; (fydjForm.ControlManager.Dao as 业务费用Dao).TransactionBeginning += new EventHandler <OperateArgs <业务费用> >(delegate(object sender, OperateArgs <业务费用> e) { if (e.Entity.费用实体 == null) { 业务费用 fy = e.Entity as 业务费用; fy.费用实体 = e.Repository.Get <费用实体>(setDatanew["费用实体"]); fy.票 = fy.费用实体 as 普通票; fy.费用项编号 = (string)setDatanew["费用项"]; } }); fydjForm.DisplayManager.SearchManager.EnablePage = false; fydjForm.DisplayManager.SearchManager.DataLoaded += new EventHandler <DataLoadedEventArgs>(delegate(object sender, DataLoadedEventArgs e) { fydjForm.TopMost = true; fydjForm.Show(); }); fydjForm.FormClosing += new FormClosingEventHandler(delegate(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { if (!masterForm.IsDisposed) { if (masterForm is ArchiveOperationForm) { //(masterForm as ArchiveOperationForm).ControlManager.DisplayManager.Items[(masterForm as ArchiveOperationForm).ControlManager.DisplayManager.Position] = (fydjForm.DisplayManager.CurrentItem as 费用).费用实体; (masterForm as ArchiveOperationForm).ControlManager.DisplayManager.SearchManager.ReloadItem((masterForm as ArchiveOperationForm).ControlManager.DisplayManager.Position); (masterForm as ArchiveOperationForm).ControlManager.OnCurrentItemChanged(); } //IBoundGrid grid = (masterForm.ArchiveDetailForm as IArchiveDetailFormWithDetailGrids).DetailGrids[0]; //ISearchManager sm = grid.DisplayManager.SearchManager; //System.Data.DataTable dt = (System.Data.DataTable)sm.FindData(new List<ISearchExpression> { }, null); //foreach (System.Data.DataRow i in dt.Rows) //{ // if (i["费用项"].ToString() == setDatanew["费用项"].ToString()) // { // object save = row.Cells["Submitted"].Value; // grid.SetDataRowsIListData(i, row); // row.Cells["Submitted"].Value = save; // break; // } //} e.Cancel = true; fydjForm.Hide(); } } }); } Dictionary <string, object> setData = fydjForm.Tag as Dictionary <string, object>; setData.Clear(); //进口_额外费用_委托人 费用项双击事件 if (masterForm.Text.Equals("进口_额外费用_委托人")) { //明细窗体 if (cell.ParentColumn.Title.Equals("费用项")) { setData["费用实体"] = (Guid)row.Cells["费用实体"].Value; setData["费用项"] = (string)row.Cells["费用项"].Value; } //主窗体 else { using (var rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <费用项>()) { IList <费用项> list = (rep as Feng.NH.INHibernateRepository).List <费用项>(NHibernate.Criterion.DetachedCriteria.For <费用项>() .Add(NHibernate.Criterion.Expression.Eq("名称", cell.ParentColumn.Title))); if (list != null && list.Count > 0) { setData["费用实体"] = (row.Tag as 进口票).ID; setData["费用项"] = list[0].编号; } } } } // 票费用登记窗体 else if (row.Cells["费用实体"] != null) { setData["费用实体"] = (Guid)row.Cells["费用实体"].Value; setData["费用项"] = (string)row.Cells["费用项"].Value; if (/*cell.FieldName == "已收金额" || cell.FieldName == "应收金额" || */ cell.FieldName == "拟收金额") { setData["收付标志"] = 收付标志.收; } else if (/*cell.FieldName == "已付金额" || cell.FieldName == "应付金额" || */ cell.FieldName == "拟付金额") { setData["收付标志"] = 收付标志.付; } } // 滞箱费 else { setData["费用实体"] = (row.Tag as 费用信息).票Id; setData["费用项"] = "167"; } NameValueMappingCollection.Instance["信息_箱号_动态"].Params["@票"] = (Guid)setData["费用实体"]; NameValueMappingCollection.Instance.Reload(fydjForm.DisplayManager.Name, "信息_箱号_动态"); ISearchExpression se = SearchExpression.And(SearchExpression.Eq("费用实体.ID", (Guid)setData["费用实体"]), SearchExpression.Eq("费用项编号", (string)setData["费用项"])); if (setData.ContainsKey("收付标志")) { se = SearchExpression.And(se, SearchExpression.Eq("收付标志", setData["收付标志"])); } fydjForm.ControlManager.DisplayManager.SearchManager.LoadData(se, null); } //Dictionary<string, bool?> submitted = new Dictionary<string, bool?>(); //foreach (Xceed.Grid.DataRow i in grid.DataRows) //{ // submitted[i.Cells["费用项"].Value.ToString()] = (bool?)i.Cells["Submitted"].Value; //} //(row.GridControl as IBoundGrid).ReloadData(); //foreach (Xceed.Grid.DataRow i in grid.DataRows) //{ // i.Cells["Submitted"].Value = submitted[i.Cells["费用项"].Value.ToString()]; //} }
public static void FyDoubleClick(object sender1, EventArgs e1) { Xceed.Grid.DataCell cell = sender1 as Xceed.Grid.DataCell; Xceed.Grid.DataRow row = cell.ParentRow as Xceed.Grid.DataRow; ArchiveSeeForm masterForm = cell.GridControl.FindForm() as ArchiveSeeForm; if (masterForm == null) { // 通过DetailForm来的 masterForm = (cell.GridControl.FindForm() as ArchiveDetailForm).ParentForm as ArchiveSeeForm; } ArchiveOperationForm fydjForm = masterForm.Tag as ArchiveOperationForm; //if (cell.FieldName == "拟付金额" || cell.FieldName == "拟收金额" || cell.FieldName == "费用项") { if (fydjForm == null) { fydjForm = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("业务备案_车辆产值费用_双击")) as ArchiveOperationForm; masterForm.Tag = fydjForm; Dictionary <string, object> setDatanew = new Dictionary <string, object>(); fydjForm.Tag = setDatanew; (fydjForm.ControlManager.Dao as 业务费用Dao).TransactionBeginning += new EventHandler <OperateArgs <费用> >(delegate(object sender, OperateArgs <费用> e) { if (e.Entity.费用实体 == null) { 业务费用 fy = e.Entity as 业务费用; fy.费用实体 = e.Repository.Get <费用实体>(setDatanew["费用实体"]); fy.费用项编号 = (string)setDatanew["费用项"]; fy.车辆产值 = fy.费用实体 as 车辆产值; } }); fydjForm.DisplayManager.SearchManager.EnablePage = false; fydjForm.DisplayManager.SearchManager.DataLoaded += new EventHandler <DataLoadedEventArgs>(delegate(object sender, DataLoadedEventArgs e) { fydjForm.TopMost = true; fydjForm.Show(); }); fydjForm.FormClosing += new FormClosingEventHandler(delegate(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { if (!masterForm.IsDisposed) { if (masterForm is ArchiveOperationForm) { (masterForm as ArchiveOperationForm).ControlManager.DisplayManager.SearchManager.ReloadItem((masterForm as ArchiveOperationForm).ControlManager.DisplayManager.Position); (masterForm as ArchiveOperationForm).ControlManager.OnCurrentItemChanged(); } e.Cancel = true; fydjForm.Hide(); } else { } } }); } Dictionary <string, object> setData = fydjForm.Tag as Dictionary <string, object>; setData.Clear(); // 票费用登记窗体 if (row.Cells["费用实体"] != null) { setData["费用实体"] = (Guid)row.Cells["费用实体"].Value; setData["费用项"] = (string)row.Cells["费用项"].Value; if (/*cell.FieldName == "已收金额" || cell.FieldName == "应收金额" || */ cell.FieldName == "拟收金额") { setData["收付标志"] = 收付标志.收; } else if (/*cell.FieldName == "已付金额" || cell.FieldName == "应付金额" || */ cell.FieldName == "拟付金额") { setData["收付标志"] = 收付标志.付; } } else { throw new ArgumentException("There must be a column named 费用实体!"); } //NameValueMappingCollection.Instance["信息_箱号_动态"].Params["@票"] = (Guid)setData["费用实体"]; //NameValueMappingCollection.Instance.Reload("信息_箱号_动态"); //Feng.Windows.Forms.MyObjectPicker op = (fydjForm.MasterGrid.GetInsertionRow().Cells["任务"].CellEditorManager as Feng.Grid.Editors.MyObjectPickerEditor).TemplateControl; //string exp = "车辆产值.ID = " + ((Guid)setData["费用实体"]).ToString(); //op.SearchExpressionParam = exp; Feng.Windows.Forms.MyObjectPicker op = (fydjForm.MasterGrid.Columns["任务"].CellEditorManager as Feng.Grid.Editors.MyObjectPickerEditor).TemplateControl; string exp = "车辆产值.ID = " + ((Guid)setData["费用实体"]).ToString(); op.SearchExpressionParam = exp; ISearchExpression se = SearchExpression.And(SearchExpression.Eq("费用实体.ID", (Guid)setData["费用实体"]), SearchExpression.Eq("费用项编号", (string)setData["费用项"])); if (setData.ContainsKey("收付标志")) { se = SearchExpression.And(se, SearchExpression.Eq("收付标志", setData["收付标志"])); } fydjForm.ControlManager.DisplayManager.SearchManager.LoadData(se, new List <ISearchOrder>()); } }