/// <summary> /// To Get MNE Goal Evaluation /// </summary> /// <param name="projectID"></param> /// <returns></returns> public MNEGoalEvaluationList GetMNEGoalEvaluation(int projectID) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; MNEGoalEvaluationBO objMNEGoalEvaluationBO = null; string proc = "USP_GET_TRN_MNE_EVAL"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("ProjectID_", projectID); cmd.Parameters.Add("Sp_recordset", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); MNEGoalEvaluationList MNEGoalEvaluation = new MNEGoalEvaluationList(); while (dr.Read()) { objMNEGoalEvaluationBO = new MNEGoalEvaluationBO(); objMNEGoalEvaluationBO.EvaluationID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("evaluationid"))); objMNEGoalEvaluationBO.Goalname = dr.GetString(dr.GetOrdinal("goalname")); objMNEGoalEvaluationBO.GoalDescription = dr.GetString(dr.GetOrdinal("goaldescription")); //objMNEGoalEvaluationBO.GoalNarrative = dr.GetString(dr.GetOrdinal("goalnarrative")); //objMNEGoalEvaluationBO.IsDeleted = dr.GetString(dr.GetOrdinal("isdeleted")); // objMNEGoalEvaluationBO.ProjectID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("projectid"))); MNEGoalEvaluation.Add(objMNEGoalEvaluationBO); } dr.Close(); return(MNEGoalEvaluation); }
/// <summary> /// To Update MNE Goal Evaluation /// </summary> /// <param name="objMNEGoalEvaluationBO"></param> /// <returns></returns> public string UpdateMNEGoalEvaluation(MNEGoalEvaluationBO objMNEGoalEvaluationBO) { MNEGoalEvaluationDAL objMNEGoalEvaluationDAL = new MNEGoalEvaluationDAL(); //Data pass -to Database Layer try { return(objMNEGoalEvaluationDAL.UpdateMNEGoalEvaluation(objMNEGoalEvaluationBO)); } catch { throw; } finally { objMNEGoalEvaluationDAL = null; } }
/// <summary> /// To Insert MNE Goal Eval /// </summary> /// <param name="objMNEGoalEvaluationBO"></param> /// <returns></returns> public string InsertMNEGoalEval(MNEGoalEvaluationBO objMNEGoalEvaluationBO) { string result = ""; OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); cnn.Open(); OracleCommand dcmd = new OracleCommand("USP_INS_TRN_MNE_EVAL", cnn); dcmd.CommandType = CommandType.StoredProcedure; int count = Convert.ToInt32(dcmd.CommandType); try { dcmd.Parameters.Add("PROJECTID_", objMNEGoalEvaluationBO.ProjectID); dcmd.Parameters.Add("GOALID_", objMNEGoalEvaluationBO.GoalID); dcmd.Parameters.Add("GOALDESCRIPTION_", objMNEGoalEvaluationBO.GoalDescription); dcmd.Parameters.Add("GOALNARRATIVE_", objMNEGoalEvaluationBO.GoalNarrative); dcmd.Parameters.Add("ISDELETED_", objMNEGoalEvaluationBO.IsDeleted); dcmd.Parameters.Add("CREATEDBY_", objMNEGoalEvaluationBO.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 fetch details from grid and assign to textbox /// </summary> private void GetMNEGoalEval() { MNEGoalEvaluationBLL objMNEGoalEvaluationBLL = new MNEGoalEvaluationBLL(); int EvaluationId = 0; if (ViewState["EVALUATIONID"] != null) { EvaluationId = Convert.ToInt32(ViewState["EVALUATIONID"]); } MNEGoalEvaluationBO objMNEGoalEvaluationBO = new MNEGoalEvaluationBO(); objMNEGoalEvaluationBO = objMNEGoalEvaluationBLL.GetMNEGoalEvaluationByID(EvaluationId); ddlGoal.ClearSelection(); if (ddlGoal.Items.FindByValue(objMNEGoalEvaluationBO.GoalID.ToString()) != null) { ddlGoal.Items.FindByValue(objMNEGoalEvaluationBO.GoalID.ToString()).Selected = true; } ViewState["EVALUATIONID"] = objMNEGoalEvaluationBO.EvaluationID; txtDescription.Text = objMNEGoalEvaluationBO.GoalDescription; txtNarrative.Text = objMNEGoalEvaluationBO.GoalNarrative; }
/// <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(); string projectID = Session["PROJECT_ID"].ToString(); MNEGoalEvaluationBLL objMNEGoalEvaluationBLL = new MNEGoalEvaluationBLL(); if (Convert.ToInt32(ViewState["EVALUATIONID"]) == 0) { try { MNEGoalEvaluationBO objMNEGoalEvaluationBO = new MNEGoalEvaluationBO(); objMNEGoalEvaluationBO.ProjectID = Convert.ToInt32(projectID); objMNEGoalEvaluationBO.GoalID = Convert.ToInt32(ddlGoal.SelectedValue); objMNEGoalEvaluationBO.GoalDescription = txtDescription.Text.Trim(); if (txtNarrative.Text.Length <= 1999) { objMNEGoalEvaluationBO.GoalNarrative = txtNarrative.Text.Trim(); } else { objMNEGoalEvaluationBO.GoalNarrative = txtNarrative.Text.Substring(0, 1999); } objMNEGoalEvaluationBO.CreatedBy = Convert.ToInt32(uID); objMNEGoalEvaluationBO.IsDeleted = "False"; message = objMNEGoalEvaluationBLL.InsertMNEGoalEval(objMNEGoalEvaluationBO); 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 { objMNEGoalEvaluationBLL = null; } BindGrid(true, true); } //edit the data in the textbox exiting in the Grid else if (Convert.ToInt32(ViewState["EVALUATIONID"]) > 0) { try { MNEGoalEvaluationBO objMNEGoalEvaluationBO = new MNEGoalEvaluationBO(); objMNEGoalEvaluationBO.ProjectID = Convert.ToInt32(projectID); objMNEGoalEvaluationBO.EvaluationID = Convert.ToInt32(ViewState["EVALUATIONID"]); objMNEGoalEvaluationBO.GoalID = Convert.ToInt32(ddlGoal.SelectedValue); objMNEGoalEvaluationBO.GoalDescription = txtDescription.Text.Trim(); objMNEGoalEvaluationBO.GoalNarrative = txtNarrative.Text.Trim(); objMNEGoalEvaluationBO.UpdatedBy = Convert.ToInt32(uID); message = objMNEGoalEvaluationBLL.UpdateMNEGoalEvaluation(objMNEGoalEvaluationBO); 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 { objMNEGoalEvaluationBLL = null; } BindGrid(true, true); SetUpdateMode(false); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } ClearData(); }