public UserAddWindowViewModel() : base("UserView") { Model = new OPC_AuthUser(); OrgList = AppEx.Container.GetInstance <IOrganizationService>().Search(); OrgInfo = new OPC_OrgInfo(); }
private string CheckAndReturnMsg(OPC_OrgInfo orgInfo, UserProfile userProfile) { if (orgInfo == null) { return("组织机构获取失败"); } if (userProfile == null) { return("用户信息获取失败"); } //非管理员不能添加顶级节点,只能增加子节点 if (String.IsNullOrEmpty(orgInfo.ParentID) && !userProfile.IsSystem) { return("父节ID不能为空"); } //验证 if (!userProfile.IsSystem && !String.IsNullOrEmpty(orgInfo.ParentID)) { var o = _orgServiceService.GetOrgInfoByOrgID(orgInfo.ParentID); if (o == null) { return("父节点不能为空"); } } return(null); }
public NodeViewModel AddSubNode(OPC_OrgInfo opcOrgInfo) { IsExpanded = true; var node = new NodeViewModel(this, opcOrgInfo); AddNodeViewModel(node); return(node); }
public void Update(OPC_OrgInfo orgInfo) { Name = orgInfo.OrgName; ParentId = orgInfo.ParentID; OrgId = orgInfo.OrgID; OrgType = orgInfo.OrgType; StoreOrSectionId = orgInfo.StoreOrSectionID; StoreOrSectionName = orgInfo.StoreOrSectionName; }
public NodeViewModel(NodeViewModel parent, OPC_OrgInfo orgInfo) { OPC_OrgInfo = orgInfo; Parent = parent; Name = orgInfo.OrgName; ParentId = orgInfo.ParentID; OrgId = orgInfo.OrgID; OrgType = orgInfo.OrgType; StoreOrSectionId = orgInfo.StoreOrSectionID; StoreOrSectionName = orgInfo.StoreOrSectionName; NodeInfo = parent.NodeInfo; children = new ObservableCollection <NodeViewModel>(); }
public IHttpActionResult AddOrg([FromBody] OPC_OrgInfo orgInfo, [UserProfile] UserProfile userProfile) { var t = CheckAndReturnMsg(orgInfo, userProfile); if (!String.IsNullOrEmpty(t)) { return(BadRequest(t)); } return(DoFunction(() => { return _orgServiceService.AddOrgInfo(orgInfo); }, "添加组织机构失败")); }
public IHttpActionResult UpdateOrg([FromBody] OPC_OrgInfo orgInfo, [UserProfile] UserProfile userProfile) { var t = CheckAndReturnMsg(orgInfo, userProfile); if (!String.IsNullOrEmpty(t)) { return(BadRequest(t)); } return(DoFunction(() => { bool bl = _orgServiceService.Update(orgInfo); return bl; }, "更新组织机构失败")); }
public ResultMsg Edit(OPC_OrgInfo org) { try { bool bFalg = RestClient.Put("org/updateOrg", org); return(new ResultMsg { IsSuccess = bFalg, Msg = "保存成功" }); } catch (Exception ex) { return(new ResultMsg { IsSuccess = false, Msg = "保存失败" }); } }
public ResultMsg Delete(OPC_OrgInfo org) { try { var oo = new { orgInfoId = org.Id }; bool bFalg = RestClient.Put("org/deleteorg", org.Id); return(new ResultMsg { IsSuccess = bFalg, Msg = "删除错误" }); } catch (Exception ex) { return(new ResultMsg { IsSuccess = false, Msg = "保存失败" }); } }
public ResultMsg Add(OPC_OrgInfo org) { try { if (org == null) { return(new ResultMsg { IsSuccess = false, Msg = "增加错误" }); } OPC_OrgInfo ent = RestClient.PostReturnModel("org/addOrg", org); return(new ResultMsg { IsSuccess = ent != null, Msg = "保存成功", Data = ent }); } catch (Exception ex) { return(new ResultMsg { IsSuccess = false, Msg = "保存失败" }); } }
public void Append(OPC_OrgInfo opcOrgInfo) { IsExpanded = true; children.Add(new NodeViewModel(this, opcOrgInfo)); }