public Message SaveBOR(BOR_VO vo, bool update) { try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = new SqlConnection(this.ConnectionString); cmd.CommandText = "SP_SaveBOR"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@P_UPDATE", update); cmd.Parameters.AddWithValue("@P_BOR_CODE", vo.BOR_CODE); cmd.Parameters.AddWithValue("@P_BOR_PROCS_CODE", vo.BOR_PROCS_CODE); cmd.Parameters.AddWithValue("@P_BOR_PROCS_TIME", vo.BOR_PROCS_TIME); cmd.Parameters.Add(new SqlParameter("@P_BOR_PROCS_LEADTIME", System.Data.SqlDbType.Int)); cmd.Parameters["@P_BOR_PROCS_LEADTIME"].Value = (object)vo.BOR_PROCS_LEADTIME ?? DBNull.Value; cmd.Parameters.AddWithValue("@P_BOR_PRIORT", vo.BOR_PRIORT); cmd.Parameters.AddWithValue("@P_BOR_YIELD", vo.BOR_YIELD); cmd.Parameters.AddWithValue("@P_BOR_USE_YN", vo.BOR_USE_YN); cmd.Parameters.AddWithValue("@P_BOR_REMARK", vo.BOR_REMARK); cmd.Parameters.AddWithValue("@P_ITEM_CODE", vo.ITEM_CODE); cmd.Parameters.AddWithValue("@P_FCLTS_CODE", vo.FCLTS_CODE); cmd.Parameters.AddWithValue("@P_BOR_LAST_MDFR", vo.BOR_LAST_MDFR); cmd.Parameters.AddWithValue("@P_BOR_LAST_MDFY", vo.BOR_LAST_MDFY); cmd.Parameters.Add(new SqlParameter("@P_ReturnCode", System.Data.SqlDbType.NVarChar, 5)); cmd.Parameters["@P_ReturnCode"].Direction = System.Data.ParameterDirection.Output; cmd.Connection.Open(); cmd.ExecuteNonQuery(); cmd.Connection.Close(); string result = cmd.Parameters["@P_ReturnCode"].Value.ToString(); Message message = new Message(); if (result == "S01") { message.IsSuccess = true; message.ResultMessage = "성공적으로 등록되었습니다."; } else if (result == "S02") { message.IsSuccess = true; message.ResultMessage = "성공적으로 수정되었습니다."; } else if (result == "S03") { message.IsSuccess = false; message.ResultMessage = "코드 중복"; } else if (result == "S00") { message.IsSuccess = false; message.ResultMessage = "실패하였습니다."; } return(message); } } catch (Exception err) { return(new Message(err)); } }
public Message SaveBOR(BOR_VO vo, bool update) { BORDAC dac = new BORDAC(); return(dac.SaveBOR(vo, update)); }
private void btnOK_Click(object sender, EventArgs e) { try { #region BOR등록 & 수정 if (cboItemCode.Text == "" || cboPROC.Text == "" || cboFacil.Text == "" || txtTime.Text == "" || txtPrio.Text == "" || cboUseYN.Text == "") { MessageBox.Show("필수정보 입력 필요"); return; } BOR_VO vo = new BOR_VO(); vo.BOR_CODE = BOR_CODE; vo.ITEM_CODE = cboItemCode.Text; vo.BOR_PROCS_CODE = cboPROC.Text; vo.FCLTS_CODE = cboFacil.Text; vo.BOR_PROCS_TIME = int.Parse(txtTime.Text); vo.BOR_PRIORT = int.Parse(txtPrio.Text); if (int.TryParse(txtLead.Text, out int plzNull1)) { vo.BOR_PROCS_LEADTIME = plzNull1; } else { vo.BOR_PROCS_LEADTIME = null; } try { vo.BOR_YIELD = Convert.ToDecimal(txtYIELD.Text); } catch { MessageBox.Show("err수율 : 올바른 소수점의 형태가 아닙니다."); return; } vo.BOR_USE_YN = cboUseYN.Text; vo.BOR_REMARK = txtREMARK.Text; vo.BOR_LAST_MDFR = LoginInfo.UserInfo.LI_ID; vo.BOR_LAST_MDFY = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); BORService service = new BORService(); Message msg = service.SaveBOR(vo, Update); if (msg.IsSuccess) { MessageBox.Show(msg.ResultMessage); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show(msg.ResultMessage); return; } #endregion } catch (Exception err) { this.Log.WriteError($"[[RECV {this.Name}]]:{err.Message}"); } }