/// <summary>
        ///  编辑分类
        /// </summary>
        /// <param name="cate"></param>
        /// <returns></returns>
        public int UpdateChannelCategory(Sjqd_ChannelCategories cate)
        {
            string cmdText = string.Format(@"update Cfg_ChannelCategories set Name='{0}' where ID={1}",
                                           cate.Name.Replace("'", "''"), cate.ID);

            return(MySqlHelper.ExecuteNonQuery(StatConn, cmdText));
        }
        /// <summary>
        ///  添加分类
        /// </summary>
        /// <param name="cate"></param>
        /// <returns></returns>
        public int AddChannelCategory(Sjqd_ChannelCategories cate)
        {
            string cmdText =
                string.Format(@"insert into Cfg_ChannelCategories(Name,SoftID,InDate) values('{0}',{1},NOW())",
                              cate.Name.Replace("'", "''"), cate.SoftID);

            return(MySqlHelper.ExecuteNonQuery(StatConn, cmdText));
        }
示例#3
0
        /// <summary>
        ///     获取分类
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private Result GetCate(HttpContext context)
        {
            int cateid = Convert.ToInt32(context.Request["cateid"]);

            Sjqd_ChannelCategories result = SjqdChannelCategories_DataAccess.Instance.GetChannelCategory(cateid);

            if (result.ID != 0)
            {
                return(Result.GetSuccessedResult(result, "保存成功!", true));
            }
            else
            {
                return(Result.GetFailedResult("保存失败!"));
            }
        }
示例#4
0
        /// <summary>
        ///     编辑添加分类
        /// </summary>
        /// <returns></returns>
        private Result EditAddCate(HttpContext context)
        {
            var    loginService = new URLoginService();
            int    softid       = Convert.ToInt32(context.Request["softs"]);
            string catename     = context.Request["catename"];
            int    cateid       = Convert.ToInt32(context.Request["cateid"]);
            var    cate         = new Sjqd_ChannelCategories();

            cate.SoftID = softid;
            string oldName = cate.Name;

            cate.Name   = catename;
            cate.ID     = cateid;
            cate.InDate = DateTime.Now;
            int result = cate.ID == 0
                             ? SjqdChannelCategories_DataAccess.Instance.AddChannelCategory(cate)
                             : SjqdChannelCategories_DataAccess.Instance.UpdateChannelCategory(cate);

            if (result > 0)
            {
                if (cate.ID == 0)
                {
                    loginService.AddLog("AddChannelCategory",
                                        string.Format("添加渠道分类(SoftID={0},Name={1})", softid, cate.Name));
                }
                else
                {
                    loginService.AddLog("UpdateChannelCategory",
                                        string.Format("修改渠道分类(ID={0},SoftID={1},Name={2})", cate.ID, softid, cate.Name));
                }
                return(Result.GetSuccessedResult("", "保存成功!", true));
            }
            else
            {
                return(Result.GetFailedResult("保存失败!"));
            }
        }