/// <summary> /// to fetch details /// </summary> /// <returns></returns> public FinanceConditionBO GetfinanceConditionID(int financeConditionID) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_DETAIL_FINANCE_COND"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("F_FINANCECONDITIONID", financeConditionID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); FinanceConditionBO Boobj = null; FinanceConditionList Listobj = new FinanceConditionList(); Boobj = new FinanceConditionBO(); while (dr.Read()) { if (ColumnExists(dr, "FINANCECONDITION") && !dr.IsDBNull(dr.GetOrdinal("FINANCECONDITION"))) { Boobj.FINANCECONDITION = dr.GetString(dr.GetOrdinal("FINANCECONDITION")); } if (ColumnExists(dr, "FINANCECONDITIONID") && !dr.IsDBNull(dr.GetOrdinal("FINANCECONDITIONID"))) { Boobj.FINANCECONDITIONID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("FINANCECONDITIONID"))); } } dr.Close(); return(Boobj); }
public string Update(FinanceConditionBO FinanceConditionBOobj) { FinanceConditionDAL DALobj = new FinanceConditionDAL(); //Data pass -to Database Layer try { return(DALobj.Update(FinanceConditionBOobj)); } catch { throw; } finally { DALobj = null; } }
/// <summary> /// To Insert /// </summary> /// <param name="FinanceConditionBOobj"></param> /// <returns></returns> public string Insert(FinanceConditionBO FinanceConditionBOobj) { FinanceConditionDAL FinanceConditionDALobj = new FinanceConditionDAL(); //Data pass -to Database Layer try { return(FinanceConditionDALobj.Insert(FinanceConditionBOobj)); } catch (Exception ex) { throw ex; } finally { FinanceConditionDALobj = null; } }
/// <summary> /// to fetch details from database /// </summary> private void GetFinanceCondDetail() { FinanceConditionBLL BLLobj = new FinanceConditionBLL(); int financeConditionID = 0; if (ViewState["FINANCECONDITIONID"] != null) { financeConditionID = Convert.ToInt32(ViewState["FINANCECONDITIONID"]); } FinanceConditionBO BOobj = new FinanceConditionBO(); BOobj = BLLobj.GetfinanceConditionID(financeConditionID); ConditionsTextBox.Text = BOobj.FINANCECONDITION; ConditionsIDTextBox.Text = BOobj.FINANCECONDITIONID.ToString(); }
/// <summary> /// to update data /// </summary> /// <param name="FinanceConditionBOobj"></param> /// <returns></returns> public string Update(FinanceConditionBO FinanceConditionBOobj) { string returnResult = string.Empty; OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); cnn.Open(); OracleCommand dcmd = new OracleCommand("USP_MST_UPD_FINANCE_COND", cnn); dcmd.CommandType = CommandType.StoredProcedure; int count = Convert.ToInt32(dcmd.CommandType); try { dcmd.Parameters.Add("F_FINANCECONDITIONID", FinanceConditionBOobj.FINANCECONDITIONID); dcmd.Parameters.Add("F_FINANCECONDITION", FinanceConditionBOobj.FINANCECONDITION); dcmd.Parameters.Add("F_UPDATEDBY", FinanceConditionBOobj.CREATEDBY); //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 fetch details /// </summary> /// <returns></returns> public FinanceConditionList GetAllFinanceConditions() { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_GET_FINAN_COND_ALL"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); FinanceConditionBO Boobj = null; FinanceConditionList Listobj = new FinanceConditionList(); while (dr.Read()) { Boobj = new FinanceConditionBO(); if (!dr.IsDBNull(dr.GetOrdinal("FINANCECONDITIONID"))) { Boobj.FINANCECONDITIONID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("FINANCECONDITIONID"))); } if (!dr.IsDBNull(dr.GetOrdinal("FINANCECONDITION"))) { Boobj.FINANCECONDITION = dr.GetString(dr.GetOrdinal("FINANCECONDITION")); } if (!dr.IsDBNull(dr.GetOrdinal("ISDELETED"))) { Boobj.ISDELETED = dr.GetString(dr.GetOrdinal("ISDELETED")); } Listobj.Add(Boobj); } dr.Close(); return(Listobj); }
/// <summary> /// to insert data to database /// </summary> protected void SaveButton_Click(object sender, EventArgs e) { string AlertMessage = string.Empty; string message = string.Empty; if (ConditionsIDTextBox.Text.ToString().Trim() == string.Empty) { FinanceConditionBLL BLLobj = new FinanceConditionBLL(); try { string uID = Session["USER_ID"].ToString(); FinanceConditionBO FinanceConditionBOobj = new FinanceConditionBO(); FinanceConditionBOobj.FINANCECONDITION = ConditionsTextBox.Text; FinanceConditionBOobj.CREATEDBY = Convert.ToInt32(uID); FinanceConditionBLL FBLLobj = new FinanceConditionBLL(); message = FBLLobj.Insert(FinanceConditionBOobj); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data saved successfully"; ClearAll(); BindGrid(true, true); } //BindGrid(true, true); //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Vaccination details added successfully');", true); } catch (Exception ex) { throw ex; } finally { BLLobj = null; } } else if (ConditionsIDTextBox.Text.ToString().Trim() != string.Empty) { FinanceConditionBLL BLLobj = new FinanceConditionBLL(); try { string uID = Session["USER_ID"].ToString(); FinanceConditionBO FinanceConditionBOobj = new FinanceConditionBO(); FinanceConditionBOobj.FINANCECONDITION = ConditionsTextBox.Text; FinanceConditionBOobj.FINANCECONDITIONID = Convert.ToInt32(ConditionsIDTextBox.Text); FinanceConditionBOobj.CREATEDBY = Convert.ToInt32(uID); FinanceConditionBLL FBLLobj = new FinanceConditionBLL(); message = FBLLobj.Update(FinanceConditionBOobj); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; ClearAll(); BindGrid(true, true); SetUpdateMode(false); } //BindGrid(true, true); //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Vaccination details added successfully');", true); } catch (Exception ex) { throw ex; } finally { BLLobj = null; } } AlertMessage = "alert('" + message + "');"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true); }