コード例 #1
0
        void 任务管理_DoubleClick(object sender, EventArgs e)
        {
            Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell;
            if (srcCell == null)
            {
                return;
            }

            任务 rw = srcCell.ParentRow.Tag as 任务;

            if (rw != null)
            {
                if (srcCell.ParentColumn.FieldName == "撤销预发送")
                {
                    撤销任务预发送(rw);
                }
                else if (srcCell.ParentColumn.FieldName == "撤销备案确认")
                {
                    撤销任务备案确认(rw);
                }
                else if (srcCell.ParentColumn.FieldName == "撤销专家任务")
                {
                    撤销任务的专家任务(rw);
                }
            }

            btn刷新_Click(btn刷新, EventArgs.Empty);
        }
コード例 #2
0
        void 专家任务管理_DoubleClick(object sender, EventArgs e)
        {
            Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell;
            if (srcCell == null)
            {
                return;
            }

            专家任务 zjrw = srcCell.ParentRow.Tag as 专家任务;

            if (zjrw != null)
            {
                if (srcCell.ParentColumn.FieldName == "撤销监控")
                {
                    撤销专家任务的车辆作业监控(zjrw);
                }
                else if (srcCell.ParentColumn.FieldName == "撤销车辆作业")
                {
                    撤销专家任务的车辆作业(zjrw);
                }
                else if (srcCell.ParentColumn.FieldName == "撤销任务下达")
                {
                    撤销专家任务下达(zjrw);
                }
            }

            btn刷新_Click(btn刷新, EventArgs.Empty);
        }
コード例 #3
0
        void 车队调度静态任务下达_GridDragStart(object sender, GridDataGragEventArgs e)
        {
            e.Data          = null;
            e.AllowedEffect = DragDropEffects.None;

            Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell;
            if (srcCell == null)
            {
                return;
            }

            if (srcCell.GridControl == m_待命车辆_单车单任务Grid)
            {
                if (srcCell.ParentColumn.FieldName == m_topGridDragFildeName &&
                    srcCell.Value != null &&
                    srcCell.ParentRow.Cells["作业号"].Value == null)
                {
                    e.Data          = new DataObject(m_dragDataFormatDelete, srcCell);
                    e.AllowedEffect = DragDropEffects.Move;
                }
            }
            else if (srcCell.GridControl == m_待排任务Grid)
            {
                if (srcCell.ParentRow.ForeColor != 专家调度一级静态优化.优化DisableColor)
                {
                    e.Data          = new DataObject(m_dragDataFormatAdd, srcCell);
                    e.AllowedEffect = DragDropEffects.Link;
                }
            }
        }
