bool ICommunityInfo.IsApplicationHandled(ApproveView approveView) { Contract.Requires <ArgumentNullException>(approveView != null, "参数approveView:不能为空"); bool result = false; int count = 0; string message = string.Empty; MiicConditionCollections condition = approveView.visitor(this); try { count = dbService.GetCount <CommunityApplicationInfo>(new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <CommunityApplicationInfo>(), Config.Attribute.GetSqlColumnNameByPropertyName <CommunityApplicationInfo, string>(o => o.ID)), condition, out message); if (count == 0) { result = true; } } catch (Exception ex) { Config.IlogicLogService.Write(new LogicLog() { AppName = Config.AppName, ClassName = ClassName, NamespaceName = NamespaceName, MethodName = MethodBase.GetCurrentMethod().Name, Message = ex.Message, Oper = Config.Oper }); } return(result); }
bool ICommunityInfo.MemberRefuse(ApproveView approveView) { Contract.Requires <ArgumentNullException>(approveView != null, "参数approveView:不能为空"); bool result = false; int count = 0; string message = string.Empty; MiicConditionCollections condition = approveView.visitor(this); try { result = dbService.UpdateConditions(new CommunityApplicationInfo() { ResponseStatus = ((int)ApplyStatusSetting.Refuse).ToString(), ResponseTime = DateTime.Now }, condition, out count, out message); } catch (Exception ex) { Config.IlogicLogService.Write(new LogicLog() { AppName = Config.AppName, ClassName = ClassName, NamespaceName = NamespaceName, MethodName = MethodBase.GetCurrentMethod().Name, Message = ex.Message, Oper = Config.Oper }); } return(result); }
bool ICommunityInfo.MemberAgree(ApproveView approveView) { Contract.Requires <ArgumentNullException>(approveView != null, "参数approveView:不能为空"); bool result = false; string message = string.Empty; string message1 = string.Empty; string message2 = string.Empty; string message3 = string.Empty; MiicConditionCollections conditions = approveView.visitor(this); List <string> sqls = new List <string>(); sqls.Add(DBService.UpdateConditionsSql(new CommunityApplicationInfo() { ResponseStatus = ((int)ApplyStatusSetting.Agree).ToString(), ResponseTime = DateTime.Now }, conditions, out message1)); CommunityMember member = new CommunityMember() { ID = Guid.NewGuid().ToString(), IsAdmin = ((int)MiicYesNoSetting.No).ToString(), JoinTime = DateTime.Now, CommunityID = approveView.CommunityID, MemberID = approveView.MemberID, MemberName = approveView.MemberName }; sqls.Add(DBService.InsertSql(member, out message3)); lock (syncRoot) { CommunityInfo temp = ((ICommon <CommunityInfo>) this).GetInformation(approveView.CommunityID); sqls.Add(DBService.UpdateSql(new CommunityInfo() { MemberCount = temp.MemberCount + 1, ID = temp.ID }, out message2)); try { result = dbService.excuteSqls(sqls, out message); } catch (Exception ex) { Config.IlogicLogService.Write(new LogicLog() { AppName = Config.AppName, ClassName = ClassName, NamespaceName = NamespaceName, MethodName = MethodBase.GetCurrentMethod().Name, Message = ex.Message, Oper = Config.Oper }); } if (result == true) { lock (syncRoot) { List <CommunityMember> memberList = new List <CommunityMember>(); memberList.Add(member); InsertCaches(memberList); if (items.Find(o => o.ID == approveView.CommunityID) != null) { items.Find(o => o.ID == approveView.CommunityID).MemberCount = temp.MemberCount + 1; } } } } return(result); }