コード例 #1
0
        private void CopyRowFromUpperRow(string focus_control, params string[] copy_columns)
        {
            if (form_.Grid.LastSelectedRowNo <= 0)
            {
                helper.MsgBox.Err(KaikeiSystemBody.Properties.Resources.MsgFailedToCopyUpperRow);
                return;
            }

            var current_row_no = form_.Grid.SelectedRowNo;

            if (current_row_no >= form_.Grid.DataCount)
            {
                gridController.InsertNewRowToLast(false);
            }

            form_.Grid.SetFocus(form_.Grid.LastSelectedRowNo, focus_control);
            //form_.Grid.SelectedRowControl.SetFocusToControlByTag(focus_control);

            var rows = Context.KaikeiDatabase.KaikeiDenpyouMeisai.Select(sql_ + " limit 1 offset " + (current_row_no - 1).ToString());

            if (rows.Count() == 1)
            {
                var selected_row_control = form_.Grid.SelectedRowControl;
                var src_row = rows.First();
                var dst_row = selected_row_control.RowData;

                foreach (var column in copy_columns)
                {
                    dst_row.Set(column, src_row.Get(column));
                }
                //Context.KaikeiDatabase.KaikeiDenpyouMeisai.Update(dst_row);
                selected_row_control.SetRowData(dst_row, true);
            }
        }