private void button1_Click(object sender, EventArgs e) { string sSQL = string.Empty; StringBuilder sb = new StringBuilder(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { sSQL = string.Format(@"Insert into SAJET.G_QC_CHECK_RETURN VALUES('" + textBox1.Text.Trim() + "'," + "'" + dataGridView1.Rows[i].Cells["SN_NO"].Value.ToString() + "'," + "'Y'," + "'" + ClientUtils.UserPara1 + "',SYSDATE," + "'" + richTextBox1.Text.Trim() + "');"); sb.AppendLine(sSQL); } try { sSQL = string.Format(@"begin {0} end;", sb.ToString()); ClientUtils.ExecuteSQL(sSQL); } catch (Exception ex) { SajetCommon.Show_Message(ex.Message, 0); return; } dataGridView1.Rows.Clear(); tSN.Focus(); tSN.SelectAll(); RandomNum(); }
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 static bool CheckEnabled(string sType, string sPrivilege) { try { string sSQL = " SELECT SAJET.SJ_PRIVILEGE_DEFINE('" + sType + "','" + sPrivilege + "') TENABLED from DUAL "; DataSet dsTemp = ClientUtils.ExecuteSQL(sSQL); string sRes = dsTemp.Tables[0].Rows[0]["TENABLED"].ToString(); return(sRes == "Y"); } catch (Exception ex) { SajetCommon.Show_Message("Function:SAJET.SJ_PRIVILEGE_DEFINE" + Environment.NewLine + ex.Message, 0); return(false); } }
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(); } } }
private void fMain_Load(object sender, EventArgs e) { SajetCommon.SetLanguageControl(this); RandomNum(); tSN.Focus(); }