public ActionResult Edit(PersonalCenterFunctionConfig model) { string js = "<script>alert(\"保存失败 \");location='/PersonalCenterFunctionConfig/Index';</script>"; if (model.Id != 0) { if (PersonalCenterFunctionConfigManager.UpdatePersonalCenterFunctionConfig(model)) { return(RedirectToAction("Index")); } else { return(Content(js)); } } else { if (PersonalCenterFunctionConfigManager.InsertPersonalCenterFunctionConfig(model)) { return(RedirectToAction("Index")); } else { return(Content(js)); } } }
public static bool UpdatePersonalCenterFunctionConfig(PersonalCenterFunctionConfig model) { const string sql = @"UPDATE Configuration..PersonalCenterFunctionConfig SET Icon=@Icon ,Title=@Title ,Sort=@Sort ,Status=@Status ,Highlight=@Highlight ,CreateTime=GETDATE() ,DisplayName=@DisplayName ,AppLink=@AppLink ,IOSStartVersions=@IOSStartVersions ,IOSEndVersions=@IOSEndVersions ,AndroidStartVersions=@AndroidStartVersions ,AndroidEndVersions=@AndroidEndVersions WHERE Id=@Id"; var sqlParameter = new SqlParameter[] { new SqlParameter("@Highlight", model.Highlight), new SqlParameter("@Id", model.Id), new SqlParameter("@Icon", model.Icon ?? string.Empty), new SqlParameter("@Sort", model.Sort), new SqlParameter("@Status", model.Status), new SqlParameter("@Title", model.Title ?? string.Empty), new SqlParameter("@DisplayName", model.DisplayName ?? string.Empty), new SqlParameter("@AppLink", model.AppLink ?? string.Empty), new SqlParameter("@IOSEndVersions", model.IOSEndVersions ?? string.Empty), new SqlParameter("@IOSStartVersions", model.IOSStartVersions ?? string.Empty), new SqlParameter("@AndroidEndVersions", model.AndroidEndVersions ?? string.Empty), new SqlParameter("@AndroidStartVersions", model.AndroidStartVersions ?? string.Empty) }; return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameter) > 0); }
public ActionResult Edit(int id = 0) { if (id == 0) { PersonalCenterFunctionConfig model = new PersonalCenterFunctionConfig(); return(View(model)); } else { return(View(PersonalCenterFunctionConfigManager.GetPersonalCenterFunctionConfig(id))); } }
public ActionResult Index(PersonalCenterFunctionConfig model, int pageIndex = 1, int pageSize = 10) { int count = 0; var lists = PersonalCenterFunctionConfigManager.GetPersonalCenterFunctionConfigList(model, pageSize, pageIndex, out count); var list = new OutData <List <PersonalCenterFunctionConfig>, int>(lists, count); var pager = new PagerModel(pageIndex, pageSize) { TotalItem = count }; return(View(new ListModel <PersonalCenterFunctionConfig>(list.ReturnValue, pager))); }
public static bool InsertPersonalCenterFunctionConfig(PersonalCenterFunctionConfig model) { const string sql = @"INSERT INTO Configuration..PersonalCenterFunctionConfig ( [Icon] ,[Title] ,[Sort] ,[Status] ,[Highlight] ,[CreateTime] ,DisplayName ,[AppLink] ,[IOSStartVersions] ,[IOSEndVersions] ,[AndroidStartVersions] ,[AndroidEndVersions] ) VALUES( @Icon ,@Title ,@Sort ,@Status ,@Highlight ,GETDATE() ,@DisplayName ,@AppLink ,@IOSStartVersions ,@IOSEndVersions ,@AndroidStartVersions ,@AndroidEndVersions )"; var sqlParameter = new SqlParameter[] { new SqlParameter("@Highlight", model.Highlight), new SqlParameter("@Icon", model.Icon ?? string.Empty), new SqlParameter("@Sort", model.Sort), new SqlParameter("@Status", model.Status), new SqlParameter("@Title", model.Title ?? string.Empty), new SqlParameter("@DisplayName", model.DisplayName ?? string.Empty), new SqlParameter("@AppLink", model.AppLink ?? string.Empty), new SqlParameter("@IOSEndVersions", model.IOSEndVersions ?? string.Empty), new SqlParameter("@IOSStartVersions", model.IOSStartVersions ?? string.Empty), new SqlParameter("@AndroidEndVersions", model.AndroidEndVersions ?? string.Empty), new SqlParameter("@AndroidStartVersions", model.AndroidStartVersions ?? string.Empty) }; return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql, sqlParameter) > 0); }
public bool InsertPersonalCenterFunctionConfig(PersonalCenterFunctionConfig model) { try { return(DALPersonalCenterFunctionConfig.InsertPersonalCenterFunctionConfig(model)); } catch (TuhuBizException) { throw; } catch (Exception ex) { var exception = new PersonalCenterFunctionConfigException(1, "InsertPersonalCenterFunctionConfig", ex); Logger.Log(Level.Error, exception, "InsertPersonalCenterFunctionConfig"); throw ex; } }
public List <PersonalCenterFunctionConfig> GetPersonalCenterFunctionConfigList(PersonalCenterFunctionConfig sqlStr, int pageSize, int pageIndex, out int recordCount) { try { return(DALPersonalCenterFunctionConfig.GetPersonalCenterFunctionConfigList(sqlStr, pageSize, pageIndex, out recordCount)); } catch (TuhuBizException) { throw; } catch (Exception ex) { var exception = new PersonalCenterFunctionConfigException(1, "GetPersonalCenterFunctionConfigList", ex); Logger.Log(Level.Error, exception, "GetPersonalCenterFunctionConfigList"); throw ex; } }
public static List <PersonalCenterFunctionConfig> GetPersonalCenterFunctionConfigList(PersonalCenterFunctionConfig sqlStr, int pageSize, int pageIndex, out int recordCount) { string sql = @" SELECT * FROM ( SELECT ROW_NUMBER() OVER ( ORDER BY CreateTime DESC ) AS ROWNUMBER , [Id] , [Icon] , [Title] , [Sort] , [Status] , [Highlight] , [CreateTime] , DisplayName , [AppLink], [IOSStartVersions], [IOSEndVersions], [AndroidStartVersions], [AndroidEndVersions] FROM [Configuration].[dbo].[PersonalCenterFunctionConfig] WITH ( NOLOCK ) WHERE 1 = 1 ) AS PG WHERE PG.ROWNUMBER BETWEEN STR(( @PageIndex - 1 ) * @PageSize + 1) AND STR(@PageIndex * @PageSize) "; string sqlCount = @"SELECT COUNT(1) FROM [Configuration].[dbo].[PersonalCenterFunctionConfig] WITH (NOLOCK) WHERE 1=1 "; recordCount = (int)SqlHelper.ExecuteScalar(connOnRead, CommandType.Text, sqlCount); var sqlParameters = new SqlParameter[] { new SqlParameter("@PageSize", pageSize), new SqlParameter("@PageIndex", pageIndex) }; return(SqlHelper.ExecuteDataTable(connOnRead, CommandType.Text, sql, sqlParameters).ConvertTo <PersonalCenterFunctionConfig>().ToList()); }