/// <summary> /// 根据模板ID集合删除模板信息 /// </summary> /// <param name="Ids"></param> /// <returns></returns> public bool DeleteApporvalTempletsByIDs(List <string> Ids) { try { var entitys = (from ent in dal.GetTable() where Ids.Contains(ent.APPROVALID) select ent); if (entitys.Count() > 0) { dal.BeginTransaction(); foreach (var entity in entitys) { try { Utility.RefreshEntity(entity as System.Data.Objects.DataClasses.EntityObject); int i = dal.Delete(entity); if (i > 0) { PublicInterfaceWS.PublicServiceClient publicClient = new PublicInterfaceWS.PublicServiceClient(); if (!publicClient.DeleteContent(entity.APPROVALID)) { dal.RollbackTransaction(); return(false); } } else { dal.RollbackTransaction(); return(false); } } catch (Exception ex) { dal.RollbackTransaction(); return(false); throw (ex); } } dal.CommitTransaction(); return(true); } return(false); } catch (Exception ex) { dal.RollbackTransaction(); Tracer.Debug("删除事项审批模板ApprovalTempletManagementBll-DeleteApprovalTemplet" + System.DateTime.Now.ToString() + " " + ex.ToString()); return(false); } }
public bool DeleteApprovalTemplet(T_OA_APPROVALINFOTEMPLET ApprovalInfo) { try { var entitys = (from ent in dal.GetTable() where ent.APPROVALID == ApprovalInfo.APPROVALID select ent); if (entitys.Count() > 0) { var entity = entitys.FirstOrDefault(); dal.BeginTransaction(); try { Utility.RefreshEntity(entity as System.Data.Objects.DataClasses.EntityObject); int i = dal.Delete(entity); if (i > 0) { PublicInterfaceWS.PublicServiceClient publicClient = new PublicInterfaceWS.PublicServiceClient(); if (!publicClient.DeleteContent(ApprovalInfo.APPROVALID)) { dal.RollbackTransaction(); return(false); } dal.CommitTransaction(); return(true); } else { dal.RollbackTransaction(); return(false); } } catch (Exception ex) { dal.RollbackTransaction(); return(false); throw (ex); } } return(false); } catch (Exception ex) { dal.RollbackTransaction(); Tracer.Debug("事项审批ApprovalManagementBll-DeleteApproval" + System.DateTime.Now.ToString() + " " + ex.ToString()); return(false); } }