/// <summary> /// 创建一个费用_费用表其他费用 /// </summary> /// <param name="validationErrors">返回的错误信息</param> /// <param name="db">数据库上下文</param> /// <param name="entity">一个费用_费用表其他费用</param> /// <returns></returns> public bool Create(ref ValidationErrors validationErrors, COST_CostTableOther entity) { try { repository.Create(entity); return(true); } catch (Exception ex) { validationErrors.Add(ex.Message); ExceptionsHander.WriteExceptions(ex); } return(false); }
/// <summary> /// 创建 /// </summary> /// <param name="entity">实体对象</param> /// <returns></returns> public Common.ClientResult.Result Post([FromBody] COST_CostTableOther entity) { Common.ClientResult.Result result = new Common.ClientResult.Result(); if (entity != null && ModelState.IsValid) { //string currentPerson = GetCurrentPerson(); //entity.CreateTime = DateTime.Now; //entity.CreatePerson = currentPerson; 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); //提示插入失败 } } result.Code = Common.ClientCode.FindNull; result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对 return(result); }
/// <summary> /// 异步加载数据 /// </summary> /// <param name="getParam"></param> /// <returns></returns> //public Common.ClientResult.DataResult PostData([FromBody]GetDataParam getParam) //{ // int total = 0; // List<COST_CostTableOther> queryData = m_BLL.GetByParam(getParam.id, getParam.page, getParam.rows, getParam.order, getParam.sort, getParam.search, ref total); // var data = new Common.ClientResult.DataResult // { // total = total, // rows = queryData.Select(s => new // { // ID = s.ID // ,COST_CostTable_ID = s.COST_CostTable_ID // ,PaymentStyle = s.PaymentStyle // ,ChargeCost = s.ChargeCost // ,CostType = s.CostType // ,Employee_ID = s.Employee_ID // ,EmployName = s.EmployName // ,CertificateType = s.CertificateType // ,CertificateNumber = s.CertificateNumber // ,Remark = s.Remark // ,Status = s.Status // ,ParentID = s.ParentID // ,CRM_Company_ID = s.CRM_Company_ID // ,CreateTime = s.CreateTime // ,CreateUserID = s.CreateUserID // ,CreateUserName = s.CreateUserName // ,BranchID = s.BranchID // }) // }; // return data; //} /// <summary> /// 根据ID获取数据模型 /// </summary> /// <param name="id">编号</param> /// <returns></returns> public COST_CostTableOther Get(int id) { COST_CostTableOther item = m_BLL.GetById(id); return(item); }
/// <summary> /// 创建一个费用_费用表其他费用明细 /// </summary> /// <param name="db">数据库上下文</param> /// <param name="entity">一个费用_费用表其他费用明细</param> /// <returns></returns> public void Create(SysEntities db, COST_CostTableOther entity) { repository.Create(db, entity); }