/*__________________________________________________________________________________________*/ private void btnSubmit_Click(object sender, EventArgs e) { var extendedDate = checkNull(this.dtpExtendedDate.Text); var reasonCode = checkNull(this.cbReasonCode.Text); var originalDepDate = checkNull(this.tbDepositDate.Text); if (extendedDate.Equals(string.Empty) || reasonCode.Equals(string.Empty)) { MessageBox.Show("Please enter Extended Deposit Date and Reason code and hit submit.", "Form Invalid.", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { if (DateTime.Parse(originalDepDate) >= DateTime.Parse(extendedDate)) { MessageBox.Show("Invalid Date, the Extended Deposit Date should be greater than the Original Deposit Date.", "Invalid Date.", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else if (DateTime.Parse(extendedDate) > DateTime.Parse(this.lblValidExtendedDate.Text)) { MessageBox.Show("Invalid Extended Date, the Extended Deposit Date should be less than " + DateTime.Parse(this.lblValidExtendedDate.Text).FormatDate(), "Invalid Date.", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else if (DateTime.Parse(extendedDate) < DateTime.Now) { MessageBox.Show("Invalid Date, the Extended Deposit Date should be future date.", "Invalid Date.", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } extendedDate = DateTime.Parse(extendedDate).FormatDate(); } string strUserId = GlobalDataAccessor.Instance.DesktopSession.UserName; string errorCode; string errorDesc; var depositDetails = new DepositDateExtensionDetails(); bool returnVal = Support.Controllers.Database.Procedures.CustomerLoans.UpdateDepositExtensionDate( Support.Logic.CashlinxPawnSupportSession.Instance.ActivePDLoan.PDLLoanNumber, extendedDate, reasonCode, strUserId, out errorCode, out errorDesc); if (returnVal) { PDLoan pdLoan = new PDLoan(); int iDx = Support.Logic.CashlinxPawnSupportSession.Instance.PDLoanKeys.FindIndex(delegate(PDLoan p) { return(p.PDLLoanNumber.Equals(CashlinxPawnSupportSession.Instance.ActivePDLoan.PDLLoanNumber)); }); if (iDx >= 0) { pdLoan = Support.Logic.CashlinxPawnSupportSession.Instance.PDLoanKeys[iDx]; pdLoan.GetPDLoanDetails.ExtendedDate = DateTime.Parse(extendedDate); pdLoan.GetPDLoanDetails.LastUpdatedBy = strUserId; } this.NavControlBox.IsCustom = true; this.NavControlBox.CustomDetail = "ProductsAndServices"; this.NavControlBox.Action = NavBox.NavAction.BACK; } else { if (errorCode.Equals("50")) { MessageBox.Show(errorDesc, "Not Eligible", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show(errorDesc, "Database call failed.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
/// <summary> /// Provides back stored Loan Key data into a DataSet. /// </summary> /// <param name="customerNumber"></param> /// <param name="loanKeys"></param> /// <param name="errorCode"></param> /// <param name="errorText"></param> /// <returns></returns> public static bool GetExtendDepositDateInfo( string loanNumber, DepositDateExtensionDetails extended_date, out string errorCode, out string errorText) { //Set default output values errorCode = string.Empty; errorText = string.Empty; if (extended_date == null) { errorCode = "NullLoanNumber"; errorText = "The DepositDateExtensionDetails object is null."; return(false); } DataSet outputDataSet = null; //Verify that the accessor is valid if (GlobalDataAccessor.Instance.OracleDA == null) { errorCode = "get_extend_info"; errorText = "Invalid desktop session or data accessor instance"; BasicExceptionHandler.Instance.AddException("GetExtendDepositDateInfo", new ApplicationException("Cannot execute the Get Extended Deposit Date stored procedure")); return(false); } //Get data accessor object var dA = GlobalDataAccessor.Instance.OracleDA; //Create input list var inParams = new List <OracleProcParam>(); //Add cat pointer inParams.Add(new OracleProcParam("p_loan_number", loanNumber)); inParams.Add(new OracleProcParam("o_max_extend_date", OracleDbType.Varchar2, DBNull.Value, ParameterDirection.Output, 256)); inParams.Add(new OracleProcParam("o_current_dep_date", OracleDbType.Varchar2, DBNull.Value, ParameterDirection.Output, 256)); //Setup ref cursor array var refCursors = new List <PairType <string, string> > { new PairType <string, string>("o_extend_reasons", EXTENDED_REASONS), }; //Create output data set names bool retVal = false; try { // EDW - CR#11333 retVal = dA.issueSqlStoredProcCommand( "ccsowner", "PAWN_SUPPORT_PRODUCTS", "get_extend_info", inParams, refCursors, "o_return_code", "o_return_text", out outputDataSet); } catch (OracleException oEx) { errorCode = "GetExtendDepositDateInfo"; errorText = "Invocation of GetExtendDepositDateInfo stored proc failed"; BasicExceptionHandler.Instance.AddException("OracleException thrown when invoking get_extend_info stored proc", oEx); return(false); } //See if retVal is false if (retVal == false) { errorCode = dA.ErrorCode; errorText = dA.ErrorDescription; return(false); } if (outputDataSet != null && outputDataSet.IsInitialized) { if (outputDataSet.Tables != null && outputDataSet.Tables.Count > 0) { int iRowIdx = 0; DataTable dT = outputDataSet.Tables[EXTENDED_REASONS]; foreach (DataRow curDr in dT.Rows) { var pVO = new ExtendedDateReasons(); pVO.ReasonCode = Utilities.GetStringValue(curDr["reason_code"]); pVO.Reason_Description = Utilities.GetStringValue(curDr["reason_description"]); extended_date.GetExtendedDateReasonsList.Add(pVO); } var outputDt = outputDataSet.Tables["OUTPUT"]; if (outputDt != null && outputDt.IsInitialized && outputDt.Rows != null && outputDt.Rows.Count > 0) { var dr = outputDt.Rows[0]; if (dr != null && dr.ItemArray.Length > 0) { extended_date.Max_Extend_Date = dr.ItemArray.GetValue(1).ToString(); } dr = outputDt.Rows[1]; if (dr != null && dr.ItemArray.Length > 0) { extended_date.Cur_Dep_Date = dr.ItemArray.GetValue(1).ToString(); } } } errorCode = "0"; errorText = string.Empty; return(true); } errorCode = "GetExtendDepositDateInfoFailed"; errorText = "Operation failed"; return(false); }