/// <summary> /// 삭제 버튼 클릭 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRowDeleteClick(object sender, MouseButtonEventArgs e) { try { // DelEmsEqpMngr(); if (ValidationRowDelete() == false) { return; } var liHeaderCommonCodeMgmt = this.EmsEqpMngrList.Where(p => p.IsSelected == true && p.IsNew == true).ToList(); if (liHeaderCommonCodeMgmt.Count() <= 0) { BaseClass.MsgError("ERR_DELETE"); } liHeaderCommonCodeMgmt.ForEach(p => EmsEqpMngrList.Remove(p)); } catch (Exception err) { this.BaseClass.Error(err); } }
/// <summary> /// 삭제 함수 /// </summary> private void DelEmsEqpMngr() { var _delItems = this.EmsEqpMngrList.Where(p => p.IsSelected).ToList(); if (0 < _delItems.Count) { using (BaseDataAccess da = new BaseDataAccess()) { string _SUCCESS_CODE = "100"; try { da.BeginTransaction(); foreach (var item in _delItems) { if (item.IsNew != true) { var param = new Dictionary <string, object> { { "P_CENTER_CD", this.BaseClass.CenterCD }, { "P_EQP_MNGR_ID", item.EQP_MNGR_ID } }; var strOutParam = new[] { "P_RESULT" }; string callProc = "PK_EMS_EBSE001.SP_EMS_EQP_MNGR_DELETE"; 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) { _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.MsgInfo("ERR_INPUT_TYPE"); break; } } } if (_SUCCESS_CODE == "100") { da.CommitTransaction(); foreach (var item in _delItems) { //if (item.IsNew != true) EmsEqpMngrList.Remove(item); } gridMain.RefreshData(); } } catch (Exception ex) { da.RollbackTransaction(); this.BaseClass.Error(ex); this.BaseClass.MsgError(ex.Message, BaseEnumClass.CodeMessage.MESSAGE); } } } else { // 삭제 대상을 선택하세요. this.BaseClass.MsgInfo("INFO_SEL_DEL"); } }