Exemple #1
0
        public ActionResult CreateSave(Langben.DAL.DegreeSchool entity)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            try
            {
                if (entity != null && ModelState.IsValid)
                {
                    entity.ResumeId = CurrentResumeId;

                    entity.Id           = Result.GetNewId();
                    entity.CreateTime   = DateTime.Now;
                    entity.CreatePerson = CurrentPerson;
                    entity.State        = StateEnums.QY;
                    entity.Sort         = 0;
                    entity.UpdatePerson = CurrentPerson;
                    entity.UpdateTime   = entity.CreateTime;

                    string returnValue = string.Empty;
                    if (m_BLL.Create(ref validationErrors, entity))
                    {
                        LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",学历学校的信息的Id为" + entity.Id, "学历学校"
                                                       );//写入日志
                        result.Code    = Common.ClientCode.Succeed;
                        result.Message = Suggestion.InsertSucceed;
                        // return result; //提示创建成功
                    }
                    else
                    {
                        if (validationErrors != null && validationErrors.Count > 0)
                        {
                            validationErrors.All(a =>
                            {
                                returnValue += a.ErrorMessage;
                                return(true);
                            });
                        }
                        LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",学历学校的信息," + returnValue, "学历学校"
                                                       );//写入日志
                        result.Code    = Common.ClientCode.Fail;
                        result.Message = Suggestion.InsertFail + returnValue;
                        // return result; //提示插入失败
                    }
                }
                else
                {
                    result.Code    = Common.ClientCode.FindNull;
                    result.Message = Suggestion.InsertFail + ",数据格式有误"; //提示输入的数据的格式不对
                    //return result;
                }
            }
            catch (Exception ex)
            {
                result.Code    = Common.ClientCode.FindNull;
                result.Message = Suggestion.InsertFail + "," + ex.Message; //提示输入的数据的格式不对
                                                                           //return result;
            }
            return(Json(result));
            //return result;
        }
Exemple #2
0
        /// <summary>
        /// 编辑保存
        /// </summary>
        /// <returns></returns>
        public ActionResult EditSave(Langben.DAL.DegreeSchool entity)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();

            if (entity != null && ModelState.IsValid)
            {   //数据校验
                entity.UpdateTime   = DateTime.Now;
                entity.UpdatePerson = CurrentPerson;

                string returnValue = string.Empty;
                if (m_BLL.Edit(ref validationErrors, entity))
                {
                    LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",学历学校信息的Id为" + entity.Id, "学历学校"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Succeed;
                    result.Message = Suggestion.UpdateSucceed;
                    //return result; //提示更新成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",学历学校信息的Id为" + entity.Id + "," + returnValue, "学历学校");//写入日志
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = Suggestion.UpdateFail + returnValue;
                    //return result; //提示更新失败
                }
            }
            else
            {
                result.Code    = Common.ClientCode.FindNull;
                result.Message = Suggestion.UpdateFail + "请核对输入的数据的格式";
                //return result; //提示输入的数据的格式不对
            }
            return(Json(result));
        }