/// <summary> /// 数据绑定 /// </summary> protected void BindData() { if (IntParam > 0) { RegisterGive quest = FacadeManage.aideAccountsFacade.GetRegisterGiveInfo(IntParam); if (quest != null) { CtrlHelper.SetText(txtScoreCount, FacadeManage.ConversionMoneyToShow(quest.ScoreCount.ToString()).ToString()); CtrlHelper.SetText(txtDiamondCount, quest.DiamondCount.ToString()); Dropplatform.SelectedValue = quest.PlatformType.ToString(); } } }
/// <summary> /// 数据保存 /// </summary> protected void btnSave_Click(object sender, EventArgs e) { RegisterGive quest = new RegisterGive() { ScoreCount = Convert.ToInt32(txtScoreCount.Text.Trim()), DiamondCount = Convert.ToInt32(txtDiamondCount.Text.Trim()), PlatformType = Convert.ToInt32(Dropplatform.SelectedValue.ToString()) }; if (IntParam > 0) { if (!AuthUserOperationPermission(Permission.Edit)) { return; } quest.ConfigID = IntParam; } else { if (!AuthUserOperationPermission(Permission.Add)) { return; } RegisterGive info = FacadeManage.aideAccountsFacade.GetRegisterGiveInfoByPlatformType(Convert.ToInt32(Dropplatform.SelectedValue.ToString())); if (info != null) { ShowError("已存在平台注册"); return; } } quest.ScoreCount = Convert.ToInt32(txtScoreCount.Text.Trim()) * 1000; quest.DiamondCount = Convert.ToInt32(txtDiamondCount.Text.Trim()); quest.PlatformType = Convert.ToInt32(Dropplatform.SelectedValue.ToString()); int result = FacadeManage.aideAccountsFacade.SaveRegisterGiveInfo(quest); if (result > 0) { ShowInfo("注册赠送操作成功", "RegisterGiveList.aspx", 1000); } else { ShowError("注册赠送操作失败"); } }
/// <summary> /// 保存注册赠送(新增、修改)通用 /// </summary> /// <param name="quest"></param> /// <returns></returns> public int SaveRegisterGiveInfo(RegisterGive quest) { var parm = new List <DbParameter>() { Database.MakeInParam("ScoreCount", quest.ScoreCount), Database.MakeInParam("DiamondCount", quest.DiamondCount), Database.MakeInParam("PlatformType", quest.PlatformType) }; if (quest.ConfigID > 0) { parm.Add(Database.MakeInParam("ConfigID", quest.ConfigID)); } const string sqlInsert = " INSERT DBO.[RegisterGive] (ScoreCount,DiamondCount,PlatformType) VALUES (@ScoreCount,@DiamondCount,@PlatformType) "; const string sqlUpdate = " UPDATE DBO.[RegisterGive] SET ScoreCount=@ScoreCount,DiamondCount=@DiamondCount,PlatformType=@PlatformType WHERE ConfigID=@ConfigID "; return(Database.ExecuteNonQuery(CommandType.Text, quest.ConfigID > 0 ? sqlUpdate : sqlInsert, parm.ToArray())); }
/// <summary> /// 保存注册赠送(新增、修改)通用 /// </summary> /// <param name="quest"></param> /// <returns></returns> public int SaveRegisterGiveInfo(RegisterGive quest) { return(aideAccountsData.SaveRegisterGiveInfo(quest)); }