コード例 #4
0
        internal static void 专家调度一级静态优化_GridDragStart(object sender, GridDataGragEventArgs e)
        {
            e.Data          = null;
            e.AllowedEffect = DragDropEffects.None;

            Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell;
            if (srcCell == null)
            {
                return;
            }

            //Xceed.Grid.CellRow row = srcCell.ParentRow;
            if (srcCell.GridControl.Name.Contains("top") || srcCell.GridControl.Name.Contains("小箱配对"))
            {
                if (srcCell.ParentColumn.FieldName == m_topGridDragFildeName &&
                    srcCell.Value != null &&
                    srcCell.ParentRow.Cells["新任务号"].Value == null)
                {
                    e.Data          = new DataObject(m_dragDataFormatDelete, srcCell);
                    e.AllowedEffect = DragDropEffects.Move;
                    return;
                }
            }
            if (srcCell.GridControl.Name.Contains("bottom") || srcCell.GridControl.Name.Contains("小箱配对"))
            {
                if (srcCell.ParentRow.ForeColor != 专家调度一级静态优化.优化DisableColor)
                {
                    e.Data          = new DataObject(m_dragDataFormatAdd, srcCell);
                    e.AllowedEffect = DragDropEffects.Link;
                    return;
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Evaluate
        /// </summary>
        /// <param name="validationProvider"></param>
        /// <param name="componentToValidate"></param>
        /// <param name="valueToValidate"></param>
        /// <param name="validationMessage"></param>
        /// <returns></returns>
        public override bool Evaluate(ValidationProvider validationProvider, object componentToValidate,
                                      string valueToValidate, out string validationMessage)
        {
            validationMessage = string.Empty;

            IDataValueControl dataControl = componentToValidate as IDataValueControl;

            if (dataControl != null)
            {
                valueToValidate = (dataControl.SelectedDataValue == null
                                       ? null
                                       : dataControl.SelectedDataValue.ToString());
                if (dataControl.ReadOnly)
                {
                    return(true);
                }
            }
            Xceed.Grid.Cell cell = componentToValidate as Xceed.Grid.Cell;
            if (cell != null)
            {
                if (cell.ReadOnly)
                {
                    return(true);
                }
            }

            //object nullValue;
            //if (!s_nullValues.ContainsKey(m_dataType))
            //{
            //    nullValue = string.Empty;
            //}
            //else
            //{
            //    nullValue = s_nullValues[m_dataType];
            //}


            if (valueToValidate == null)
            {
                valueToValidate = string.Empty;
            }
            if ((valueToValidate != null) && base.Trim)
            {
                valueToValidate = valueToValidate.Trim();
            }

            if (string.IsNullOrEmpty(valueToValidate))
            {
                validationMessage = (base.CustomValidationMessages.RequiredField != null)
                                        ? base.CustomValidationMessages.RequiredField
                                        : validationProvider.DefaultValidationMessages.RequiredField;
                validationMessage = validationMessage.Replace("%name%", base.CriterionName);
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #6
0
        internal static void 专家调度一级动态优化_GridDragOver(object sender, DragEventArgs e)
        {
            e.Effect = DragDropEffects.None;
            if (e.Data == null)
            {
                return;
            }
            if (e.Data.GetDataPresent(m_dragDataFormatAdd))
            {
                Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell;
                if (destCell == null)
                {
                    return;
                }
                Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatAdd) as Xceed.Grid.Cell;

                // 增加
                if (srcCell.GridControl != destCell.GridControl &&
                    destCell.Value == null &&
                    destCell.ParentColumn.FieldName == m_topGridDragFildeName &&
                    destCell.ParentRow.ForeColor != 专家调度一级静态优化.优化DisableColor)
                {
                    e.Effect = DragDropEffects.Link;
                }
            }
            else if (e.Data.GetDataPresent(m_dragDataFormatDelete))
            {
                Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell;
                Xceed.Grid.Cell srcCell  = e.Data.GetData(m_dragDataFormatDelete) as Xceed.Grid.Cell;
                if (destCell != null)
                {
                    // 更改
                    if (destCell.GridControl == srcCell.GridControl)
                    {
                        if (destCell.Value == null &&
                            destCell.ParentColumn.FieldName == m_topGridDragFildeName &&
                            destCell.ParentRow != srcCell.ParentRow &&
                            destCell.ParentRow.ForeColor != 专家调度一级静态优化.优化DisableColor)
                        {
                            e.Effect = DragDropEffects.Move;
                        }
                    }
                    // 删除
                    else
                    {
                        e.Effect = DragDropEffects.Move;
                    }
                }
                else
                {
                    // 删除
                    Xceed.Grid.GridControl destGrid = sender as Xceed.Grid.GridControl;
                    if (destGrid != null && destGrid != srcCell.GridControl)
                    {
                        e.Effect = DragDropEffects.Move;
                    }
                }
            }
        }
コード例 #7
0
        void m_全部监管车辆及作业现状Grid_GridDragOver(object sender, System.Windows.Forms.DragEventArgs e)
        {
            e.Effect = System.Windows.Forms.DragDropEffects.None;
            if (e.Data == null)
            {
                return;
            }

            if (e.Data.GetDataPresent(m_dragDataFormatAdd))
            {
                Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell;
                if (destCell == null)
                {
                    return;
                }
                Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatAdd) as Xceed.Grid.Cell;

                // 增加
                if (srcCell.GridControl != destCell.GridControl &&
                    destCell.Value == null &&
                    destCell.ParentColumn.FieldName.StartsWith("第") && destCell.ParentColumn.FieldName.EndsWith("天"))
                {
                    e.Effect = System.Windows.Forms.DragDropEffects.Link;
                }
            }
            else if (e.Data.GetDataPresent(m_dragDataFormatDelete))
            {
                Xceed.Grid.Cell destCell = sender as Xceed.Grid.Cell;
                if (destCell == null)
                {
                    Xceed.Grid.GridControl grid = sender as Xceed.Grid.GridControl;
                    if (grid != null)
                    {
                        e.Effect = System.Windows.Forms.DragDropEffects.Move;
                    }
                }
                else
                {
                    Xceed.Grid.Cell srcCell = e.Data.GetData(m_dragDataFormatDelete) as Xceed.Grid.Cell;
                    if (srcCell != null)
                    {
                        if (srcCell.GridControl != destCell.GridControl)
                        {
                            e.Effect = System.Windows.Forms.DragDropEffects.Move;
                        }
                        else
                        {
                            if (destCell.Value == null &&
                                destCell.ParentColumn.FieldName.StartsWith("第") && destCell.ParentColumn.FieldName.EndsWith("天"))
                            {
                                e.Effect = System.Windows.Forms.DragDropEffects.Move;
                            }
                        }
                    }
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// 验证是否符合格式。(只读的不验证)
        /// </summary>
        /// <param name="validationProvider"></param>
        /// <param name="componentToValidate"></param>
        /// <param name="valueToValidate"></param>
        /// <param name="validationMessage"></param>
        /// <returns></returns>
        public override bool Evaluate(ValidationProvider validationProvider, object componentToValidate,
                                      string valueToValidate, out string validationMessage)
        {
            validationMessage = string.Empty;

            IDataValueControl dataControl = componentToValidate as IDataValueControl;

            if (dataControl != null)
            {
                valueToValidate = (dataControl.SelectedDataValue == null
                                       ? null
                                       : dataControl.SelectedDataValue.ToString());

                if (dataControl.ReadOnly)
                {
                    return(true);
                }
            }
            Xceed.Grid.Cell cell = componentToValidate as Xceed.Grid.Cell;
            if (cell != null)
            {
                if (cell.ReadOnly)
                {
                    return(true);
                }
            }

            if (valueToValidate == null)
            {
                valueToValidate = string.Empty;
            }

            if (base.Trim)
            {
                valueToValidate = valueToValidate.Trim();
            }

            if (string.IsNullOrEmpty(valueToValidate))
            {
                return(true);
            }

            bool success = true;

            //Regex regex = base.CaseSensitive ? new Regex(this.RegularExpression ?? "") : new Regex(this.RegularExpression ?? "", RegexOptions.IgnoreCase);
            success = m_regex.Match(valueToValidate).Success;
            if (!success)
            {
                validationMessage = (base.CustomValidationMessages.RegularExpression != null)
                                        ? base.CustomValidationMessages.RegularExpression
                                        : validationProvider.DefaultValidationMessages.RegularExpression;
                validationMessage = validationMessage.Replace("%name%", base.CriterionName);
            }
            return(success);
        }
コード例 #9
0
 private static void TryFillCellDateTimeValue(Xceed.Grid.Cell cell, DateTime time)
 {
     if (cell.ParentColumn.DataType == typeof(DateTime))
     {
         cell.Value = time;
     }
     else if (cell.ParentColumn.DataType == typeof(string))
     {
         cell.Value = Helper.DateTime2String(time);
     }
 }
コード例 #10
0
        public static void 车辆_车主驾驶员_对应(object sender, SelectedDataValueChangedEventArgs e)
        {
            if (e.DataControlName == "车辆编号")
            {
                IDisplayManager dm = sender as IDisplayManager;

                IDataControl dc = e.Container as IDataControl;
                if (dc != null)
                {
                    if (dc.SelectedDataValue != null)
                    {
                        车辆 cl = EntityBufferCollection.Instance.Get <车辆>(dc.SelectedDataValue);
                        if (cl != null)
                        {
                            if (dm.DataControls["车主编号"] != null && dm.DataControls["车主编号"].SelectedDataValue == null)
                            {
                                dm.DataControls["车主编号"].SelectedDataValue = cl.车主编号;
                            }
                            if (dm.DataControls["承运人编号"] != null && dm.DataControls["承运人编号"].SelectedDataValue == null)
                            {
                                dm.DataControls["承运人编号"].SelectedDataValue = cl.车主编号;
                            }
                            if (dm.DataControls["驾驶员编号"] != null && dm.DataControls["驾驶员编号"].SelectedDataValue == null)
                            {
                                dm.DataControls["驾驶员编号"].SelectedDataValue = cl.默认驾驶员编号;
                            }
                        }
                    }
                }
                else
                {
                    Xceed.Grid.Cell cell = e.Container as Xceed.Grid.Cell;
                    if (cell.Value != null)
                    {
                        车辆 cl = EntityBufferCollection.Instance.Get <车辆>(cell.Value);
                        if (cl != null)
                        {
                            if (cell.ParentRow.Cells["车主编号"] != null && cell.ParentRow.Cells["车主编号"].Value == null)
                            {
                                cell.ParentRow.Cells["车主编号"].Value = cl.车主编号;
                            }
                            if (cell.ParentRow.Cells["承运人编号"] != null && cell.ParentRow.Cells["承运人编号"].Value == null)
                            {
                                cell.ParentRow.Cells["承运人编号"].Value = cl.车主编号;
                            }
                            if (cell.ParentRow.Cells["驾驶员编号"] != null && cell.ParentRow.Cells["驾驶员编号"].Value == null)
                            {
                                cell.ParentRow.Cells["驾驶员编号"].Value = cl.默认驾驶员编号;
                            }
                        }
                    }
                }
            }
        }
コード例 #11
0
        private void 作业实时监控_MouseEnter(object sender, EventArgs e)
        {
            Xceed.Grid.Cell src = sender as Xceed.Grid.Cell;
            string          s   = (src.ParentRow.Tag as 车辆作业).备注;

            if (!string.IsNullOrEmpty(s))
            {
                (src.GridControl as MyGrid).GridHelper.GridToolTip.RemoveAll();
                (src.GridControl as MyGrid).GridHelper.GridToolTip.SetToolTip((src.GridControl as MyGrid), s);
            }
        }
コード例 #12
0
 void 预录入发送后情况查询_DoubleClick(object sender, EventArgs e)
 {
     Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell;
     if (srcCell.ParentColumn.FieldName == "预录入号")
     {
         预录入任务详细信息 form = new 预录入任务详细信息(m_信息区Grid.ControlManager as IWindowControlManager <任务>);
         if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             m_信息区Grid.ResetRowData(srcCell.ParentRow as Xceed.Grid.DataRow);
         }
     }
 }
コード例 #13
0
 void tsmPaste_Click(object sender, EventArgs e)
 {
     if (m_contextCell != null)
     {
         PasteClipboardToCells(m_contextCell, false);
         m_contextCell = null;
     }
     else if (m_contextSelector != null)
     {
         PasteClipboardToCells((m_contextSelector.Row as Xceed.Grid.DataRow).Cells[0], true);
     }
 }
コード例 #14
0
        void TrackForm_StartTime_DoubleClick(object sender, EventArgs e)
        {
            Xceed.Grid.Cell cell   = sender as Xceed.Grid.Cell;
            Track           entity = cell.ParentRow.Tag as Track;

            if (entity != null)
            {
                WebForm form = new WebForm("车辆轨迹", string.Format("{0}/CarTrackService/TrackAnimation.aspx?TrackId={1}",
                                                                 SystemConfiguration.Server, entity.ID.ToString()));
                form.ShowDialog();
            }
        }
コード例 #15
0
        void cell_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                tsmSetRowsInColumn.Visible = true;

                m_contextCell = sender as Xceed.Grid.DataCell;
                contextMenuStrip1.Show(m_contextCell.PointToScreen(new System.Drawing.Point(e.X, e.Y)));

                m_contextSelector = null;
            }
        }
コード例 #16
0
 void tsmAddNew_Click(object sender, System.EventArgs e)
 {
     if (m_contextCell != null)
     {
         this.DataRows.AddNew().EndEdit();
         m_contextCell = null;
     }
     else if (m_contextSelector != null)
     {
         this.DataRows.AddNew().EndEdit();
         m_contextSelector = null;
     }
 }
コード例 #17
0
        private void ModifySrcCell(Xceed.Grid.Cell srcCell, int delta)
        {
            string s = srcCell.ParentRow.Cells[m_topGridDragFildeName].Value.ToString();

            string[] ss  = s.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
            int?     idx = ConvertHelper.ToInt(ss[0]);

            if (idx.HasValue)
            {
                int?cnt = ConvertHelper.ToInt(ss[1]);
                srcCell.ParentRow.Cells[m_topGridDragFildeName].Value = idx.Value.ToString() + "/" + (cnt.Value + delta).ToString();
            }
        }
コード例 #18
0
 void tsmCopy_Click(object sender, EventArgs e)
 {
     if (m_contextCell != null)
     {
         CopySelectedCellsToClipboard(m_contextCell);
         m_contextCell = null;
     }
     else if (m_contextSelector != null)
     {
         CopySelectedRowsToClipboard(m_contextSelector.Row);
         m_contextSelector = null;
     }
 }
コード例 #19
0
        void MyExcelGrid_DragStart(object sender, DragEventArgs e)
        {
            Xceed.Grid.Cell cell = sender as Xceed.Grid.DataCell;
            if (cell != null)
            {
                string s = GetSelectedCellsStrings(cell);
                if (!string.IsNullOrEmpty(s))
                {
                    e.Data.SetData(DataFormats.Text, s);

                    m_dragStartCell = cell;
                }
            }
        }
コード例 #20
0
 internal static void SetCellValueNone(Xceed.Grid.Cell cell)
 {
     if (cell.ParentColumn.DataType == typeof(string))
     {
         if (cell.Value != null && string.IsNullOrEmpty((string)cell.Value))
         {
             cell.Value = null;
         }
     }
     if (cell != null)
     {
         cell.NullText = "-";
     }
 }
コード例 #21
0
        void 任务正式备案_DoubleClick(object sender, EventArgs e)
        {
            Xceed.Grid.Cell srcCell = sender as Xceed.Grid.Cell;
            var             row     = srcCell.ParentRow as Xceed.Grid.DataRow;

            if (row == null)
            {
                return;
            }

            m_cm.DisplayManager.Position = row.Index;

            if (srcCell.ParentColumn.FieldName == "预录入号")
            {
                任务确认详细信息 form = new 任务确认详细信息(m_cm);
                if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    m_rightGrid.ResetRowData(srcCell.ParentRow as Xceed.Grid.DataRow);
                }
            }
            else if (srcCell.ParentColumn.FieldName == "确认")
            {
                if (row.Cells["任务号"].Value != null)
                {
                    return;
                }
                bool ret = 任务备案确认主界面.Save(m_cm, SaveType.正式备案确认);
                if (ret)
                {
                    row.Cells["任务号"].Value = (m_cm.DisplayManager.CurrentItem as 任务).任务号;
                }
            }
            else if (srcCell.ParentColumn.FieldName == "拒绝")
            {
                if (row.Cells["任务号"].Value != null)
                {
                    return;
                }

                拒绝原因 jjyy = new 拒绝原因(m_cm.DisplayManager.CurrentItem as 任务);
                if (jjyy.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    bool ret = 任务备案确认主界面.Save(m_cm, SaveType.拒绝确认);
                    if (ret)
                    {
                        row.Cells["任务号"].Value = "NA";
                    }
                }
            }
        }
コード例 #22
0
        internal static void SetGridRowCellPermissions(this IBoundGrid grid, Xceed.Grid.DataRow row)
        {
            GridRowInfo info   = ADInfoBll.Instance.GetGridRowInfo(grid.GridName);
            object      entity = row.Tag;

            if (grid.ReadOnly)
            {
                return;
            }

            // Only set when readOnly(如果ReadOnly=false,则不设置,继承Parent's ReadOnly)
            bool readOnly = Feng.Permission.AuthorizeByRule(info.ReadOnly, entity);

            if (readOnly)
            {
                row.ReadOnly = readOnly;
            }
            if (row.ReadOnly)
            {
                return;
            }

            foreach (GridCellInfo cellInfo in ADInfoBll.Instance.GetGridCellInfos(grid.GridName))
            {
                Xceed.Grid.Cell cell = row.Cells[cellInfo.GridColumName];
                if (cell == null)
                {
                    continue;
                }

                if (cell.ParentGrid.ReadOnly)
                {
                    continue;
                }
                if (cell.ParentColumn.ReadOnly)
                {
                    continue;
                }
                if (cell.ParentRow.ReadOnly)
                {
                    continue;
                }

                readOnly = Permission.AuthorizeByRule(cellInfo.ReadOnly, entity);
                if (readOnly)
                {
                    cell.ReadOnly = readOnly;
                }
            }
        }
コード例 #23
0
            protected override void ActivateControlCore(Control control, Xceed.Grid.Cell cell)
            {
                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;

                    base.ActivateControlCore(c, cell);
                }
            }
コード例 #24
0
        void MyExcelGrid_DragDrop(object sender, DragEventArgs e)
        {
            Xceed.Grid.Cell cell = sender as Xceed.Grid.DataCell;
            if (cell != null && m_dragStartCell != null)
            {
                string data = (string)e.Data.GetData(DataFormats.Text);
                if (!string.IsNullOrEmpty(data))
                {
                    PasteToCells(cell, false, data);

                    ClearSelectedCells(m_dragStartCell);
                    m_dragStartCell = null;
                }
            }
        }
コード例 #25
0
        void tsmDelete_Click(object sender, EventArgs e)
        {
            if (m_contextCell != null)
            {
                m_contextCell.Value = null;
                m_contextCell       = null;
            }
            else if (m_contextSelector != null)
            {
                IList <Xceed.Grid.Row> rowList = GetSelectedRowsToOperation(m_contextSelector.Row);
                DeleteRows(rowList);

                m_contextSelector = null;
            }
        }
コード例 #26
0
 void tsmCut_Click(object sender, EventArgs e)
 {
     if (m_contextCell != null)
     {
         CopySelectedCellsToClipboard(m_contextCell);
         ClearSelectedCells(m_contextCell);
         m_contextCell = null;
     }
     else if (m_contextSelector != null)
     {
         IList <Xceed.Grid.Row> rowList = CopySelectedRowsToClipboard(m_contextSelector.Row);
         DeleteRows(rowList);
         m_contextSelector = null;
     }
 }
コード例 #27
0
        internal static Tuple <string, object> GetDataCellValue(string s2, Xceed.Grid.Cell cell)
        {
            string s1 = s2;
            // maybe there is '.'
            int    idx = s1.IndexOf('_');
            string dataControlName, propertyName;

            if (idx == -1)
            {
                dataControlName = s1;
                propertyName    = null;
            }
            else
            {
                dataControlName = s1.Substring(0, idx);
                propertyName    = s1.Substring(idx + 1);
            }

            object o = null;

            if (cell.ParentRow.Cells[dataControlName] != null)
            {
                o = cell.ParentRow.Cells[dataControlName].Value;
            }
            else
            {
                // 如果未找到Cell,则找父级DataControl
                IDisplayManagerContainer form = cell.GridControl.FindForm() as IDisplayManagerContainer;
                if (form != null)
                {
                    IDataControl parentDc = form.DisplayManager.DataControls[dataControlName];
                    o = parentDc.SelectedDataValue;
                }
            }

            if (!string.IsNullOrEmpty(propertyName))
            {
                propertyName = propertyName.Replace('_', '.');
                o            = EntityScript.GetPropertyValue(o, propertyName);
            }

            //if (o == null)
            //{
            //    throw new ArgumentException("there is no column or datacontrol with name " + s1 + "!");
            //}

            return(new Tuple <string, object>(dataControlName, o));
        }
コード例 #28
0
ファイル: process_fy_piao.cs プロジェクト: qq5013/mERP-HD
        public static void 进口_要求承运天数(object sender, EventArgs e)
        {
            Xceed.Grid.Cell    cell = sender as Xceed.Grid.Cell;
            Xceed.Grid.DataRow row  = cell.ParentRow as Xceed.Grid.DataRow;

            if (row.Cells["放行时间"].Value == null ||
                row.Cells["到港时间"].Value == null ||
                row.Cells["免箱天数"].Value == null ||
                cell.ReadOnly)
            {
                return;
            }

            TimeSpan ts = Convert.ToDateTime(row.Cells["放行时间"].Value).Subtract(Convert.ToDateTime(row.Cells["到港时间"].Value));

            cell.CellEditorControl.Text = (Convert.ToInt32(row.Cells["免箱天数"].Value) - ts.Days).ToString();
        }
コード例 #29
0
        static void DisplayManagerPzfymx_SelectedDataValueChanged(object sender, SelectedDataValueChangedEventArgs e)
        {
            Xceed.Grid.Cell cell = e.Container as Xceed.Grid.Cell;
            IDisplayManager dm   = sender as IDisplayManager;

            if (e.DataControlName == "费用项")
            {
                string fyx = (string)cell.ParentRow.Cells["费用项"].Value;
                if (fyx == "012")   // 还借款
                {
                    cell.ParentRow.Cells["结算期限"].ReadOnly = false;
                }
                else
                {
                    cell.ParentRow.Cells["结算期限"].ReadOnly = true;
                }
            }
        }
コード例 #30
0
 private void ClearSelectedCells(Xceed.Grid.Cell currentCell)
 {
     if (currentCell.GridControl.SelectedRows.Contains(currentCell.ParentRow))
     {
         foreach (Xceed.Grid.CellRow row in currentCell.GridControl.SelectedRows)
         {
             if (row.ParentGrid == currentCell.ParentGrid)
             {
                 Xceed.Grid.Cell cell = row.Cells[currentCell.ParentColumn.Index];
                 cell.Value = null;
             }
         }
     }
     else
     {
         currentCell.Value = null;
     }
 }
コード例 #31
0
        void MyExcelGrid_DragStart(object sender, DragEventArgs e)
        {
            Xceed.Grid.Cell cell = sender as Xceed.Grid.DataCell;
            if (cell != null)
            {
                string s = GetSelectedCellsStrings(cell);
                if (!string.IsNullOrEmpty(s))
                {
                    e.Data.SetData(DataFormats.Text, s);

                    m_dragStartCell = cell;
                }
            }
        }
コード例 #32
0
 void tsmPaste_Click(object sender, EventArgs e)
 {
     if (m_contextCell != null)
     {
         PasteClipboardToCells(m_contextCell, false);
         m_contextCell = null;
     }
     else if (m_contextSelector != null)
     {
         PasteClipboardToCells((m_contextSelector.Row as Xceed.Grid.DataRow).Cells[0], true);
     }
 }
コード例 #33
0
 void tsmCopy_Click(object sender, EventArgs e)
 {
     if (m_contextCell != null)
     {
         CopySelectedCellsToClipboard(m_contextCell);
         m_contextCell = null;
     }
     else if (m_contextSelector != null)
     {
         CopySelectedRowsToClipboard(m_contextSelector.Row);
         m_contextSelector = null;
     }
 }
コード例 #34
0
 void tsmAddNew_Click(object sender, System.EventArgs e)
 {
     if (m_contextCell != null)
     {
         this.DataRows.AddNew().EndEdit();
         m_contextCell = null;
     }
     else if (m_contextSelector != null)
     {
         this.DataRows.AddNew().EndEdit();
         m_contextSelector = null;
     }
 }
コード例 #35
0
        void cell_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                tsmSetRowsInColumn.Visible = true;

                m_contextCell = sender as Xceed.Grid.DataCell;
                contextMenuStrip1.Show(m_contextCell.PointToScreen(new System.Drawing.Point(e.X, e.Y)));

                m_contextSelector = null;
            }
        }
