private bool DBSave() { this.uniGrid1.UpdateData(); cstdsY8101M2_KO883.I_PMS_PROJECT_RATE.Clear(); DataTable saveDt = new DataTable(); try { cstdsY8101M2_KO883.I_PMS_PROJECT_RATE.Merge(cstdsY8101M2_KO883.E_PMS_PROJECT_RATE.GetChanges(), false, MissingSchemaAction.Ignore); saveDt.Merge(cstdsY8101M2_KO883.I_PMS_PROJECT_RATE, false, MissingSchemaAction.Add); saveDt.AcceptChanges(); using (uniCommand _uniCmd = uniBase.UDatabase.GetStoredProcCommand("dbo.USP_H4006M4_KO883_CUD")) { uniBase.UDatabase.AddInParameter(_uniCmd, "@TBL_DATA", SqlDbType.Structured, saveDt); uniBase.UDatabase.AddInParameter(_uniCmd, "@USER_ID", SqlDbType.NVarChar, 15, CommonVariable.gUsrID); uniBase.UDatabase.AddOutParameter(_uniCmd, "@MSG_CD", SqlDbType.NVarChar, 6); uniBase.UDatabase.AddOutParameter(_uniCmd, "@MESSAGE", SqlDbType.NVarChar, 200); uniBase.UDatabase.AddOutParameter(_uniCmd, "@ERR_POS", SqlDbType.Int, 6); uniBase.UDatabase.AddReturnParameter(_uniCmd, "RETURN_VALUE", SqlDbType.Int, 1); uniBase.UDatabase.ExecuteNonQuery(_uniCmd, false); int iReturn = (int)uniBase.UDatabase.GetParameterValue(_uniCmd, "RETURN_VALUE"); if (iReturn < 0) { string sMsgCd = uniBase.UDatabase.GetParameterValue(_uniCmd, "@MSG_CD") as string; string sMessage = uniBase.UDatabase.GetParameterValue(_uniCmd, "@MESSAGE") as string; if (string.IsNullOrEmpty(sMsgCd)) { sMsgCd = "DT9999"; } uniBase.UMessage.DisplayMessageBox(sMsgCd, MessageBoxButtons.OK, sMessage); return(false); } } } catch (Exception ex) { bool reThrow = ExceptionControler.AutoProcessException(ex); if (reThrow) { throw; } return(false); } finally { } return(true); }
private bool DBQuery() { cstdsY8101M2_KO883.Clear(); DataSet dsResult = null; try { using (uniCommand uniCommand = uniBase.UDatabase.GetStoredProcCommand("USP_H4006M1_KO883P_111")) { uniBase.UDatabase.AddInParameter(uniCommand, "@YYYY", SqlDbType.NVarChar, dtYYYYMM.uniValue.ToString("yyyy")); uniBase.UDatabase.AddInParameter(uniCommand, "@DILIG_EMP_NO", SqlDbType.NVarChar, popEmpNo.CodeValue.Trim()); uniBase.UDatabase.AddInParameter(uniCommand, "@DEPT_CD", SqlDbType.NVarChar, popDeptCd.CodeValue.Trim()); uniBase.UDatabase.AddInParameter(uniCommand, "@STD_DATE", SqlDbType.DateTime, dtDocumentDt.uniValue.ToString()); dsResult = uniBase.UDatabase.ExecuteDataSet(uniCommand); } if (dsResult == null || dsResult.Tables.Count == 0 || dsResult.Tables[0].Rows.Count == 0) { uniBase.UMessage.DisplayMessageBox("900014", MessageBoxButtons.OK); return(false); } cstdsY8101M2_KO883.E_PMS_PROJECT_RATE.Merge(dsResult.Tables[0], false, MissingSchemaAction.Ignore); } catch (Exception ex) { bool reThrow = ExceptionControler.AutoProcessException(ex); if (reThrow) { throw; } return(false); } finally { } return(true); }