/// <summary> /// To fetch details from database based on ID /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GetModeofPaymentIDByID() { ModeofPaymentBLL ModeofPaymentBLLobj = new ModeofPaymentBLL(); int ModeofPaymentID = 0; if (ViewState["ModeofPaymentID"] != null) { ModeofPaymentID = Convert.ToInt32(ViewState["ModeofPaymentID"]); } ModeofPaymentBO ModeofPaymentObj = new ModeofPaymentBO(); ModeofPaymentObj = ModeofPaymentBLLobj.GetModeofPaymentID(ModeofPaymentID); rdoTypeInKind.Checked = false; rdoTypeCash.Checked = false; if (ModeofPaymentObj.PaymentType.ToUpper() == "IN KIND") { rdoTypeInKind.Checked = true; } else { rdoTypeCash.Checked = true; } txtModeofPayment.Text = ModeofPaymentObj.ModeofPayment; txtModeofPaymentID.Text = ModeofPaymentObj.ModeofPaymentID.ToString(); }
//get all data in mst_Concern table using USP_MST_SELECTCONCERN-SP /// <summary> /// To Get Mode of Payment /// </summary> /// <returns></returns> public ModeofPaymentList GetModeofPayment() { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_SELECTMODEOFPAYMENT"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("Sp_recordset", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); ModeofPaymentBO objModeofPayment = null; ModeofPaymentList ModeofPaymentList = new ModeofPaymentList(); while (dr.Read()) { objModeofPayment = new ModeofPaymentBO(); objModeofPayment.ModeofPaymentID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("MODEOFPAYMENTID"))); objModeofPayment.ModeofPayment = dr.GetString(dr.GetOrdinal("MODEOFPAYMENT")); objModeofPayment.PaymentType = dr.GetString(dr.GetOrdinal("TYPEOFPAYMENT")); objModeofPayment.IsDeleted = dr.GetString(dr.GetOrdinal("ISDELETED")); ModeofPaymentList.Add(objModeofPayment); } dr.Close(); return(ModeofPaymentList); }
public string EDITMODEOFPAYMENT(ModeofPaymentBO ModeofPaymentBOObj) { string returnResult = string.Empty; OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); cnn.Open(); OracleCommand dcmd = new OracleCommand("USP_MST_UPDATEMODEOFPAY", cnn); dcmd.CommandType = CommandType.StoredProcedure; int count = Convert.ToInt32(dcmd.CommandType); try { dcmd.Parameters.Add("TYPEOFPAYMENT_", ModeofPaymentBOObj.PaymentType); dcmd.Parameters.Add("MODEOFPAYMENT_", ModeofPaymentBOObj.ModeofPayment); dcmd.Parameters.Add("MODEOFPAYMENTID_", ModeofPaymentBOObj.ModeofPaymentID); dcmd.Parameters.Add("UpdatedBY", ModeofPaymentBOObj.UserID); //return dcmd.ExecuteNonQuery(); dcmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output; dcmd.ExecuteNonQuery(); if (dcmd.Parameters["errorMessage_"].Value != null) { returnResult = dcmd.Parameters["errorMessage_"].Value.ToString(); } else { returnResult = string.Empty; } } catch { throw; } finally { dcmd.Dispose(); cnn.Close(); cnn.Dispose(); } return(returnResult); }
/// <summary> /// To EDIT MODE OF PAYMENT /// </summary> /// <param name="ModeofPaymentBOObj"></param> /// <returns></returns> public string EDITMODEOFPAYMENT(ModeofPaymentBO ModeofPaymentBOObj) { ModeofPaymentDAL ModeofPaymentDALObj = new ModeofPaymentDAL();//Data pass -to Database Layer try { return(ModeofPaymentDALObj.EDITMODEOFPAYMENT(ModeofPaymentBOObj)); } catch { throw; } finally { ModeofPaymentDALObj = null; } }
/// <summary> /// To Insert Mode of Payment /// </summary> /// <param name="ModeofPaymentBOObj"></param> /// <returns></returns> public string InsertModeofPayment(ModeofPaymentBO ModeofPaymentBOObj) { ModeofPaymentDAL ModeofPaymentDAL = new ModeofPaymentDAL(); //Data pass -to Database Layer try { return(ModeofPaymentDAL.InsertModeofPayment(ModeofPaymentBOObj)); } catch { throw; } finally { ModeofPaymentDAL = null; } }
//get the data in mst_Concern table using USP_MST_GETSELECTCONCERN-SP signal Data based on ID public ModeofPaymentBO GetModeofPaymentID(int ModeofPaymentID) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_GETSELECTMODEOFPAY"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("PositionID_", ModeofPaymentID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); ModeofPaymentBO ModeofPaymentBOObj = null; ModeofPaymentList ModeofPaymentList = new ModeofPaymentList(); ModeofPaymentBOObj = new ModeofPaymentBO(); while (dr.Read()) { if (!dr.IsDBNull(dr.GetOrdinal("TYPEOFPAYMENT"))) { ModeofPaymentBOObj.PaymentType = dr.GetString(dr.GetOrdinal("TYPEOFPAYMENT")); } if (!dr.IsDBNull(dr.GetOrdinal("MODEOFPAYMENT"))) { ModeofPaymentBOObj.ModeofPayment = dr.GetString(dr.GetOrdinal("MODEOFPAYMENT")); } if (!dr.IsDBNull(dr.GetOrdinal("MODEOFPAYMENTID"))) { ModeofPaymentBOObj.ModeofPaymentID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("MODEOFPAYMENTID"))); } if (!dr.IsDBNull(dr.GetOrdinal("ISDELETED"))) { ModeofPaymentBOObj.IsDeleted = dr.GetString(dr.GetOrdinal("ISDELETED")); } } dr.Close(); return(ModeofPaymentBOObj); }
/// <summary> /// To save details to database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string AlertMessage = string.Empty; string message = string.Empty; ModeofPaymentBLL ModeofPaymentBLLOBJ = new ModeofPaymentBLL(); ModeofPaymentBO ModeofPaymentBOObj = new ModeofPaymentBO(); int uID = Convert.ToInt32(Session["USER_ID"].ToString()); if (txtModeofPaymentID.Text.ToString().Trim() == "0") { try { if (rdoTypeInKind.Checked) { ModeofPaymentBOObj.PaymentType = rdoTypeInKind.Text; } else { ModeofPaymentBOObj.PaymentType = rdoTypeCash.Text; } ModeofPaymentBOObj.ModeofPayment = txtModeofPayment.Text.ToString().Trim(); ModeofPaymentBOObj.UserID = uID; message = ModeofPaymentBLLOBJ.InsertModeofPayment(ModeofPaymentBOObj); AlertMessage = "alert('" + message + "');"; if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data saved successfully"; } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); Clear(); BindGrid(); txtModeofPaymentID.Text = "0"; } } catch (Exception ex) { throw ex; } finally { ModeofPaymentBLLOBJ = null; } } else { try { if (rdoTypeInKind.Checked) { ModeofPaymentBOObj.PaymentType = rdoTypeInKind.Text; } else { ModeofPaymentBOObj.PaymentType = rdoTypeCash.Text; } ModeofPaymentBOObj.ModeofPayment = txtModeofPayment.Text.ToString().Trim(); ModeofPaymentBOObj.ModeofPaymentID = Convert.ToInt32(txtModeofPaymentID.Text.ToString().Trim()); ModeofPaymentBOObj.UserID = Convert.ToInt32(uID); message = ModeofPaymentBLLOBJ.EDITMODEOFPAYMENT(ModeofPaymentBOObj); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; // ClearDetails(); Clear(); SetUpdateMode(false); BindGrid(); } } catch (Exception ex) { throw ex; } finally { ModeofPaymentBLLOBJ = null; } } AlertMessage = "alert('" + message + "');"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true); }