public JsonResult boardcopy(string boardno)
        {
            try
            {
                Models.api_databoard board = boardDbHelper.GetAll(u => u.boardno == boardno, u => u.id).FirstOrDefault();
                if (board != null)
                {
                    string newboardno = Guid.NewGuid().ToString("N");
                    //执行存储过程; 复制;
                    string         sql  = "exec pr_app_databoard_copy @boardno,@newboardno,@userid";
                    SqlParameter[] pars = new SqlParameter[]
                    {
                        new SqlParameter("@boardno", board.boardno),
                        new SqlParameter("@newboardno", newboardno),
                        new SqlParameter("@userid", ""),
                    };
                    DBHelper.ExecuteNonQuery(sql, pars);


                    return(Json(new { access = true, result = board, msg = newboardno }));
                }
                else
                {
                    return(Json(new { access = false, msg = "未找到[" + boardno + "]对应的记录", result = board }));
                }
                // return Json(new { access = true });
            }
            catch (Exception exp)
            {
                return(Json(new { access = false, msg = exp.Message }));
            }
        }
 public JsonResult boardSave(Models.api_databoard entity)
 {
     try
     {
         if (entity.id <= 0)
         {
             entity.mod_man  = "";
             entity.mod_date = DateTime.Now;
             entity.cre_date = DateTime.Now;
             entity.cre_man  = "";
             entity.boardno  = Guid.NewGuid().ToString();
             boardDbHelper.Insert(entity);
             boardDbHelper.SaveChanges();
             //dbhelper.SaveChanges();
         }
         else
         {
             entity.mod_date = DateTime.Now;
             boardDbHelper.Update(entity);
             boardDbHelper.SaveChanges();
         }
         return(Json(new { access = true, result = entity }));
     }
     catch (Exception exp)
     {
         return(Json(new { access = false, msg = exp.Message }));
     }
 }
        /// <summary>
        /// 新增/修改看板定义对像
        /// </summary>
        /// <param name="api_Databoard"></param>
        /// <returns></returns>
        public JsonResult DRBAdd(Models.api_databoard api_Databoard)
        {
            api_Databoard.mod_date = DateTime.Now;
            if (api_Databoard.id > 0)
            {
                boardDbHelper.Update(api_Databoard);
            }
            else
            {
                api_Databoard.mod_man  = "";
                api_Databoard.cre_date = DateTime.Now;
                api_Databoard.cre_man  = "";
                api_Databoard.boardno  = Guid.NewGuid().ToString();
                boardDbHelper.Insert(api_Databoard);
            }
            var m = boardDbHelper.SaveChanges();

            if (m > 0)
            {
                return(Json(new
                {
                    success = true,
                    message = "保存成功",
                    data = m
                }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new
            {
                success = false,
                message = "保存失败"
            }, JsonRequestBehavior.AllowGet));
        }
 //编辑
 public ActionResult Edit(int id)
 {
     Models.api_databoard item = boardDbHelper.FindById(id);
     //Models.Model_ApiItem entity = new Models.Model_ApiItem();
     if (item == null)
     {
         //新增;
         item           = new Models.api_databoard();
         item.boardno   = Guid.NewGuid().ToString("N");
         ViewBag.entity = item;
     }
     else
     {
         //修改
         ViewBag.entity = item;
     }
     return(View());//
 }
 public JsonResult boardGet(string boardno)
 {
     try
     {
         Models.api_databoard board = boardDbHelper.GetAll(u => u.boardno == boardno, u => u.id).FirstOrDefault();
         if (board != null)
         {
             return(Json(new { access = true, msg = "", result = board }));
         }
         else
         {
             return(Json(new { access = false, msg = "未找到[" + boardno + "]对应的记录", result = board }));
         }
     }
     catch (Exception exp)
     {
         return(Json(new { access = false, msg = exp.Message }));
     }
 }
        public JsonResult boardpub(string boardno)
        {
            try
            {
                Models.api_databoard board = boardDbHelper.GetAll(u => u.boardno == boardno, u => u.id).FirstOrDefault();
                if (board != null)
                {
                    //
                    if (board.pubno == null || board.pubno == "")
                    {
                        //
                        var pubo = Guid.NewGuid().ToString();;

                        board.pubno = pubo;
                        boardDbHelper.Update(board);
                        boardDbHelper.SaveChanges();
                    }


                    //执行存储过程; 发布;
                    string         sql  = "exec pr_app_databoard_pub @boardno,@userid";
                    SqlParameter[] pars = new SqlParameter[]
                    {
                        new SqlParameter("@boardno", board.boardno),
                        new SqlParameter("@userid", ""),
                    };
                    DBHelper.ExecuteNonQuery(sql, pars);


                    return(Json(new { access = true, result = board }));
                }
                else
                {
                    return(Json(new { access = false, msg = "未找到[" + boardno + "]对应的记录", result = board }));
                }
                // return Json(new { access = true });
            }
            catch (Exception exp)
            {
                return(Json(new { access = false, msg = exp.Message }));
            }
        }
 public JsonResult boardSavconfig(string boardno, string mainoption)
 {
     try
     {
         Models.api_databoard board = boardDbHelper.GetAll(u => u.boardno == boardno, u => u.id).FirstOrDefault();
         if (board != null)
         {
             board.mainoption = mainoption;
             boardDbHelper.Update(board);
             boardDbHelper.SaveChanges();
             return(Json(new { access = true, result = board }));
         }
         else
         {
             return(Json(new { access = false, msg = "未找到[" + boardno + "]对应的记录", result = board }));
         }
     }
     catch (Exception exp)
     {
         return(Json(new { access = false, msg = exp.Message }));
     }
 }
        public JsonResult boardDelete(int id)
        {
            try
            {
                Models.api_databoard board = boardDbHelper.FindById(id);//.GetAll(u => u.itemno == itemno, u => u.id).FirstOrDefault();
                if (board != null)
                {
                    boardDbHelper.Delete(board);
                    boardDbHelper.SaveChanges();
                    return(Json(new { access = true, msg = "" }));
                }
                else
                {
                    return(Json(new { access = false, msg = "未找到[" + id + "]对应的记录", result = board }));
                }

                // return Json(new { access = true });
            }
            catch (Exception exp)
            {
                return(Json(new { access = false, msg = exp.Message }));
            }
        }