/// <summary> /// /// </summary> /// <param name="AssociateCategory"></param> /// <returns></returns> public bool InsertAdviserAssociateCategory(AssociateCategoryVo AssociateCategory) { bool result = false; try { AdviserAssociateCategorySetupDao AdviserAssociateCategorySetup = new AdviserAssociateCategorySetupDao(); result = AdviserAssociateCategorySetup.InsertAdviserAssociateCategory(AssociateCategory); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "AdviserAssociateCategorySetupBo.cs:InsertAdviserAssociateCategory()"); object[] objects = new object[1]; objects[0] = AssociateCategory; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(result); }
protected void btnSave_Click(object sender, EventArgs e) { AssociateCategoryVo associatecategory = new AssociateCategoryVo(); AdviserAssociateCategorySetupBo AdviserAssociateCategorySetup = new AdviserAssociateCategorySetupBo(); associatecategory.AdviserId = adviserVo.advisorId; if (gvAssocCatSetUpBounded.Rows.Count > 0) { foreach (GridViewRow dr in gvAssocCatSetUpBounded.Rows) { associatecategory.AssociateCategoryCode = ((TextBox)dr.FindControl("TextBox1")).Text; associatecategory.AssociateCategoryName = ((TextBox)dr.FindControl("TextBox2")).Text; if (gvAssocCatSetUpBounded.DataKeys[dr.RowIndex].Value != System.DBNull.Value) { associatecategory.AssociateCategoryId = Convert.ToInt32(gvAssocCatSetUpBounded.DataKeys[dr.RowIndex].Value); } else { associatecategory.AssociateCategoryId = 0; associatecategory.CreatedBy = userVo.UserId; associatecategory.CreatedOn = DateTime.Now; } associatecategory.ModifiedBy = userVo.UserId; associatecategory.Modifiedon = DateTime.Now; bool result = AdviserAssociateCategorySetup.UpdateAdviserAssociateCategory(associatecategory); } FillGrid(); } else if (gvAssocCatSetUp.Rows.Count > 0) { foreach (GridViewRow dr in gvAssocCatSetUp.Rows) { associatecategory.AssociateCategoryCode = ((TextBox)dr.FindControl("TextBox1")).Text; associatecategory.AssociateCategoryName = ((TextBox)dr.FindControl("TextBox2")).Text; associatecategory.CreatedBy = userVo.UserId; associatecategory.CreatedOn = DateTime.Now; associatecategory.ModifiedBy = userVo.UserId; associatecategory.Modifiedon = DateTime.Now; bool result = AdviserAssociateCategorySetup.InsertAdviserAssociateCategory(associatecategory); } Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('AdviserAssociateCategorySetup','login');", true); //FillGrid(); } }
public bool InsertAdviserAssociateCategory(AssociateCategoryVo AssociateCategory) { bool result = false; Database db; DbCommand cmdInsertAdvAssocCat; try { db = DatabaseFactory.CreateDatabase("wealtherp"); cmdInsertAdvAssocCat = db.GetStoredProcCommand("SP_CreateAdviserAssociateCategory"); db.AddInParameter(cmdInsertAdvAssocCat, "@A_AdviserId ", DbType.Int32, AssociateCategory.AdviserId); db.AddInParameter(cmdInsertAdvAssocCat, "@AAC_AssociateCategoryCode", DbType.String, AssociateCategory.AssociateCategoryCode); db.AddInParameter(cmdInsertAdvAssocCat, "@AAC_AssociateCategoryName", DbType.String, AssociateCategory.AssociateCategoryName); db.AddInParameter(cmdInsertAdvAssocCat, "@AAC_CreatedBy", DbType.Int32, AssociateCategory.CreatedBy); db.AddInParameter(cmdInsertAdvAssocCat, "@AAC_CreatedOn", DbType.DateTime, AssociateCategory.CreatedOn); db.AddInParameter(cmdInsertAdvAssocCat, "@AAC_ModifiedBy", DbType.Int32, AssociateCategory.ModifiedBy); db.AddInParameter(cmdInsertAdvAssocCat, "@AAC_ModifiedOn", DbType.DateTime, AssociateCategory.Modifiedon); db.ExecuteNonQuery(cmdInsertAdvAssocCat); result = true; } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "AdviserAssociateCategorySetupDao.cs:InsertAdviserAssociateCategory()"); object[] objects = new object[1]; objects[0] = AssociateCategory; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(result); }