コード例 #1
0
 /// <summary>
 /// セル登録
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void 燃費目標_CellEditEnded(object sender, GrapeCity.Windows.SpreadGrid.SpreadCellEditEndedEventArgs e)
 {
     if (Cnt == 0)
     {
         this.ErrorMessage = "作成年月を入力しデータを呼び起こしてください。";
         MessageBox.Show("作成年月を入力しデータを呼び起こしてください。");
         SetFocusToTopControl();
         base.SendRequest(new CommunicationObject(MessageType.RequestData, LOAD_MST31010, new object[] { }));
         return;
     }
 }
コード例 #2
0
        /// <summary>
        /// spreadセル編集完了時処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SearchGrid_CellEditEnded(object sender, GrapeCity.Windows.SpreadGrid.SpreadCellEditEndedEventArgs e)
        {
            GcSpreadGrid grid         = sender as GcSpreadGrid;
            string       targetColumn = grid.ActiveCellPosition.ColumnName;
            int?         i担当者コード      = null;

            //明細行が存在しない場合は処理しない
            if (SearchResult == null)
            {
                return;
            }

            Row targetRow = grid.Rows[grid.ActiveRowIndex];

            targetRowIdx = targetRow.Index;
            targetColIdx = grid.ActiveColumnIndex;

            //編集したセルの値を取得
            var CellValue = grid[grid.ActiveRowIndex, targetColumn].Value;



            //担当者コードが入力された際担当者名をDBから取得
            if (CellValue != null && CellValue.ToString().Length > 0)
            {
                i担当者コード = int.Parse(CellValue.ToString());
            }
            else
            {
                CellValue = DBNull.Value;
            }

            SearchResult.Rows[targetRow.Index][targetColumn] = CellValue;

            if (targetColumn == "請求担当者コード" || targetColumn == "支払担当者コード")
            {
                base.SendRequest(
                    new CommunicationObject(MessageType.RequestData, MST01011_GetM72, new object[]
                {
                    i担当者コード
                }));
            }
        }
コード例 #3
0
        /// <summary>
        /// 構成品Grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void spComponent_CellEditEnded(object sender, GrapeCity.Windows.SpreadGrid.SpreadCellEditEndedEventArgs e)
        {
            if (e.EditAction == SpreadEditAction.Cancel)
            {
                return;
            }

            var spGrid = (sender as GcSpreadGrid);

            if (spGrid == null)
            {
                return;
            }

            try
            {
                // 編集列が『材料品番』の場合
                if (spGrid.ActiveColumn.Index == 2 || spGrid.ActiveColumn.Index == 3)
                {
                    SpreadGridRow row     = spGrid.Rows[e.CellPosition.Row];
                    string        myCode  = (string)row.Cells[spGrid.Columns["材料品番"].Index].Value;
                    string        myColor = (string)row.Cells[spGrid.Columns["自社色"].Index].Value;

                    // 入力値より品番情報を取得
                    this.SendRequest(
                        new CommunicationObject(
                            MessageType.RequestData,
                            TargetTableNm_GetProduct,
                            new object[] {
                        myCode,
                        myColor,
                        new int[] { 2, 3, 4 }                 // 対象商品形態:2:単品・材料、3:雑コード、4:副資材
                    }));
                }
            }
            catch (Exception)
            {
                this.ErrorMessage = "入力内容が不正です。";
            }
        }
コード例 #4
0
        /// <summary>
        /// セル編集コミット時処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SearchGrid_CellEditEnded(object sender, GrapeCity.Windows.SpreadGrid.SpreadCellEditEndedEventArgs e)
        {
            GcSpreadGrid grid = sender as GcSpreadGrid;

            int    intColumnIdx = grid.ActiveCellPosition.Column;
            string targetColumn = grid.ActiveCellPosition.ColumnName;

            //明細行が存在しない場合は処理しない
            if (SearchResult == null)
            {
                return;
            }

            Row targetRow = grid.Rows[grid.ActiveRowIndex];

            //編集したセルの値を取得
            var CellValue = grid[grid.ActiveRowIndex, targetColumn].Value;

            if (CellValue != null)
            {
                SearchResult.Rows[targetRow.Index][targetColumn] = CellValue;
            }
        }
