private void Process_MDSE_Locks() { OracleDataAccessor DA = GlobalDataAccessor.Instance.OracleDA; string RecordType = cbRecordType.Text; string ShopNbr = txtShop.Text.PadLeft(5, '0'); string ICNNbr = txtDetail.Text; string LblSearchName; string msg; Point mdsePoint = new Point(); bool RetVal; DialogResult frmResult; Int32 OutRows; mdsePoint.X = 79; mdsePoint.Y = 162; LblSearchName = "Shop / ICN:"; //create input parameters List <OracleProcParam> iParams = new List <OracleProcParam>(); iParams.Add(new OracleProcParam("p_shop_number", ShopNbr)); iParams.Add(new OracleProcParam("p_icn_nbr", ICNNbr)); //setup ref cursor var RefCursor = new List <PairType <string, string> >(); RefCursor.Add(new PairType <string, string>("o_mdse_data", "OUT_DATA")); //execute stored procedure DataSet OutDataSet; try { RetVal = DA.issueSqlStoredProcCommand( "ccsowner", "pawn_support_locks", "get_mdse_record", iParams, RefCursor, "o_return_code", "o_return_text", out OutDataSet); } catch (OracleException oEx) { msg = string.Format("Invocation of get_mdse_record stored proc failed{0}{1}{0}{2}", Environment.NewLine, oEx.Message, Smsg); MessageBox.Show(msg, "Error"); return; } if (RetVal == false) { msg = DA.ErrorDescription; MessageBox.Show(msg, "Error"); return; } if (OutDataSet != null) { if (OutDataSet.Tables != null) { if (OutDataSet.Tables.Count > 0) { DataTable mdseTable = OutDataSet.Tables["OUT_DATA"]; if (mdseTable != null && mdseTable.IsInitialized && mdseTable.Rows != null && mdseTable.Rows.Count > 0) { // add a full icn column to datatable and populate mdseTable.Columns.Add("FullICN", typeof(string)); foreach (DataRow x in mdseTable.Rows) { string ICN_STORE = x[0].ToString(); string ICN_YEAR = x[1].ToString(); string ICN_DOC = x[2].ToString(); string ICN_DOC_TYPE = x[3].ToString(); string ICN_ITEM = x[4].ToString(); string ICN_SUBITEM = x[5].ToString(); string FullICN; FullICN = ""; FullICN = FullICN + ICN_STORE.PadLeft(5, '0'); FullICN += ICN_YEAR; FullICN += ICN_DOC.PadLeft(6, '0'); FullICN += ICN_DOC_TYPE; FullICN += ICN_ITEM.PadLeft(3, '0'); FullICN += ICN_SUBITEM.PadLeft(2, '0'); x[11] = FullICN; } //find out how many rows were returned OutRows = mdseTable.Rows.Count; if (OutRows == 1) { //process for a single record //make sure record has a temp lock //foreach (DataRow dr in LocData.Tables[0].Rows) string Locktype; DataRow dr = mdseTable.Rows[0]; Locktype = dr[10].ToString(); string FullICN = dr[11].ToString(); if (Locktype != string.Empty) { var frmClearStatus2 = new FrmClearTempStatus2(Locktype, RecordType, LblSearchName, mdsePoint, ShopNbr, FullICN); frmResult = frmClearStatus2.ShowDialog(); if (frmResult == DialogResult.Cancel) { this.Close(); } } else { MessageBox.Show("No temp lock found.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } } else { //process for multiple records var frmDupMerch = new FrmDupMerch(mdseTable); frmResult = frmDupMerch.ShowDialog(); if (frmResult == DialogResult.OK) { var frmClearStatus2 = new FrmClearTempStatus2(frmDupMerch.LockDescription, RecordType, LblSearchName, mdsePoint, ShopNbr, frmDupMerch.FullICN); frmResult = frmClearStatus2.ShowDialog(); if (frmResult == DialogResult.Cancel) { this.Close(); } } } } else { MessageBox.Show("Error fetching data.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { // no records were returned MessageBox.Show("No record found matching this search criteria.", "No Data Found", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else { MessageBox.Show("Error fetching data.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { MessageBox.Show("Error fetching data.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void Process_Pawn_Locks() { OracleDataAccessor DA = GlobalDataAccessor.Instance.OracleDA; string RecordType = cbRecordType.Text; string ShopNbr = txtShop.Text.PadLeft(5, '0'); string TicketNbr = txtDetail.Text; Point mdsePoint = new Point(); string LblSearchName; bool RetVal; string msg; string TempStatus; string ErrorCode; DialogResult frmResult; Int32 nTicketNbr; mdsePoint.X = 29; mdsePoint.Y = 162; LblSearchName = "Shop / Ticket Number:"; try { nTicketNbr = Convert.ToInt32(TicketNbr); } catch { MessageBox.Show("Invalid Ticket Number"); return; } //create input parameters List <OracleProcParam> iParams = new List <OracleProcParam>(); iParams.Add(new OracleProcParam("p_shop_number", ShopNbr)); iParams.Add(new OracleProcParam("p_ticket_nbr", nTicketNbr)); iParams.Add(new OracleProcParam("o_temp_status", OracleDbType.Varchar2, DBNull.Value, ParameterDirection.Output, 20)); //execute stored procedure DataSet OutDataSet; try { RetVal = DA.issueSqlStoredProcCommand( "ccsowner", "pawn_support_locks", "get_pawnlock_record", iParams, null, "o_return_code", "o_return_text", out OutDataSet); } catch (OracleException oEx) { msg = string.Format("Invocation of get_mdse_record stored proc failed{0}{1}{0}{2}", Environment.NewLine, oEx.Message, Smsg); MessageBox.Show(msg, "Error"); return; } if (RetVal == false) { msg = DA.ErrorDescription; ErrorCode = DA.ErrorCode; if (ErrorCode == "1") { MessageBox.Show("No record found matching this search criteria.", "No Data Found", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } MessageBox.Show(msg, "Error"); return; } RetVal = OracleUtilities.GetProcedureOutput(OutDataSet, 0, out TempStatus); if (TempStatus == "null") { MessageBox.Show("No temp lock found.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } var frmClearStatus2 = new FrmClearTempStatus2( TempStatus, RecordType, // "Pawn Loan" LblSearchName, // "Shop / Ticket Number:" mdsePoint, // Screen Locaton ShopNbr, // store number TicketNbr // ticket number ); frmResult = frmClearStatus2.ShowDialog(); if (frmResult == DialogResult.Cancel) { this.Close(); } }