Esempio n. 1
0
        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.ITAbility entity = js.Deserialize <Langben.DAL.ITAbility>(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 + ",IT技能爱好的信息的Id为" + entity.Id, "IT技能爱好"
                                                           );//写入日志
                            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 + ",IT技能爱好的信息," + returnValue, "IT技能爱好"
                                                           );//写入日志
                            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 result;
            }
            return(Json(result));
            //return result;
        }
Esempio n. 2
0
        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.ITAbility entity = js.Deserialize <Langben.DAL.ITAbility>(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 + ",IT技能爱好信息的Id为" + entity.Id, "IT技能爱好"
                                                           );//写入日志
                            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 + ",IT技能爱好信息的Id为" + entity.Id + "," + returnValue, "IT技能爱好");//写入日志
                            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));
        }