コード例 #5
0
        private void  建単価M_CellEditEnded(object sender, GrapeCity.Windows.SpreadGrid.SpreadCellEditEndedEventArgs e)
        {
            if (e.EditAction == SpreadEditAction.Cancel)
            {
                return;
            }
            var gcsp = (sender as GcSpreadGrid);

            if (gcsp == null)
            {
                return;
            }

            try
            {
                int     val_1;
                int     val_2;
                decimal?val_3;
                decimal?val_4;
                decimal?val_5;
                int?    val_6;

                var row = gcsp.Rows[e.CellPosition.Row];
                val_1 = (int)row.Cells[gcsp.Columns["取引先ID"].Index].Value;
                val_2 = (int)row.Cells[gcsp.Columns["着地ID"].Index].Value;
                val_3 = (decimal?)row.Cells[gcsp.Columns["重量"].Index].Value;
                val_4 = (decimal?)row.Cells[gcsp.Columns["個数"].Index].Value;
                val_5 = (decimal?)row.Cells[gcsp.Columns["個建単価"].Index].Value;
                val_6 = row.Cells[gcsp.Columns["d個建金額"].Index].Value == null ? null : (int?)AppCommon.IntParse(row.Cells[gcsp.Columns["d個建金額"].Index].Value.ToString());
                base.SendRequest(new CommunicationObject(MessageType.UpdateData, TargetTableNmUpdate, new object[] { val_1, val_2, val_3, val_4, val_5, val_6 }));
            }
            catch (Exception ex)
            {
                this.ErrorMessage = "入力内容が不正です。";
            }
        }
コード例 #6
0
        private void sp売上明細データ_CellEditEnded(object sender, GrapeCity.Windows.SpreadGrid.SpreadCellEditEndedEventArgs e)
        {
            if (e.EditAction == SpreadEditAction.Cancel)
            {
                return;
            }
            var gcsp = (sender as GcSpreadGrid);

            if (gcsp == null)
            {
                return;
            }

            try
            {
                string cname = e.CellPosition.ColumnName;
                string ctext = sp売上明細データ.Cells[e.CellPosition.Row, e.CellPosition.Column].Text;
                ctext = ctext == null ? string.Empty : ctext;
                if (cname == CellName && ctext == CellText && (!(gcsp[e.CellPosition].InheritedCellType is GrapeCity.Windows.SpreadGrid.ComboBoxCellType) && !(gcsp[e.CellPosition].InheritedCellType is GrapeCity.Windows.SpreadGrid.CheckBoxCellType)))
                {
                    if (CloseFlg)
                    {
                        CloseFlg = false;
                    }
                    // セルの値が変化していなければ何もしない
                    return;
                }


                var    row = gcsp.Rows[e.CellPosition.Row];
                object val = row.Cells[e.CellPosition.Column].Value;
                val = val == null ? "" : val;
                if (cname.Contains("年月日") == true)
                {
                    AppCommon.SpreadYMDCellCheck(sender, e, this._originalText);
                    cname = cname.Replace("年月日", "日付");
                    DateTime dt;
                    if (DateTime.TryParse(row.Cells[e.CellPosition.Column].Text, out dt) == true)
                    {
                        val = dt;
                    }
                    else
                    {
                        this.ErrorMessage = "正しい日付を入力してください。";
                        return;
                    }
                }

                var colM = gcsp.Columns.Where(x => x.Name == "明細番号").FirstOrDefault();
                if (colM == null)
                {
                    throw new Exception("システムエラー");
                }
                var colL = gcsp.Columns.Where(x => x.Name == "明細行").FirstOrDefault();
                if (colL == null)
                {
                    throw new Exception("システムエラー");
                }

                base.SendRequest(new CommunicationObject(MessageType.UpdateData, DLY16010_UPDATE, row.Cells[colM.Index].Value, row.Cells[colL.Index].Value, e.CellPosition.ColumnName, val));


                合計金額 += AppCommon.DecimalParse(row.Cells[this.sp売上明細データ.Columns["入出金金額"].Index].Value.ToString()) - Cell入出金金額;

                //Button_Click_1(null , null);
            }
            catch (Exception ex)
            {
                this.ErrorMessage = "入力内容が不正です。";
            }
        }