/// <summary> /// To Get MNE Goal Eval Elements /// </summary> /// <param name="EvaluationID"></param> /// <returns></returns> public MNEGoalEvalElementsList GetMNEGoalEvalElements(int EvaluationID) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; MNEGoalEvalElementsBO objMNEGoalEvalElementsBO = null; string proc = "USP_GET_MNEEVALELEMENTS"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("EVALUATIONID_", EvaluationID); cmd.Parameters.Add("Sp_recordset", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); MNEGoalEvalElementsList MNEGoalEvalElements = new MNEGoalEvalElementsList(); while (dr.Read()) { objMNEGoalEvalElementsBO = new MNEGoalEvalElementsBO(); objMNEGoalEvalElementsBO.EvaluationID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("evaluationid"))); objMNEGoalEvalElementsBO.EvalelementID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("evalelementid"))); objMNEGoalEvalElementsBO.Goal_elementname = dr.GetString(dr.GetOrdinal("goal_elementname")); objMNEGoalEvalElementsBO.Evalelementdescriptionn = dr.GetString(dr.GetOrdinal("evalelementdescriptionn")); // objMNEGoalEvaluationBO.ProjectID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("projectid"))); MNEGoalEvalElements.Add(objMNEGoalEvalElementsBO); } dr.Close(); return(MNEGoalEvalElements); }
/// <summary> /// To Update MNE Goal Eval Elements /// </summary> /// <param name="objMNEGoalEvalElementsBO"></param> /// <returns></returns> public string UpdateMNEGoalEvalElements(MNEGoalEvalElementsBO objMNEGoalEvalElementsBO) { MNEGoalEvalElementsDAL objMNEGoalEvalElementsDAL = new MNEGoalEvalElementsDAL(); //Data pass -to Database Layer try { return(objMNEGoalEvalElementsDAL.UpdateMNEGoalEvalElements(objMNEGoalEvalElementsBO)); } catch { throw; } finally { objMNEGoalEvalElementsDAL = null; } }
/// <summary> /// To Insert MNE Goal Eval Elements /// </summary> /// <param name="objMNEGoalEvalElementsBO"></param> /// <returns></returns> public string InsertMNEGoalEvalElements(MNEGoalEvalElementsBO objMNEGoalEvalElementsBO) { string result = ""; OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); cnn.Open(); OracleCommand dcmd = new OracleCommand("USP_INS_MNEEVALELEMENTS", cnn); dcmd.CommandType = CommandType.StoredProcedure; int count = Convert.ToInt32(dcmd.CommandType); try { dcmd.Parameters.Add("EVALUATIONID_", objMNEGoalEvalElementsBO.EvaluationID); dcmd.Parameters.Add("GOAL_ELEMENTID_", objMNEGoalEvalElementsBO.Goal_elementID); dcmd.Parameters.Add("EVALELEMENTDESCRIPTIONN_", objMNEGoalEvalElementsBO.Evalelementdescriptionn); dcmd.Parameters.Add("ISDELETED_", objMNEGoalEvalElementsBO.Isdeleted); dcmd.Parameters.Add("CREATEDBY_", objMNEGoalEvalElementsBO.Createdby); dcmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output; dcmd.ExecuteNonQuery(); if (dcmd.Parameters["errorMessage_"].Value != null) { result = dcmd.Parameters["errorMessage_"].Value.ToString(); } return(result); } catch { throw; } finally { dcmd.Dispose(); cnn.Close(); cnn.Dispose(); } }
/// <summary> /// method to fetch details and assign to textbox /// </summary> private void GetMNEGoalEval() { MNEGoalEvalElementsBLL objMNEGoalEvalElementsBLL = new MNEGoalEvalElementsBLL(); int EvalelementId = 0; if (ViewState["EVALELEMENTID"] != null) { EvalelementId = Convert.ToInt32(ViewState["EVALELEMENTID"]); } MNEGoalEvalElementsBO objMNEGoalEvalElementsBO = new MNEGoalEvalElementsBO(); objMNEGoalEvalElementsBO = objMNEGoalEvalElementsBLL.GetMNEGoalEvalElementsByID(EvalelementId); ddlElement.ClearSelection(); if (ddlElement.Items.FindByValue(objMNEGoalEvalElementsBO.Goal_elementID.ToString()) != null) { ddlElement.Items.FindByValue(objMNEGoalEvalElementsBO.Goal_elementID.ToString()).Selected = true; } ViewState["EVALELEMENTID"] = objMNEGoalEvalElementsBO.EvalelementID; txtDescription.Text = objMNEGoalEvalElementsBO.Evalelementdescriptionn; }
/// <summary> /// To save details to database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string message = ""; string uID = Session["USER_ID"].ToString(); MNEGoalEvalElementsBLL objMNEGoalEvalElementsBLL = new MNEGoalEvalElementsBLL(); if (Convert.ToInt32(ViewState["EVALELEMENTID"]) == 0) { try { MNEGoalEvalElementsBO objMNEGoalEvalElementsBO = new MNEGoalEvalElementsBO(); objMNEGoalEvalElementsBO.EvaluationID = Convert.ToInt32(ViewState["EVALUATIONID"]); objMNEGoalEvalElementsBO.Goal_elementID = Convert.ToInt32(ddlElement.SelectedValue); objMNEGoalEvalElementsBO.Evalelementdescriptionn = txtDescription.Text.Trim(); objMNEGoalEvalElementsBO.Createdby = Convert.ToInt32(uID); objMNEGoalEvalElementsBO.Isdeleted = "False"; message = objMNEGoalEvalElementsBLL.InsertMNEGoalEvalElements(objMNEGoalEvalElementsBO); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data saved successfully"; } // txtOptionGroup.Text = "0"; if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } } catch (Exception ex) { throw ex; } finally { objMNEGoalEvalElementsBLL = null; } BindGrid(); } //edit the data in the textbox exiting in the Grid else if (Convert.ToInt32(ViewState["EVALELEMENTID"]) > 0) { try { MNEGoalEvalElementsBO objMNEGoalEvalElementsBO = new MNEGoalEvalElementsBO(); objMNEGoalEvalElementsBO.EvaluationID = Convert.ToInt32(ViewState["EVALUATIONID"]); objMNEGoalEvalElementsBO.EvalelementID = Convert.ToInt32(ViewState["EVALELEMENTID"]); objMNEGoalEvalElementsBO.Goal_elementID = Convert.ToInt32(ddlElement.SelectedValue); objMNEGoalEvalElementsBO.Evalelementdescriptionn = txtDescription.Text.Trim(); objMNEGoalEvalElementsBO.Updatedby = Convert.ToInt32(uID); message = objMNEGoalEvalElementsBLL.UpdateMNEGoalEvalElements(objMNEGoalEvalElementsBO); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } } catch (Exception ex) { throw ex; } finally { objMNEGoalEvalElementsBLL = null; } BindGrid(); SetUpdateMode(false); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } ClearData(); }