private M10_SHIN_MEMBER getRowData <T>(T dataRow) { M10_SHIN_MEMBER member = new M10_SHIN_MEMBER(); if (dataRow is DataRow) { var dr = dataRow as DataRow; member.品番コード = int.Parse(dr["品番コード"].ToString()); member.行 = int.Parse(dr["行"].ToString()); member.材料品番 = dr["材料品番"].ToString(); member.材料品名 = dr["材料品名"].ToString(); member.材料色 = dr["材料色"].ToString(); member.数量 = dr["数量"].ToString(); member.自社色 = dr["自社色"].ToString(); } else if (dataRow is SpreadGridRow) { var sgr = dataRow as SpreadGridRow; if (sgr.Cells[0].Value == null) { return(member); } member.品番コード = parseObject(sgr.Cells[0].Value, 0); member.行 = parseObject(sgr.Cells[1].Value, 0); member.材料品番 = sgr.Cells[2].Value == null ? string.Empty : sgr.Cells[2].Value.ToString(); member.材料品名 = sgr.Cells[3].Value == null ? string.Empty : sgr.Cells[3].Value.ToString(); member.材料色 = sgr.Cells[4].Value == null ? string.Empty : sgr.Cells[4].Value.ToString(); member.数量 = sgr.Cells[5].Value == null ? string.Empty : sgr.Cells[5].Value.ToString(); member.自社色 = sgr.Cells[6].Value == null ? string.Empty : sgr.Cells[5].Value.ToString(); } return(member); }
/// <summary> /// 画面表示を初期化する /// </summary> private void ScreenClear() { MstData = null; SetKouseihin = null; ChangeKeyItemChangeable(true); ResetAllValidation(); SetFocusToTopControl(); }
/// <summary> /// 取得データを設定する /// </summary> /// <param name="tbl"></param> private void strData(DataTable tbl) { if (tbl.Rows.Count > 0) { MstData = getRowData <DataRow>(tbl.Rows[0]); ChangeKeyItemChangeable(false); SetFocusToTopControl(); // 編集モード表示 this.MaintenanceMode = AppConst.MAINTENANCEMODE_EDIT; } else { ChangeKeyItemChangeable(false); SetFocusToTopControl(); // 新規作成モード表示 this.MaintenanceMode = AppConst.MAINTENANCEMODE_ADD; } }