/// <summary> /// Check 항목 화면 표시 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PART_Editor_Loaded(object sender, RoutedEventArgs e) { try { EditGridCellData o = (sender as CheckBox).Tag as EditGridCellData; var target = ChkPbsList.Where(f => f.PBS_ID == o.Value.ToString()).SingleOrDefault(); if (null != target && target.IsChecked) { (sender as CheckBox).IsChecked = true; } } catch (Exception err) { this.BaseClass.Error(err); } }
/// <summary> /// 저장 함수 /// </summary> void SaveChkPlan() { using (BaseDataAccess da = new BaseDataAccess()) { try { string _SUCCESS_CODE = "100"; var _USER_ID = this.BaseClass.UserID; da.BeginTransaction(); //DateTime dt = new DateTime(chkDate.DateTime.Year, chkDate.DateTime.Month, chkDate.DateTime.Day); var strChkDate = this.BaseClass.GetCalendarValue(this.chkDate); var strChkDptDev = this.BaseClass.ComboBoxSelectedKeyValue(this.cboChkDptDev); var param = new Dictionary <string, object> { { "P_CENTER_CD", this.BaseClass.CenterCD }, { "P_CHK_ID", (-1 == CurrentChkID) ? 0 : CurrentChkID }, // 일련번호 { "P_CHK_PLAN_NM", tbxChkName.Text.Trim() }, // 점검 명 { "P_CHK_DEV_CD", strChkDptDev }, // 점검구분 { "P_CHK_PLAN_DT", strChkDate }, // 점검읿자 { "P_USER_ID", _USER_ID } }; var strOutParam = new[] { "P_RESULT" }; string callProc = "PK_EMS_ECHK001_01P.SP_EMS_CHK_PLAN_INFO_SAVE"; var outData = da.GetSpDataSet( callProc // 호출 프로시저 , param // Input 파라메터 , strOutParam // Output 파라메터 ); if (outData.Tables[0].Rows.Count > 0) { if (outData.Tables[0].Rows[0]["CODE"].ToString() != _SUCCESS_CODE) { da.RollbackTransaction(); BaseClass.MsgError(outData.Tables[0].Rows[0]["MSG"].ToString(), BaseEnumClass.CodeMessage.MESSAGE); } } else { _SUCCESS_CODE = "0"; da.RollbackTransaction(); this.BaseClass.MsgError("ERR_INPUT_TYPE"); } if ("0" != _SUCCESS_CODE) { int chk_id = int.Parse(outData.Tables[0].Rows[0]["CHK_ID"].ToString()); var chkd = ChkPbsList.Where(P => P.IsSelected).ToList(); if (null == CheckedPbsList || 0 == CheckedPbsList.Count) { // 기 체크된 항목 없음 // foreach (var item in chkd) { var paramP = new Dictionary <string, object> { { "P_CENTER_CD", this.BaseClass.CenterCD }, { "P_CHK_ID", chk_id }, { "P_PBS_ID", item.PBS_ID }, { "P_ISCHECK", 1 }, { "P_USER_ID", _USER_ID } }; var strOutParamP = new[] { "P_RESULT" }; string callProcP = "PK_EMS_ECHK001_01P.SP_EMS_CHK_PLAN_PBS_SAVE"; var outDataP = da.GetSpDataSet( callProcP // 호출 프로시저 , paramP // Input 파라메터 , strOutParamP // Output 파라메터 ); if (outDataP.Tables[0].Rows.Count > 0) { if (outDataP.Tables[0].Rows[0]["CODE"].ToString() != _SUCCESS_CODE) { _SUCCESS_CODE = "0"; da.RollbackTransaction(); BaseClass.MsgInfo(outData.Tables[0].Rows[0]["MSG"].ToString(), BaseEnumClass.CodeMessage.MESSAGE); break; } } else { _SUCCESS_CODE = "0"; da.RollbackTransaction(); this.BaseClass.MsgError("ERR_INPUT_TYPE"); break; } } } else { // 새로 체크된(추가) 항목 추룰 // var add = chkd.Except(CheckedPbsList).ToList(); // 체크 해제된(삭제) 항목 추룰 // var removed = CheckedPbsList.Except(chkd).ToList(); // 추가 항목 처리 // foreach (var item in add) { var paramP = new Dictionary <string, object> { { "P_CENTER_CD", this.BaseClass.CenterCD }, { "P_CHK_ID", chk_id }, { "P_PBS_ID", item.PBS_ID }, { "P_ISCHECK", 1 }, { "P_USER_ID", _USER_ID } }; var strOutParamP = new[] { "P_RESULT" }; string callProcP = "PK_EMS_ECHK001_01P.SP_EMS_CHK_PLAN_PBS_SAVE"; var outDataP = da.GetSpDataSet( callProcP // 호출 프로시저 , paramP // Input 파라메터 , strOutParamP // Output 파라메터 ); if (outDataP.Tables[0].Rows.Count > 0) { if (outDataP.Tables[0].Rows[0]["CODE"].ToString() != _SUCCESS_CODE) { _SUCCESS_CODE = "0"; da.RollbackTransaction(); BaseClass.MsgError(outData.Tables[0].Rows[0]["MSG"].ToString(), BaseEnumClass.CodeMessage.MESSAGE); break; } } else { _SUCCESS_CODE = "0"; da.RollbackTransaction(); this.BaseClass.MsgError("ERR_INPUT_TYPE"); break; } } // 삭제 항목 처리 // foreach (var item in removed) { var paramP = new Dictionary <string, object> { { "P_CENTER_CD", this.BaseClass.CenterCD }, { "P_CHK_ID", chk_id }, { "P_PBS_ID", item.PBS_ID }, { "P_ISCHECK", 0 }, { "P_USER_ID", _USER_ID } }; var strOutParamP = new[] { "P_RESULT" }; string callProcP = "PK_EMS_ECHK001_01P.SP_EMS_CHK_PLAN_PBS_SAVE"; var outDataP = da.GetSpDataSet( callProcP // 호출 프로시저 , paramP // Input 파라메터 , strOutParamP // Output 파라메터 ); if (outDataP.Tables[0].Rows.Count > 0) { if (outDataP.Tables[0].Rows[0]["CODE"].ToString() != _SUCCESS_CODE) { _SUCCESS_CODE = "0"; da.RollbackTransaction(); BaseClass.MsgError(outData.Tables[0].Rows[0]["MSG"].ToString(), BaseEnumClass.CodeMessage.MESSAGE); break; } } else { _SUCCESS_CODE = "0"; da.RollbackTransaction(); this.BaseClass.MsgError("ERR_INPUT_TYPE"); break; } } } if (_SUCCESS_CODE == "100") { da.CommitTransaction(); //this.ChangeStatusLabelEvent(HelperClass.GetMessageByCountryCode("CMPT_SAVE_DATA")); this.BaseClass.MsgInfo("CMPT_SAVE"); IsSaved = true; this.Close(); } } } catch (Exception ex) { da.RollbackTransaction(); this.BaseClass.MsgError(ex.Message, BaseEnumClass.CodeMessage.MESSAGE); } } }