/// <summary> /// method to softdelete data from database /// </summary> /// <param name="evaluationID"></param> private void DeleteMNEGoalEval(string evaluationID) { MNEGoalEvaluationBLL objMNEGoalEvaluationBLL = new MNEGoalEvaluationBLL(); string message = string.Empty; try { message = objMNEGoalEvaluationBLL.DeleteMNEGoalEvaluation(Convert.ToInt32(evaluationID)); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data Deleted successfully"; } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Set Grid Data source /// </summary> /// <param name="addRow"></param> /// <param name="deleteRow"></param>e private void BindGrid(bool addRow, bool deleteRow) { MNEGoalEvaluationBLL objMNEGoalEvaluationBLL = new MNEGoalEvaluationBLL(); gvGoalEval.DataSource = objMNEGoalEvaluationBLL.GetMNEGoalEvaluation(Convert.ToInt32(Session["PROJECT_ID"])); gvGoalEval.DataBind(); }
/// <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(); }