/// <summary> /// 创建一个附件 /// </summary> /// <param name="validationErrors">返回的错误信息</param> /// <param name="db">数据库上下文</param> /// <param name="entity">一个附件</param> /// <returns></returns> public bool Create(ref ValidationErrors validationErrors, FILE_UPLOADER entity) { try { string err = string.Empty; // DeleteByPREPARE_SCHEMEID(entity.PREPARE_SCHEMEID,entity.CREATEPERSON); repository.Create(entity); if (!string.IsNullOrWhiteSpace(entity.STATE2) && entity.STATE2 == "已上传")//原始记录 { Langben.Report.ReportBLL re = new Langben.Report.ReportBLL(); return(re.UpdateFuJianRemark(entity.PREPARE_SCHEMEID, out err)); } //if (chuanzhi == "Y") //{ // file.STATE2 = Common.PACKAGETYPE.已上传.ToString(); //} //else //{ // file.STATE = Common.PACKAGETYPE.已上传.ToString(); //} return(true); } catch (Exception ex) { validationErrors.Add(ex.Message + "创建错误"); validationErrors.Add(ex.Source); ExceptionsHander.WriteExceptions(ex); } return(false); }
/// <summary> /// 编辑一个附件 /// </summary> /// <param name="validationErrors">返回的错误信息</param> /// <param name="entity">一个附件</param> /// <returns></returns> public bool EditField(ref ValidationErrors validationErrors, FILE_UPLOADER entity) { try { repository.EditField(db, entity); Langben.Report.ReportBLL re = new Langben.Report.ReportBLL(); string err = string.Empty; re.UpdateFuJianRemark(entity.PREPARE_SCHEMEID, out err); repository.Save(db); return(true); } catch (Exception ex) { validationErrors.Add(ex.Message); ExceptionsHander.WriteExceptions(ex); } return(false); }