コード例 #36
0
        void MyExcelGrid_DragDrop(object sender, DragEventArgs e)
        {
            Xceed.Grid.Cell cell = sender as Xceed.Grid.DataCell;
            if (cell != null && m_dragStartCell != null)
            {
                string data = (string)e.Data.GetData(DataFormats.Text);
                if (!string.IsNullOrEmpty(data))
                {
                    PasteToCells(cell, false, data);

                    ClearSelectedCells(m_dragStartCell);
                    m_dragStartCell = null;
                }
            }
        }
コード例 #37
0
        void tsmInsert_Click(object sender, EventArgs e)
        {
            int currentRowIdx = -1;
            if (m_contextCell != null)
            {
                currentRowIdx = (m_contextCell.ParentRow as Xceed.Grid.DataRow).Index;
                m_contextCell = null;
            }
            else if (m_contextSelector != null)
            {
                currentRowIdx = (m_contextSelector.Row as Xceed.Grid.DataRow).Index;
                m_contextSelector = null;
            }
            if (currentRowIdx != -1)
            {
                int lastRow = this.FindLastEditRow();

                if (lastRow >= currentRowIdx)
                {
                    if (lastRow == this.DataRows.Count - 1)
                    {
                        this.DataRows.AddNew().EndEdit();
                    }

                    for (int i = lastRow; i >= currentRowIdx; --i)
                    {
                        for (int j = 0; j < this.Columns.Count; ++j)
                        {
                            this.DataRows[i + 1].Cells[j].Value = this.DataRows[i].Cells[j].Value;
                        }
                    }
                    for (int j = 0; j < this.Columns.Count; ++j)
                    {
                        this.DataRows[currentRowIdx].Cells[j].Value = null;
                    }
                }
            }
        }
