protected void btnSave_Click(object sender, EventArgs e) { try { TrustPayItemBo objTrustPayItemBO = new TrustPayItemBo(); TrustPayItemBl objTrustPayItemBl = new TrustPayItemBl(); ApplicationResult objTrustTemplateResult = new ApplicationResult(); objTrustTemplateResult = objTrustPayItemBl.TrustPayItem_SelectAll_AscOrder(Convert.ToInt32(Session[ApplicationSession.TRUSTID])); #region RollBack Transaction Starts DatabaseTransaction.OpenConnectionTransation(); ApplicationResult objResultsDelete = new ApplicationResult(); if (objTrustTemplateResult.resultDT.Rows.Count > 0) { for (int i = 0; i < objTrustTemplateResult.resultDT.Rows.Count; i++) { objResultsDelete = objTrustPayItemBl.TrustPayItem_Delete(Convert.ToInt32(objTrustTemplateResult.resultDT.Rows[i][TrustPayItemBo.TRUSTPAYITEM_TRUSTPAYITEMID].ToString()), Convert.ToInt32(Session[ApplicationSession.USERID]), DateTime.UtcNow.AddHours(5.5).ToString()); } } foreach (GridViewRow row in gvPayItem.Rows) { if (((CheckBox)row.FindControl("CheckBoxPayItem")).Checked) { objTrustPayItemBO.PayItemID = Convert.ToInt32(row.Cells[0].Text); objTrustPayItemBO.LastModifiedDate = DateTime.UtcNow.AddHours(5.5).ToString(); objTrustPayItemBO.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]); ApplicationResult objResultsInsert = new ApplicationResult(); objTrustPayItemBO.TrustMID = Convert.ToInt32(Session[ApplicationSession.TRUSTID]); objTrustPayItemBO.CreatedDate = DateTime.UtcNow.AddHours(5.5).ToString(); objTrustPayItemBO.CreatedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]); objResultsInsert = objTrustPayItemBl.TrustPayItem_Insert(objTrustPayItemBO); if (objResultsInsert != null) { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Fees Amount Successfully Saved.');</script>"); } } } DatabaseTransaction.CommitTransation(); #endregion BindGridView(); // Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "BindClass();", true); // divLoading.Visible = false; // Response.Redirect("Class_Template.aspx"); } catch (Exception ex) { DatabaseTransaction.RollbackTransation(); logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
/// <summary> /// To Update details of TrustPayItem in tbl_TrustPayItem_M table /// Created By : Nafisa, 09-04-2015 /// Modified By : /// </summary> /// <param name="objTrustPayItemBO"></param> /// <returns></returns> public ApplicationResult TrustPayItem_Update(TrustPayItemBo objTrustPayItemBO) { try { pSqlParameter = new SqlParameter[4]; pSqlParameter[0] = new SqlParameter("@TrustPayItemID", SqlDbType.Int); pSqlParameter[0].Direction = ParameterDirection.Input; pSqlParameter[0].Value = objTrustPayItemBO.TrustPayItemID; pSqlParameter[1] = new SqlParameter("@PayItemID", SqlDbType.Int); pSqlParameter[1].Direction = ParameterDirection.Input; pSqlParameter[1].Value = objTrustPayItemBO.PayItemID; pSqlParameter[2] = new SqlParameter("@LastModifiedUserID", SqlDbType.Int); pSqlParameter[2].Direction = ParameterDirection.Input; pSqlParameter[2].Value = objTrustPayItemBO.LastModifiedUserID; pSqlParameter[3] = new SqlParameter("@LastModifiedDate", SqlDbType.VarChar); pSqlParameter[3].Direction = ParameterDirection.Input; pSqlParameter[3].Value = objTrustPayItemBO.LastModifiedDate; sSql = "usp_tbl_TrustPayItem_M_Update"; int iResult = DatabaseTransaction.ExecuteNonQuery(CommandType.StoredProcedure, sSql, pSqlParameter); if (iResult > 0) { ApplicationResult objResults = new ApplicationResult(); objResults.status = ApplicationResult.CommonStatusType.SUCCESS; return(objResults); } else { ApplicationResult objResults = new ApplicationResult(); objResults.status = ApplicationResult.CommonStatusType.FAILURE; return(objResults); } } catch (Exception ex) { throw ex; } finally { objTrustPayItemBO = null; } }