/// <summary> /// 保存印章信息(新增/编辑) /// </summary> /// <param name="keyValue">主键</param> /// <param name="stampEntity">实体</param> public void SaveEntity(string keyValue, LR_StampManageEntity entity) { try { //如果keyValue值为空或者null,表示,当前的操作是添加,否则是修改 if (string.IsNullOrEmpty(keyValue)) { entity.Create(); this.BaseRepository().Insert(entity); } else { entity.Modify(keyValue); this.BaseRepository().Update(entity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
/// <summary> /// 获取图片 /// </summary> /// <param name="keyValue">主键</param> public void GetImg(string keyValue) { //首先获取实体 LR_StampManageEntity entity = GetEntity(keyValue); string img = ""; //实体是否存在 if (entity != null && !string.IsNullOrEmpty(entity.F_ImgFile)) { ImgEntity imgEntity = imgIBLL.GetEntity(entity.F_ImgFile); if (imgEntity != null && !string.IsNullOrEmpty(imgEntity.F_Content)) { FileDownHelper.DownLoadBase64(imgEntity.F_Content, imgEntity.F_Name); return; } } else { img = "/Content/images/add.jpg"; } if (string.IsNullOrEmpty(img)) { img = "/Content/images/add.jpg"; } FileDownHelper.DownLoad(img); }
/// <summary> /// 更新数据状态 /// </summary> /// <param name="keyValue">主键</param> /// <param name="state">状态 1启用 0禁用</param> public void UpdateState(string keyValue, int state) { LR_StampManageEntity entity = new LR_StampManageEntity(); entity.F_EnabledMark = state; SaveEntity(keyValue, entity); }
/// <summary> /// 密码验证 /// </summary> /// <param name="keyValue">主键</param> /// <param name="password">密码</param> /// <returns></returns> public bool EqualPassword(string keyValue, string password) { LR_StampManageEntity entity = GetEntity(keyValue); if (entity.F_Password.Equals(password))//加密后进行对比 { return(true); } else { return(false); } }
/// <summary> /// 保存印章信息(新增/编辑) /// </summary> /// <param name="keyValue"></param> /// <param name="stampEntity"></param> public void SaveEntity(string keyValue, LR_StampManageEntity entity) { try { lr_StampManageService.SaveEntity(keyValue, entity); } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowBusinessException(ex); } } }