void AdInfoSearchForm_DoubleClick(object sender, EventArgs e) { Xceed.Grid.DataCell cell = sender as Xceed.Grid.DataCell; var row = cell.ParentRow; var dmc = ServiceProvider.GetService <IApplication>().ExecuteAction(row.Cells["Table"].Value.ToString()) as IDisplayManagerContainer; dmc.DisplayManager.SearchManager.LoadData(SearchExpression.Eq(row.Cells["Column"].Value.ToString(), row.Cells["Value"].Value.ToString()), null); }
public static void 货代自编号DoubleClick(object sender, EventArgs e) { Xceed.Grid.DataCell cell = sender as Xceed.Grid.DataCell; string hdzbh = (string)cell.Value; if (string.IsNullOrEmpty(hdzbh)) { return; } process_watcher.OpenFileToAttachment(hdzbh); }
void f_Deactivate(object sender, EventArgs e) { Form f = sender as Form; Xceed.Grid.DataCell cell = f.Tag as Xceed.Grid.DataCell; if (cell != null) { cell.BackColor = Color.LightCoral; } //throw new Exception("The method or operation is not implemented."); }
void cell_Click(object sender, EventArgs e) { Xceed.Grid.DataCell cell = sender as Xceed.Grid.DataCell; int id = (int)(cell.ParentRow.Cells["ID"].Value); if (mEditorforms.ContainsKey(id)) { mEditorforms[id].BringToFront(); } else { TriggerValue val = mParentTriggerNamespace.GetValues()[id]; VarValueBinder binder = new VarValueBinder(val, val); HighLevelProperty HLProp = TriggerSystemMain.mTriggerDefinitions.GetHLProperty(binder, mParentTriggerNamespace); string bindName; Control c = HLProp.GetEditor(out bindName); //this.TemplateControl = c; //this.TemplateControl Form f = new Form(); f.Tag = id; f.Controls.Add(c); c.Dock = DockStyle.Fill; f.Text = binder.GetName(); //f.TopLevelControl = true; f.Size = new Size(200, 55); Point p1 = new Point(0, 0); Point p2 = cell.PointToScreen(p1); f.StartPosition = FormStartPosition.Manual; p2.Y -= 30; p2.X -= 60; f.Location = p2; //f.Init(this, mVariable, mValue, mHLProp); //f.FormClosed += new FormClosedEventHandler(f_FormClosed); //f.Show(); f.FormClosed += new FormClosedEventHandler(f_FormClosed); f.TopMost = true; f.Show(); mEditorforms[id] = f; } }
void gridControl1_MouseClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left) { return; } Point p = new Point(e.X, e.Y); object o2 = gridControl1.GetVisualGridElementAtPoint(p); Xceed.Grid.DataCell cell = o2 as Xceed.Grid.DataCell; if (cell != null) { //cell.Value; int col = cell.ParentColumn.Index; Xceed.Grid.DataBoundColumn dataCol = cell.ParentColumn as Xceed.Grid.DataBoundColumn; Xceed.Grid.DataRow dataRow = cell.ParentRow as Xceed.Grid.DataRow; if (dataCol != null && dataRow != null) { object sourceObject = dataRow.SourceObject; int rowNum = dataRow.Index; string field = dataCol.FieldName; if (mCellClicked != null) { mCellClicked.Invoke(sourceObject, field, rowNum, col); } if (mObjectEditor != null) { Control c = mObjectEditor.GetSingleControl(sourceObject, field); PopupEditor pe = new PopupEditor(); Form f = pe.ShowPopup(this, c, FormBorderStyle.FixedSingle, true); Point p2 = this.PointToScreen(p); f.Deactivate += new EventHandler(f_Deactivate); f.Tag = cell; f.Top = p2.Y; f.Left = p2.X; f.Show(); //if (ContentMessageBox.ShowMessage(this, c, "") == DialogResult.OK) //{ // //this.LocStringID = p.LocStringID; //} } } } }
public static void 油费金额计算(object sender, EventArgs e) { decimal count = 0; if (sender is Xceed.Grid.DataCell) { Xceed.Grid.DataCell cell = sender as Xceed.Grid.DataCell; Xceed.Grid.DataRow row = cell.ParentRow as Xceed.Grid.DataRow; if (cell.ReadOnly || !((string)row.Cells["费用项编号"].Value == "204" || (string)row.Cells["费用项编号"].Value == "205") || row.Cells["车辆编号"].Value == null) { return; } if (row.Cells["升数"] != null && row.Cells["升数"].Value != null) { count = (decimal)row.Cells["升数"].Value; } else if (row.Cells["数量"] != null && row.Cells["数量"].Value != null) { count = (decimal)row.Cells["数量"].Value; } else { return; } //ArchiveSeeForm form = cell.GridControl.FindForm() as ArchiveSeeForm; 车辆 cl = null; //if ((form.DisplayManager.CurrentItem) is 业务费用) //{ // cl = (form.DisplayManager.CurrentItem as 业务费用).车辆; //} //else if ((form.DisplayManager.CurrentItem) is 非业务车辆费用) //{ // cl = (form.DisplayManager.CurrentItem as 非业务车辆费用).车辆; //} //else //{ // throw new InvalidOperationException("实体不属于业务费用或非业务车辆费用!"); //} using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <车辆>()) { cl = rep.Get <车辆>(new Guid(row.Cells["车辆编号"].Value.ToString())); } if (cl != null) { switch (cl.车辆类别) { case 车辆类别.自有车: case 车辆类别.代管车: if (row.Cells["费用归属"] != null && row.Cells["费用归属"].Value.ToString() == "对外") { if (cbyj.HasValue) { cell.CellEditorControl.Text = (cbyj * count).ToString(); } else { throw new ArgumentException("数据库中必须配置成本油价!"); } } else { if (jsyyj.HasValue) { cell.CellEditorControl.Text = (jsyyj * count).ToString(); } else { throw new ArgumentException("数据库中必须配置驾驶员油价!"); } } break; case 车辆类别.挂靠车: if (row.Cells["费用归属"] != null && row.Cells["费用归属"].Value.ToString() == "对外") { cell.CellEditorControl.Text = decimal.Multiply(Convert.ToDecimal(cbyj), count).ToString(); } else if (row.Cells["费用归属"] != null && row.Cells["费用归属"].Value.ToString() == "车主") { if ((string)row.Cells["费用项编号"].Value == "204") //油费 { if (czyj.HasValue) { cell.CellEditorControl.Text = (czyj * count).ToString(); } else { throw new ArgumentException("数据库中必须配置车主油价!"); } } else //定耗油 { if (czyj.HasValue && jsyyj.HasValue) { cell.CellEditorControl.Text = ((czyj - jsyyj) * count).ToString(); } else { throw new ArgumentException("数据库中必须配置车主油价、驾驶员油价!!"); } } } else { throw new ArgumentException("费用归属不规范!"); } break; case 车辆类别.外协车: break; default: throw new ArgumentException("车辆类别不规范!"); } } } else if (sender is Xceed.Grid.InsertionCell) { Xceed.Grid.InsertionCell cell = sender as Xceed.Grid.InsertionCell; Xceed.Grid.InsertionRow row = cell.ParentRow as Xceed.Grid.InsertionRow; if (cell.ReadOnly || !((string)row.Cells["费用项编号"].Value == "204" || (string)row.Cells["费用项编号"].Value == "205") || row.Cells["车辆编号"].Value == null) { return; } if (row.Cells["升数"] != null && row.Cells["升数"].Value != null) { count = (decimal)row.Cells["升数"].Value; } else if (row.Cells["数量"] != null && row.Cells["数量"].Value != null) { count = (decimal)row.Cells["数量"].Value; } else { return; } //ArchiveSeeForm form = cell.GridControl.FindForm() as ArchiveSeeForm; 车辆 cl = null; //if ((form.DisplayManager.CurrentItem) is 业务费用) //{ // cl = (form.DisplayManager.CurrentItem as 业务费用).车辆; //} //else if ((form.DisplayManager.CurrentItem) is 非业务车辆费用) //{ // cl = (form.DisplayManager.CurrentItem as 非业务车辆费用).车辆; //} //else //{ // throw new InvalidOperationException("实体不属于业务费用或非业务车辆费用!"); //} using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <车辆>()) { cl = rep.Get <车辆>(new Guid(row.Cells["车辆编号"].Value.ToString())); } if (cl != null) { switch (cl.车辆类别) { case 车辆类别.自有车: case 车辆类别.代管车: if (row.Cells["费用归属"] != null && row.Cells["费用归属"].Value.ToString() == "对外") { cell.CellEditorControl.Text = decimal.Multiply(Convert.ToDecimal(cbyj), count).ToString(); } else { cell.CellEditorControl.Text = decimal.Multiply(Convert.ToDecimal(jsyyj), count).ToString(); } break; case 车辆类别.挂靠车: if (row.Cells["费用归属"] != null && row.Cells["费用归属"].Value.ToString() == "对外") { cell.CellEditorControl.Text = decimal.Multiply(Convert.ToDecimal(cbyj), count).ToString(); } else if (row.Cells["费用归属"] != null && row.Cells["费用归属"].Value.ToString() == "车主") { if ((string)row.Cells["费用项编号"].Value == "204") //油费 { cell.CellEditorControl.Text = decimal.Multiply(Convert.ToDecimal(czyj), count).ToString(); } else //定耗油 { cell.CellEditorControl.Text = decimal.Multiply(Convert.ToDecimal(czyj) - Convert.ToDecimal(jsyyj), count).ToString(); } } else { throw new ArgumentException("费用归属不规范!"); } break; case 车辆类别.外协车: break; default: throw new ArgumentException("车辆类别不规范!"); } } } }
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>()); } }