/// <summary> /// 插入配置信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public int AddConfigInfo(SysAdminConfigsModel model) { int rowcount = 0; string sqltxt = @"INSERT INTO dbo.SysAdminConfigs ( ConfigName , ConfigFID , ConfigValue , ConfigRemark , AddTime , ConfigStatus, IsAdmin ) VALUES ( @ConfigName , @ConfigFID , @ConfigValue , @ConfigRemark , GETDATE() , @ConfigStatus, @IsAdmin )"; SqlParameter[] paramter = { new SqlParameter("@ConfigName", model.ConfigName), new SqlParameter("@ConfigFID", model.ConfigFID), new SqlParameter("@ConfigValue", model.ConfigValue), new SqlParameter("@ConfigRemark", model.ConfigRemark), new SqlParameter("@ConfigStatus", model.ConfigStatus), new SqlParameter("@IsAdmin", model.IsAdmin) }; rowcount = helper.ExecuteSql(sqltxt, paramter); return(rowcount); }
/// <summary> /// 得到顶级配置项目 /// </summary> /// <returns></returns> public List <SysAdminConfigsModel> GetFirstConfigs() { List <SysAdminConfigsModel> list = new List <SysAdminConfigsModel>(); string sqltxt = @"SELECT ID , ConfigName , ConfigFID , ConfigValue , ConfigRemark , AddTime , ConfigStatus , CASE ConfigStatus WHEN 1 THEN '启用' ELSE '禁用' END AS ConfigStatusName FROM dbo.SysAdminConfigs WITH(NOLOCK) WHERE ConfigFID=0 "; DataTable dt = helper.Query(sqltxt).Tables[0]; foreach (DataRow item in dt.Rows) { SysAdminConfigsModel model = new SysAdminConfigsModel(); model.AddTime = DateTime.Parse(item["AddTime"].ToString()); model.ConfigFID = int.Parse(item["ConfigFID"].ToString()); model.ConfigName = item["ConfigName"].ToString(); model.ConfigRemark = item["ConfigRemark"].ToString(); model.ConfigStatus = int.Parse(item["ConfigStatus"].ToString()); model.ConfigStatusName = item["ConfigStatusName"].ToString(); model.ConfigValue = item["ConfigValue"].ToString(); model.ID = int.Parse(item["ID"].ToString()); list.Add(model); } return(list); }
public ActionResult UpdateConfigs(SysAdminConfigsModel UConfig) { if (UConfig != null) { int rowcount = configbll.UpdateConfigs(UConfig); } return(RedirectToAction("SysConfigs", "SysSettings", new { area = "AdminArea" })); }
public ActionResult AddSysConfigs(SysAdminConfigsModel AConfig) { if (AConfig != null) { int rowcount = configbll.AddConfigInfo(AConfig); } return(RedirectToAction("SysConfigs", "SysSettings", new { area = "AdminArea" })); }
/// <summary> /// 得到一个对象实体 /// </summary> public SysAdminConfigsModel GetSingleSysAdminConfigsModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select ID, ConfigName, ConfigFID, ConfigValue, ConfigRemark, AddTime, ConfigStatus "); strSql.Append(" from SysAdminConfigs "); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int) }; parameters[0].Value = ID; SysAdminConfigsModel model = new SysAdminConfigsModel(); DataSet ds = helper.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ID"].ToString() != "") { model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString()); } model.ConfigName = ds.Tables[0].Rows[0]["ConfigName"].ToString(); if (ds.Tables[0].Rows[0]["ConfigFID"].ToString() != "") { model.ConfigFID = int.Parse(ds.Tables[0].Rows[0]["ConfigFID"].ToString()); } model.ConfigValue = ds.Tables[0].Rows[0]["ConfigValue"].ToString(); model.ConfigRemark = ds.Tables[0].Rows[0]["ConfigRemark"].ToString(); if (ds.Tables[0].Rows[0]["AddTime"].ToString() != "") { model.AddTime = DateTime.Parse(ds.Tables[0].Rows[0]["AddTime"].ToString()); } if (ds.Tables[0].Rows[0]["ConfigStatus"].ToString() != "") { model.ConfigStatus = int.Parse(ds.Tables[0].Rows[0]["ConfigStatus"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 修改配置信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public int UpdateConfigs(SysAdminConfigsModel model) { int rowcount = 0; string sqltxt = @"UPDATE dbo.SysAdminConfigs SET ConfigName = @ConfigName , ConfigFID = @ConfigFID , ConfigValue = @ConfigValue , ConfigRemark = @ConfigRemark , ConfigStatus = @ConfigStatus WHERE ID = @id"; SqlParameter[] paramter = { new SqlParameter("@ConfigName", model.ConfigName), new SqlParameter("@ConfigFID", model.ConfigFID), new SqlParameter("@ConfigValue", model.ConfigValue), new SqlParameter("@ConfigRemark", model.ConfigRemark), new SqlParameter("@ConfigStatus", model.ConfigStatus), new SqlParameter("@id", model.ID) }; rowcount = helper.ExecuteSql(sqltxt, paramter); return(rowcount); }
/// <summary> /// 修改配置信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public int UpdateConfigs(SysAdminConfigsModel model) { return(dal.UpdateConfigs(model)); }
/// <summary> /// 插入配置信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public int AddConfigInfo(SysAdminConfigsModel model) { return(dal.AddConfigInfo(model)); }