Ejemplo n.º 1
0
        public ActionResult UpdataDH(ChuLi entity)
        {
            if (entity != null && ModelState.IsValid)
            {
                string returnValue = string.Empty;

                if (m_BLL.EditState(ref validationErrors, entity, "已打回"))
                {
                    LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",信息的Id为" + entity.Id, "打回"
                                                   ); //写入日志
                    return(Content("成功"));            //提示更新成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",信息的Id为" + entity.Id + "," + returnValue, "打回"
                                                   );                     //写入日志
                    return(Content(Suggestion.UpdateFail + returnValue)); //提示更新失败
                }
            }

            return(Content(Suggestion.InsertFail + ",请核对输入的数据的格式")); //提示输入的数据的格式不对
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 首次编辑
        /// </summary>
        /// <param name="id">主键</param>
        /// <returns></returns>

        public ActionResult Edit(string id)
        {
            IChuLiBLL m_BLL = new ChuLiBLL();
            ChuLi     item  = m_BLL.GetById(id);

            return(View(item));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 创建一个维修处理
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="db">数据库上下文</param>
 /// <param name="entity">一个维修处理</param>
 /// <returns></returns>
 public bool Create(ref ValidationErrors validationErrors, ChuLi entity)
 {
     try
     {
         repository.Create(entity);
         return(true);
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
     }
     return(false);
 }
Ejemplo n.º 4
0
        public ActionResult Comment(string id, ChuLi entity)
        {
            SuggestionRes response = new SuggestionRes();

            #region 各种校验
            if (!Validator.IsNumber(entity.DaFen.GetString()))
            {
                response.errorCode = 2;
                return(Json(response));
            }
            if (string.IsNullOrWhiteSpace(entity.PingLun))
            {
                response.errorCode = 4;
                return(Json(response));
            }

            #endregion

            string currentPerson = GetCurrentPerson();

            string    returnValue = string.Empty;
            IChuLiBLL m_BLL       = new ChuLiBLL();
            if (!m_BLL.Comment(ref validationErrors, entity))
            {
                if (validationErrors != null && validationErrors.Count > 0)
                {
                    validationErrors.All(a =>
                    {
                        returnValue += a.ErrorMessage;
                        return(true);
                    });
                }
                response.errorCode = 1;
                response.content   = returnValue;
                return(Json(response));
            }

            response.errorCode = 0;
            return(Json(response));
        }