/// <summary>
        /// OnKeyDown(Process Down Key)
        /// </summary>
        /// <param name="e"></param>
        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (e.Control &&
                (e.KeyCode == Keys.C || e.KeyCode == Keys.V || e.KeyCode == Keys.X))
            {
                base.OnKeyDown(e);
                return;
            }

            try
            {
                MyObjectPicker box1 = ParentObjectPicker;
                if (!box1.ReadOnly)
                {
                    GridControl grid = box1.DropDownControl;

                    switch (e.KeyCode)
                    {
                    case Keys.Down:
                        if (!box1.DroppedDown)
                        {
                            box1.DroppedDown = true;
                        }
                        MyComboBoxTextBoxArea.MoveCurrentRowDown(grid);
                        e.Handled = true;
                        break;

                    case Keys.Up:
                        MyComboBoxTextBoxArea.MoveCurrentRowUp(grid);
                        e.Handled = true;
                        break;

                    case Keys.Enter:
                        if (box1.DroppedDown)
                        {
                            box1.DroppedDown = false;
                        }
                        e.Handled = true;
                        break;

                    case Keys.Escape:
                        if (box1.DroppedDown)
                        {
                            box1.DroppedDown = false;
                        }
                        e.Handled = true;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithResume(ex);
            }
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="template"></param>
        protected MyObjectPicker(MyObjectPicker template)
            : base(template)
        {
            InitializeComponent();

            Initialize();

            this.DisplayMember = template.DisplayMember;
            this.DropDownSize = template.DropDownSize;

            IDisplayManager dmMaster = template.DropDownControl.DisplayManager.Clone() as IDisplayManager;
            dmMaster.BindingControls.Clear();
            dmMaster.BindingControls.Add(this.dropDownGrid);
            this.DropDownControl.SetDisplayManager(dmMaster, template.DropDownControl.GridName);
            //this.DropDownControl.SetDataBinding(template.DropDownControl.DataSource, template.DropDownControl.DataMember);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="template"></param>
        protected MyObjectPicker(MyObjectPicker template)
            : base(template)
        {
            InitializeComponent();

            Initialize();

            this.DisplayMember = template.DisplayMember;
            this.DropDownSize  = template.DropDownSize;

            IDisplayManager dmMaster = template.DropDownControl.DisplayManager.Clone() as IDisplayManager;

            dmMaster.BindingControls.Clear();
            dmMaster.BindingControls.Add(this.dropDownGrid);
            this.DropDownControl.SetDisplayManager(dmMaster, template.DropDownControl.GridName);
            //this.DropDownControl.SetDataBinding(template.DropDownControl.DataSource, template.DropDownControl.DataMember);
        }
        /// <summary>
        /// 重载KeyPress事件,当ComboBox为ReadOnly时,不处理KeyPress事件
        /// </summary>
        /// <param name="e"></param>
        protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e)
        {
            MyObjectPicker box1 = this.ParentObjectPicker;

            box1.OnOwnKeyPress(e);

            if (!this.ReadOnly)
            {
                base.OnKeyPress(e);

                if (base.IsInputChar(e.KeyChar))
                {
                    if (e.KeyChar == (char)Keys.Enter)
                    {
                        return;
                    }

                    OwnTextChanged();
                }
            }
        }
 //private string m_windowId, m_displayMember, m_searchExpression;
 ///// <summary>
 ///// Constructor
 ///// </summary>
 //public MyObjectPickerEditor(string windowId, string displayMember, string searchExpression)
 //    : this(new MyObjectPicker())
 //{
 //    this.m_windowId = windowId;
 //    this.m_displayMember = displayMember;
 //    this.m_searchExpression = searchExpression;
 //    Feng.Utils.ControlFactory.InitObjectPicker(this.TemplateControl, windowId, displayMember, searchExpression);
 //    this.InitializeTemplateControl();
 //}
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="template"></param>
 protected MyObjectPickerEditor(MyObjectPicker template)
     : base(template)
 {
 }
Ejemplo n.º 6
0
        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>());
            }
        }