コード例 #38
0
        void RowSelector_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                tsmSetRowsInColumn.Visible = false;

                m_contextSelector = sender as Xceed.Grid.RowSelector;
                contextMenuStrip1.Show(m_contextSelector.PointToScreen(new System.Drawing.Point(e.X, e.Y)));

                m_contextCell = null;
            }
        }
コード例 #39
0
        void MyExcelGrid_KeyDown(object sender, KeyEventArgs e)
        {
            m_contextCell = this.CurrentCell;

            if (e.KeyData == (Keys.Control | Keys.C))
            {
                tsmCopy_Click(tsmCopy, System.EventArgs.Empty);
            }
            else if (e.KeyData == (Keys.Control | Keys.X))
            {
                tsmCut_Click(tsmCut, System.EventArgs.Empty);
            }
            else if (e.KeyData == (Keys.Control | Keys.V))
            {
                tsmPaste_Click(tsmPaste, System.EventArgs.Empty);
            }
        }
コード例 #40
0
 void tsmCut_Click(object sender, EventArgs e)
 {
     if (m_contextCell != null)
     {
         CopySelectedCellsToClipboard(m_contextCell);
         ClearSelectedCells(m_contextCell);
         m_contextCell = null;
     }
     else if (m_contextSelector != null)
     {
         IList<Xceed.Grid.Row> rowList = CopySelectedRowsToClipboard(m_contextSelector.Row);
         DeleteRows(rowList);
         m_contextSelector = null;
     }
 }
コード例 #41
0
        void tsmDelete_Click(object sender, EventArgs e)
        {
            if (m_contextCell != null)
            {
                m_contextCell.Value = null;
                m_contextCell = null;
            }
            else if (m_contextSelector != null)
            {
                IList<Xceed.Grid.Row> rowList = GetSelectedRowsToOperation(m_contextSelector.Row);
                DeleteRows(rowList);

                m_contextSelector = null;
            }
        }