Ejemplo n.º 1
0
        public int UpdateCategory(XXF.Db.DbConn PubConn, Models.DbModels.appcategory model)
        {
            model.categorydesc = model.categorydesc ?? "";
            string sql = "update  appcategory set categorytitle=@categorytitle,categorydesc=@categorydesc where  apptype=@apptype and categoryid=@categoryid";

            XXF.Db.SimpleProcedureParameter para = new XXF.Db.SimpleProcedureParameter();
            para.Add("@apptype", model.apptype);
            para.Add("@categoryid", model.categoryid);
            para.Add("@categorytitle", model.categorytitle);
            para.Add("@categorydesc", model.categorydesc);
            int r = PubConn.ExecuteSql(sql, para.ToParameters());

            return(r);
        }
Ejemplo n.º 2
0
 public JsonResult Edit(Models.DbModels.appcategory model)
 {
     if (string.IsNullOrEmpty(model.categorytitle))
     {
         return(Json(new { code = -1, msg = "分类名称不能为空" }));
     }
     using (XXF.Db.DbConn PubConn = XXF.Db.DbConfig.CreateConn())
     {
         PubConn.Open();
         try
         {
             if (model.categoryid < 1)//添加
             {
                 int r = Models.AppcategoryDal.Instance.Addcategory(PubConn, model);
                 if (r > 0)
                 {
                     return(Json(new { code = 1, response = model }));
                 }
                 else
                 {
                     return(Json(new { code = -1, msg = "新增失败,原因不明" }));
                 }
             }
             else//修改
             {
                 int r = Models.AppcategoryDal.Instance.UpdateCategory(PubConn, model);
                 if (r > 0)
                 {
                     return(Json(new { code = 1, response = model }));
                 }
                 else
                 {
                     return(Json(new { code = -1, msg = "修改失败,原因不明" }));
                 }
             }
         }
         catch (Exception ex)
         {
             return(Json(new { code = -1, msg = ex.Message }));
         }
         finally
         {
             Models.DbModels.certcenterlog log = new Models.DbModels.certcenterlog(this);
             log.opecontent = "修改应用分类";
             Models.CertCenterLogDal.Instance.Add(PubConn, log);
         }
     }
 }
Ejemplo n.º 3
0
        public int Addcategory(XXF.Db.DbConn PubConn, Models.DbModels.appcategory model)
        {
            model.categorydesc = model.categorydesc ?? "";
            string getcatid = "select isnull(max(categoryid),0)+1 from appcategory where apptype=" + model.apptype;

            model.categoryid = Convert.ToInt32(PubConn.ExecuteScalar(getcatid, null));
            string addsql = "insert into appcategory(apptype,categoryid,categorytitle,categorydesc) values(@apptype,@categoryid,@categorytitle,@categorydesc)";

            XXF.Db.SimpleProcedureParameter para = new XXF.Db.SimpleProcedureParameter();
            para.Add("@apptype", model.apptype);
            para.Add("@categoryid", model.categoryid);
            para.Add("@categorytitle", model.categorytitle);
            para.Add("@categorydesc", model.categorydesc);
            int r = PubConn.ExecuteSql(addsql, para.ToParameters());

            return(r);
        }
Ejemplo n.º 4
0
        public JsonResult GetApiCategoryInfo(int apptype, int categoryid)
        {
            using (XXF.Db.DbConn PubConn = XXF.Db.DbConfig.CreateConn())
            {
                PubConn.Open();

                Models.DbModels.appcategory model = Models.AppcategoryDal.Instance.GetCategoryInfo(PubConn, apptype, categoryid);

                if (model == null)
                {
                    return(Json(new CertComm.ServerResult()
                    {
                        code = -1, msg = "无查项"
                    }));
                }
                return(Json(new CertComm.ServerResult()
                {
                    code = 1, msg = "", response = model
                }));
            }
        }