Пример #1
0
        public void AddRow(DevExpress.XtraGrid.Views.Grid.GridView View)
        {
            int currentRow;

            currentRow = View.FocusedRowHandle;

            if (currentRow < 0)
            {
                currentRow = View.GetDataRowHandleByGroupRowHandle(currentRow);
            }

            //if (View.GroupedColumns.Count == 0)
            //    return;

            //string grp = View.GetRowCellValue(currentRow, colGRP).ToString();
            //GenelDataSet.XGTRow xgtRow = this.genelDataSet.XGT.FindByGRPID(grp, "+");

            View.AddNewRow();
            View.SetRowCellValue(View.FocusedRowHandle, colTUR, View.GetRowCellValue(currentRow, colTUR));

            //View.UpdateCurrentRow();
            View.MakeRowVisible(View.FocusedRowHandle, true);
            View.FocusedColumn = colTOP;
            View.ShowEditor();
        }
Пример #2
0
        internal static void addNewRowInGroupMode(DevExpress.XtraGrid.Views.Grid.GridView View)
        {
            //Get the handle of the source data row
            //The row will provide group column values for a new row
            int rowHandle = View.GetDataRowHandleByGroupRowHandle(View.FocusedRowHandle);

            //Store group column values
            object[] groupValues      = null;
            int      groupColumnCount = View.GroupedColumns.Count;

            if (groupColumnCount > 0)
            {
                groupValues = new object[groupColumnCount];
                for (int i = 0; i < groupColumnCount; i++)
                {
                    groupValues[i] = View.GetRowCellValue(rowHandle, View.GroupedColumns[i]);
                }
            }
            //Add a new row
            View.AddNewRow();
            //Get the handle of the new row
            int    newRowHandle = View.FocusedRowHandle;
            object newRow       = View.GetRow(newRowHandle);

            //Set cell values corresponding to group columns
            if (groupColumnCount > 0)
            {
                for (int i = 0; i < groupColumnCount; i++)
                {
                    View.SetRowCellValue(newRowHandle, View.GroupedColumns[i], groupValues[i]);
                }
            }
            //Accept the new row
            //The row moves to a new position according to the current group settings
            View.UpdateCurrentRow();
            //Locate the new row
            for (int n = 0; n < View.DataRowCount; n++)
            {
                if (View.GetRow(n).Equals(newRow))
                {
                    View.FocusedRowHandle = n;
                    break;
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Add New IBT Detail
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void simpleButton2_Click(object sender, System.EventArgs e)
        {
            if (canAdd)
            {
                if (this.lkBranchTo.EditValue.ToString() == "Select Branch" | this.lkBranchTo.EditValue.ToString() == "")
                {
                    ACMS.Utils.UI.ShowErrorMessage(this, "Please select valid Branch Code", "Error");
                }
                else if (this.simpleButton2.Text == "Cancel")
                {
                    this.Close();
                }
                else
                {
                    try
                    {
                        CheckAvailableQuantity(sender, null);
                    }
                    catch
                    {
                    }
                    if (canSave)
                    {
                        int currentRow;
                        currentRow = gridView1.FocusedRowHandle;
                        if (currentRow < 0)
                        {
                            currentRow = gridView1.GetDataRowHandleByGroupRowHandle(currentRow);
                        }
                        gridView1.AddNewRow();

                        gridView1.ShowEditor();
                    }
                }
            }
            else
            {
                UI.ShowErrorMessage(this, "Invalid Operation. Please change valid product quantity", "Error");
            }
        }
Пример #4
0
        private void btn_Add_Click(object sender, System.EventArgs e)
        {
            if (canAdd)
            {
                if (this.lkBranchTo.EditValue.ToString() == "")
                {
                    ACMS.Utils.UI.ShowErrorMessage(this, "Please select valid Branch Code", "Error");
                }

                else if (this.btn_Add.Text == "Cancel")
                {
                    this.Close();
                }

                else
                {
                    CheckAvailableQuantity(sender, null);
                    if (canSave)
                    {
                        int currentRow;
                        currentRow = gridView1.FocusedRowHandle;
                        //	if(currentRow < 0)
                        //	{
                        currentRow = gridView1.GetDataRowHandleByGroupRowHandle(currentRow);
                        gridView1.AddNewRow();
                        gridView1.ShowEditor();
                        //		}
                    }            //can save
                }                //end if
            }
            else
            {
                UI.ShowErrorMessage(this, "Invalid Operation. Please change valid product quantity", "Error");
                //this.gridView1.MoveBy(inValidQuantityRow);
            }
        }