public ActionResult Edit(PointsTransactionDescriptionConfig model) { string js = "<script>alert(\"保存失败 \");location='/PointsTransactionDescriptionConfig/Index';</script>"; if (!string.IsNullOrWhiteSpace(model.IntegralRuleID)) { if (PointsTransactionDescriptionConfigManager.UpdatePointsTransactionDescriptionConfig(model)) { return(RedirectToAction("Index")); } else { return(Content(js)); } } else { if (PointsTransactionDescriptionConfigManager.InsertPointsTransactionDescriptionConfig(model)) { return(RedirectToAction("Index")); } else { return(Content(js)); } } }
public static bool InsertPointsTransactionDescriptionConfig(PointsTransactionDescriptionConfig model) { const string sql = @"INSERT INTO [Tuhu_profiles].[dbo].[tbl_UserIntegralRule] ([IntegralRuleID] ,[IntegralType] ,[IntegralConditions] ,[IntegralDescribe] ,[Remark] ,[NeedeKeys] ,[IsActive] ) VALUES( NEWID() ,@IntegralType ,@IntegralConditions ,@IntegralDescribe ,@Remark ,@NeedeKeys ,@IsActive )"; var sqlParameter = new SqlParameter[] { new SqlParameter("@IntegralConditions", model.IntegralConditions ?? string.Empty), new SqlParameter("@IntegralDescribe", model.IntegralDescribe ?? string.Empty), new SqlParameter("@IntegralType", model.IntegralType), new SqlParameter("@IsActive", model.IsActive), new SqlParameter("@NeedeKeys", model.NeedeKeys ?? string.Empty), new SqlParameter("@Remark", model.Remark ?? string.Empty) }; return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameter) > 0); }
public ActionResult Edit(string id) { if (string.IsNullOrWhiteSpace(id)) { PointsTransactionDescriptionConfig model = new PointsTransactionDescriptionConfig(); model.IntegralRuleID = string.Empty; return(View(model)); } else { return(View(PointsTransactionDescriptionConfigManager.GetPointsTransactionDescriptionConfig(id))); } }
public bool InsertPointsTransactionDescriptionConfig(PointsTransactionDescriptionConfig model) { try { return(DALPointsTransactionDescriptionConfig.InsertPointsTransactionDescriptionConfig(model)); } catch (TuhuBizException) { throw; } catch (Exception ex) { var exception = new PointsTransactionDescriptionConfigException(1, "InsertPointsTransactionDescriptionConfig", ex); Logger.Log(Level.Error, exception, "InsertPointsTransactionDescriptionConfig"); throw ex; } }
public static bool UpdatePointsTransactionDescriptionConfig(PointsTransactionDescriptionConfig model) { const string sql = @"UPDATE [Tuhu_profiles].[dbo].[tbl_UserIntegralRule] SET [IntegralType]=@IntegralType ,[IntegralConditions]=@IntegralConditions ,[IntegralDescribe]=@IntegralDescribe ,[Remark]=@Remark ,[NeedeKeys]=@NeedeKeys ,[IsActive]=@IsActive WHERE IntegralRuleID=@IntegralRuleID"; var sqlParameter = new SqlParameter[] { new SqlParameter("@IntegralConditions", model.IntegralConditions ?? string.Empty), new SqlParameter("@IntegralDescribe", model.IntegralDescribe ?? string.Empty), new SqlParameter("@IntegralRuleID", model.IntegralRuleID), new SqlParameter("@IntegralType", model.IntegralType), new SqlParameter("@IsActive", model.IsActive), new SqlParameter("@NeedeKeys", model.NeedeKeys ?? string.Empty), new SqlParameter("@Remark", model.Remark ?? string.Empty) }; return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameter) > 0); }