示例#1
0
        /// <summary>
        /// 创建保存
        /// </summary>
        /// <returns></returns>
        public ActionResult CreateSave()
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            try
            {
                if (Request["Model"] != null)
                {
                    string json = Request["Model"].ToString();
                    JavaScriptSerializer             js     = new JavaScriptSerializer();
                    Langben.DAL.InternshipExperience entity = js.Deserialize <Langben.DAL.InternshipExperience>(json);
                    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;
                    }
                }
                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(Json(result));
        }
示例#2
0
        /// <summary>
        /// 编辑保存
        /// </summary>
        /// <returns></returns>
        public ActionResult EditSave()
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            try
            {
                if (Request["Model"] != null)
                {
                    string json = Request["Model"].ToString();
                    JavaScriptSerializer             js     = new JavaScriptSerializer();
                    Langben.DAL.InternshipExperience entity = js.Deserialize <Langben.DAL.InternshipExperience>(json);
                    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; //提示输入的数据的格式不对
                    }
                }
                else
                {
                    result.Code    = Common.ClientCode.FindNull;
                    result.Message = Suggestion.UpdateFail + "请核对输入的数据的格式";
                    //return result; //提示输入的数据的格式不对
                }
            }
            catch (Exception ex)
            {
                result.Code    = Common.ClientCode.FindNull;
                result.Message = Suggestion.UpdateFail + ex.Message;
                //return result; //提示输入的数据的格式不对
            }
            return(Json(result));
        }