/// <summary> /// To Add Tenure Structure /// </summary> /// <param name="objTenureStructure"></param> /// <returns></returns> public string AddTenureStructure(TenureStructureBO objTenureStructure) { string result = ""; OracleConnection myConnection; OracleCommand myCommand; myConnection = new OracleConnection(AppConfiguration.ConnectionString); myCommand = new OracleCommand("USP_MST_INS_TENURESTRUCTURE", myConnection); myCommand.Connection = myConnection; myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.Add("@TenureStructureNameIN", objTenureStructure.Str_Tenure); myCommand.Parameters.Add("@ISDELETEDIN", "False"); myCommand.Parameters.Add("@USERIDIN", objTenureStructure.CreatedBy); myCommand.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output; myConnection.Open(); myCommand.ExecuteNonQuery(); if (myCommand.Parameters["errorMessage_"].Value != null) { result = myCommand.Parameters["errorMessage_"].Value.ToString(); } myConnection.Close(); return(result); }
/// <summary> /// To Get All Tenure Structures /// </summary> /// <param name="TenureStructureName"></param> /// <returns></returns> public TenureStructureList GetAllTenureStructures(string TenureStructureName) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_GET_ALTENURESTRUCTURES"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; if (TenureStructureName.ToString() == "") { cmd.Parameters.Add("@TenureStructureNameIN", DBNull.Value); } else { cmd.Parameters.Add("@TenureStructureNameIN", TenureStructureName.ToString()); } cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); TenureStructureBO objTenureStructre = null; TenureStructureList TenureStructure = new TenureStructureList(); while (dr.Read()) { objTenureStructre = new TenureStructureBO(); objTenureStructre.Str_TenureId = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("STR_TENUREID"))); objTenureStructre.Str_Tenure = dr.GetString(dr.GetOrdinal("STR_TENURE")); objTenureStructre.IsDeleted = dr.GetString(dr.GetOrdinal("ISDELETED")); TenureStructure.Add(objTenureStructre); } dr.Close(); return(TenureStructure); }
/// <summary> /// Set edit mode for edit comand /// Delete data from the database for delete comand /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void GrdStructureTenure_RowCommand(object sender, GridViewCommandEventArgs e) { string message = string.Empty; if (e.CommandName == "EditRow") { ShowHideSections(true, false); ViewState["STR_TENUREID"] = e.CommandArgument; TenureStructureBLL objTenureStructureBLL = new TenureStructureBLL(); TenureStructureBO objTenureStructure = objTenureStructureBLL.GetTenureStructureItem(Convert.ToInt32(ViewState["STR_TENUREID"])); txtStructuretenure.Text = objTenureStructure.Str_Tenure; SetUpdateMode(true); ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true); } else if (e.CommandName == "DeleteRow") { TenureStructureBLL objTenureStructureBLL = new TenureStructureBLL(); message = objTenureStructureBLL.DeleteTenureStructure(Convert.ToInt32(e.CommandArgument)); SetUpdateMode(false); BindGrid(false, true); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data deleted successfully"; } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } } }
/// <summary> /// Save and Update Data into Database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Save_Click(object sender, EventArgs e) { string message = ""; TenureStructureBO objTenureStructure = new TenureStructureBO(); objTenureStructure.Str_TenureId = Convert.ToInt32(ViewState["STR_TENUREID"]); objTenureStructure.Str_Tenure = txtStructuretenure.Text.Trim(); TenureStructureBLL objTenureStructureBLL = new TenureStructureBLL(); if (objTenureStructure.Str_TenureId == 0) { objTenureStructure.CreatedBy = Convert.ToInt32(Session["USER_ID"]); message = objTenureStructureBLL.AddTenureStructure(objTenureStructure); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data saved successfully"; } } else { objTenureStructure.UpdatedBy = Convert.ToInt32(Session["USER_ID"]); message = objTenureStructureBLL.UpdateTenureStructure(objTenureStructure); SetUpdateMode(false); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; } } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } ClearDetails(); BindGrid(true, false); }
/// <summary> /// To Get Tenure Structure Item /// </summary> /// <param name="TenureStructureID"></param> /// <returns></returns> public TenureStructureBO GetTenureStructureItem(int TenureStructureID) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_GET_STRTNRBYSTRTNRID"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@TenureStructureIDIN", TenureStructureID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); TenureStructureBO obTenureStructure = null; while (dr.Read()) { obTenureStructure = new TenureStructureBO(); obTenureStructure.Str_TenureId = dr.GetInt32(dr.GetOrdinal("STR_TENUREID")); obTenureStructure.Str_Tenure = dr.GetString(dr.GetOrdinal("STR_TENURE")); } dr.Close(); return(obTenureStructure); }
/// <summary> /// To Update Tenure Structure /// </summary> /// <param name="objTenureStructure"></param> /// <returns></returns> public string UpdateTenureStructure(TenureStructureBO objTenureStructure) { TenureStructureDAL objTenureStructureDAL = new TenureStructureDAL(); return(objTenureStructureDAL.UpdateTenureStructure(objTenureStructure)); }
/// <summary> /// To Add Tenure Structure /// </summary> /// <param name="objTenureStructure"></param> /// <returns></returns> public string AddTenureStructure(TenureStructureBO objTenureStructure) { TenureStructureDAL objTenureStructureDAL = new TenureStructureDAL(); return(objTenureStructureDAL.AddTenureStructure(objTenureStructure)); }