public static string GetMaxID(string sTable, string sField, int iIDLength) { string sMaxID = "0"; try { object[][] Params = new object[5][]; Params[0] = new object[] { ParameterDirection.Input, OracleType.VarChar, "TFIELD", sField }; Params[1] = new object[] { ParameterDirection.Input, OracleType.VarChar, "TTABLE", sTable }; Params[2] = new object[] { ParameterDirection.Input, OracleType.VarChar, "TNUM", iIDLength.ToString() }; Params[3] = new object[] { ParameterDirection.Output, OracleType.VarChar, "TRES", "" }; Params[4] = new object[] { ParameterDirection.Output, OracleType.VarChar, "T_MAXID", "" }; DataSet dsTemp = ClientUtils.ExecuteProc("SAJET.SJ_GET_MAXID", Params); string sRes = dsTemp.Tables[0].Rows[0]["TRES"].ToString(); sMaxID = dsTemp.Tables[0].Rows[0]["T_MAXID"].ToString(); if (sRes != "OK") { SajetCommon.Show_Message(sRes, 0); return("0"); } } catch (Exception ex) { SajetCommon.Show_Message("SAJET.SJ_GET_MAXID" + Environment.NewLine + ex.Message, 0); return("0"); } return(sMaxID); }
public DataTable GetStoredProcedure(string spName, List <DbParameter> parms) { object[][] oParms = new object[parms.Count][]; for (int i = 0; i < parms.Count; i++) { oParms[i] = new object[] { parms[i].Direction, parms[i].DbType, parms[i].ParameterName, parms[i].Value }; } DataSet ds = ClientUtils.ExecuteProc(spName, oParms); if (ds.Tables.Count == 0) { return(new DataTable()); } return(ds.Tables[0]); }
public string insertData(string shipment_id, string status, string errormsg) { object[][] strpram = new object[3][]; strpram[0] = new object[] { ParameterDirection.Input, OracleDbType.Varchar2, "p_shipment_id", shipment_id }; strpram[1] = new object[] { ParameterDirection.Input, OracleDbType.Varchar2, "p_wc", status }; strpram[2] = new object[] { ParameterDirection.Output, OracleDbType.Varchar2, "emsg", errormsg }; //DataTable dt1 = new DataTable(); try { DataTable dt1 = ClientUtils.ExecuteProc("ppsuser.PPS_DATA_INSERT", strpram).Tables[0]; } catch (Exception e1) { MessageBox.Show(e1.ToString()); return(errormsg); } //if (dt1.Rows[0]["emsg"].ToString().Equals("OK")) //{ // MessageBox.Show("execution OK"); //} return(errormsg); }
private void tSN_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != (Char)Keys.Enter) { return; } List <Object[]> param = new List <object[]>(); param.Add(new object[] { ParameterDirection.Input, OracleType.VarChar, "C_SN", tSN.Text.Trim() }); param.Add(new object[] { ParameterDirection.Output, OracleType.VarChar, "C_WO", "" }); param.Add(new object[] { ParameterDirection.Output, OracleType.VarChar, "C_MATERIAL", "" }); param.Add(new object[] { ParameterDirection.Output, OracleType.VarChar, "C_QTY", "" }); param.Add(new object[] { ParameterDirection.Output, OracleType.VarChar, "C_TYPE", "" }); param.Add(new object[] { ParameterDirection.Output, OracleType.VarChar, "TRES", "" }); DataSet dataSet = ClientUtils.ExecuteProc("sajet.G_QC_RETURN_CHECK", param.ToArray()); if (dataSet.Tables[0].Rows.Count > 0) { if (dataSet.Tables[0].Rows[0]["TRES"].ToString() != "OK") { SajetCommon.Show_Message(dataSet.Tables[0].Rows[0]["TRES"].ToString(), 0); tSN.Focus(); tSN.SelectAll(); return; } else { dataGridView1.Rows.Add(); dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["SN_NO"].Value = tSN.Text.Trim(); dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["WONO"].Value = dataSet.Tables[0].Rows[0]["C_WO"].ToString(); dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["Material_No"].Value = dataSet.Tables[0].Rows[0]["C_MATERIAL"].ToString(); dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["qty"].Value = dataSet.Tables[0].Rows[0]["C_QTY"].ToString(); dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["type"].Value = dataSet.Tables[0].Rows[0]["C_TYPE"].ToString(); tSN.Focus(); tSN.SelectAll(); } } }