/// <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 grdFinances_RowCommand(object sender, GridViewCommandEventArgs e) { string message = string.Empty; if (e.CommandName == "EditRow") { //ShowHideSections(true, false); ViewState["FINANCE_ID"] = e.CommandArgument; ProjectBLL objProjectBLL = new ProjectBLL(); FinancierBO objFinancier = objProjectBLL.GetProjectFinancierByID(Convert.ToInt32(ViewState["FINANCE_ID"])); txtFinancierName.Text = objFinancier.FinancierName; ddlCondition.ClearSelection(); if (ddlCondition.Items.FindByValue(objFinancier.FINANCECONDITIONID.ToString()) != null) { ddlCondition.Items.FindByValue(objFinancier.FINANCECONDITIONID.ToString()).Selected = true; } ddlNature.ClearSelection(); if (ddlNature.Items.FindByValue(objFinancier.FINANCENATUREID.ToString()) != null) { ddlNature.Items.FindByValue(objFinancier.FINANCENATUREID.ToString()).Selected = true; } ddlReason.ClearSelection(); if (ddlReason.Items.FindByValue(objFinancier.FINANCEREASONID.ToString()) != null) { ddlReason.Items.FindByValue(objFinancier.FINANCEREASONID.ToString()).Selected = true; } SetUpdateMode(true); } else if (e.CommandName == "DeleteRow") { string financeID = e.CommandArgument.ToString(); ProjectBLL objProjectBLL = new ProjectBLL(); message = objProjectBLL.DeleteProjectForFinance(Convert.ToInt32(financeID)); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data deleted successfully"; } ClearFields(); SetUpdateMode(false); BindFinanciers(); } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } }
/// <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 = ""; FinancierBO objFin = new FinancierBO(); objFin.FinancierID = Convert.ToInt32(ViewState["FINANCE_ID"]); objFin.FinancierName = txtFinancierName.Text.Trim(); objFin.ProjectID = Convert.ToInt32(Session["PROJECT_ID"]); objFin.FINANCECONDITIONID = Convert.ToInt32(ddlCondition.SelectedValue); objFin.FINANCENATUREID = Convert.ToInt32(ddlNature.SelectedValue); objFin.FINANCEREASONID = Convert.ToInt32(ddlReason.SelectedValue); ProjectBLL objProjectBLL = new ProjectBLL(); if (objFin.FinancierID > 0) { objFin.UpdatedBy = Convert.ToInt32(Session["USER_ID"]); message = objProjectBLL.UpdateProjectFinancier(objFin); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; } SetUpdateMode(false); } else { objFin.CreatedBy = Convert.ToInt32(Session["USER_ID"]); message = objProjectBLL.AddProjectFinancier(objFin); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data saved successfully"; } } ClearFields(); BindFinanciers(); if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } }
//public void DeleteProjectFinancier(int financierID) //{ // (new ProjectDAL()).DeleteProjectFinancier(financierID); //} /// <summary> /// To Update Project Financier /// </summary> /// <param name="objFin"></param> /// <returns></returns> public string UpdateProjectFinancier(FinancierBO objFin) { return((new ProjectDAL()).UpdateProjectFinancier(objFin)); }
/// <summary> /// To Add Project Financier /// </summary> /// <param name="objFin"></param> /// <returns></returns> public string AddProjectFinancier(FinancierBO objFin) { return((new ProjectDAL()).AddProjectFinancier(objFin)); }