private void AddOrg()
        {
            CurOrgInfo.AddTime = DateTime.Now.ToString();
            if (string.IsNullOrEmpty(CurOrgInfo.ParentOrgName))
            {
                CurOrgInfo.ParentOrgId = "";
                CurOrgInfo.ParentOrgName = "";
            }
            if (window.ParentOrgInfo != null)
            {
                CurOrgInfo.ParentOrgId = window.ParentOrgInfo.OrgID;//给父级会员ID赋值
                CurOrgInfo.ParentOrgName = window.ParentOrgInfo.OrgName;
            }


            ErrType err = _businessService.AddOrg(_loginID, CurOrgInfo);
            if (err.Err != ERR.SUCCESS)
            {
                MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            OrgList.Add(CurOrgInfo);
            if (POrgList.Where(p => p.OrgName == CurOrgInfo.OrgName).Count() == 0)
            {
                OrgInfo item = new OrgInfo() { OrgID = CurOrgInfo.OrgID, OrgName = CurOrgInfo.OrgName, TelePhone = CurOrgInfo.TelePhone };
                POrgList.Add(item);
            }
            ErrType err2 = _businessService.CreateOrgTicket(CurOrgInfo.OrgID);
            if (err2.Err == ERR.ERROR)
                MessageBox.Show("生成二维码失败!请联系管理员", "提示信息");
            window.Close();
        }
        /// <summary>
        /// 获取微会员信息
        /// </summary>
        public void GetOrgsListExecute()
        {
            if (CanGetOrgsListExecute == false)
            {
                return;
            }

            int pageCount = 0;
            if (_OrgList == null)
                _OrgList = new ObservableCollection<OrgInfo>();
            else
                _OrgList.Clear();
            OrgInfo selOrgInfo = new OrgInfo();
            selOrgInfo.OrgName = OrgSelectCondition.Account;
            //selOrgInfo.CardType;
            selOrgInfo.CardNum = OrgSelectCondition.CardNum;
            selOrgInfo.Reperson = OrgSelectCondition.UserName;
            ErrType err = _businessService.GetOrgList(_loginID, selOrgInfo, OrgSelectCondition.PageIndex,
                                                      OrgSelectCondition.PageSize, ref pageCount, ref _OrgList);
            if (err.Err != ERR.SUCCESS)
            {
                MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            OrgList = _OrgList;
            OrgSelectCondition.PageCount = pageCount;
        }
        /// <summary>
        /// 添加微会员
        /// </summary>
        private void AddOrgExecute()
        {
            CurOrgInfo = new OrgInfo();
            CurOrgInfo.OrgID = Guid.NewGuid().ToString("n");
            CurOrgInfo.ParentOrgId = "";
            CurOrgInfo.CardType = CeritificateEnum.ID;


            window = new OrgDetialWindow()
                                         {
                                             POrgList = this.POrgList,
                                             DataContext = this,
                                             Owner = Application.Current.MainWindow,
                                             IsCanCreateOrgCode = true
                                         };
            window.ComitEvent += new Action(AddOrg);

            window.ShowDialog();
        }
        /// <summary>
        /// 更新微会员
        /// </summary>
        /// <param name="loginID">登录ID</param>
        /// <param name="roleInfo">会员账户信息</param>
        /// <returns></returns>
        public ErrType UpdateOrg(string loginID, OrgInfo orgInfo)
        {
            try
            {
                OrgEntity orgEntity = MyConverter.ToOrgEntity(orgInfo);
                EntityBase result = ManagerService.UpdateOrg(loginID, orgEntity);
                if (!result.Result)
                    return new ErrType(ERR.SERVICE, result.Desc);

                return GeneralErr.Success;
            }
            catch (TimeoutException te)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message); return new ErrType(ERR.EXEPTION, ErrorText.TimeoutException);
            }
            catch (Exception ex)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name,
             new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
                return new ErrType(ERR.EXEPTION, ErrorText.OperationError);
            }
        }
        /// <summary>
        /// 获取微会员列表
        /// </summary>
        /// <param name="loginID">登录标识ID</param>
        /// <param name="orgInfo">会员账户信息</param>
        /// <param name="pageindex">当前页</param>
        /// <param name="pagesize">页大小</param>
        /// <param name="pageCount">页总数</param>
        /// <param name="list">会员账户信息列表</param>
        /// <returns></returns>
        public ErrType GetOrgList(string loginID, OrgInfo orgInfo, int pageindex, int pagesize, ref int pageCount, ref ObservableCollection<OrgInfo> list)
        {
            try
            {
                List<OrgEntity> eList = new List<OrgEntity>();
                OrgEntity orgEntity = MyConverter.ToOrgEntity(orgInfo);
                EntityBase result = ManagerService.GetOrgList(loginID, orgEntity, pageindex, pagesize, ref pageCount, ref eList);
                foreach (OrgEntity entity in eList)
                {
                    list.Add(MyConverter.ToOrgInfo(entity));
                }
                if (!result.Result)
                    return new ErrType(ERR.SERVICE, result.Desc);

                return GeneralErr.Success;
            }
            catch (TimeoutException te)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message); return new ErrType(ERR.EXEPTION, ErrorText.TimeoutException);
            }
            catch (Exception ex)
            {
                FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
                return new ErrType(ERR.EXEPTION, ErrorText.QueryError);
            }
        }
        internal static OrgInfo ToOrgInfo(OrgEntity entity)
        {
            OrgInfo info = new OrgInfo();
            info.OrgID = entity.OrgID;
            info.OrgName = entity.OrgName;
            info.Coperson = entity.Coperson;
            info.CardType = EnumConverter.ConverterCeritificateEnum(entity.CardType);
            info.CardNum = entity.CardNum;
            info.ParentOrgId = entity.ParentOrgId;
            info.ParentOrgName = entity.ParentOrgName;
            info.Reperson = entity.Reperson;
            info.PhoneNum = entity.PhoneNum;
            info.TelePhone = entity.TelePhone;
            info.Email = entity.Email;
            info.Address = entity.Address;
            info.AddTime = entity.AddTime;
            info.Status = entity.Status == Status.Enabled ? true : false;//Enabled=1,启用 禁用=0//禁用

            return info;
        }
 internal static OrgEntity ToOrgEntity(OrgInfo info)
 {
     OrgEntity entity = new OrgEntity();
     entity.OrgName = info.OrgName;
     entity.OrgID = info.OrgID;
     entity.Coperson = info.Coperson;
     entity.CardType = EnumConverter.ConverterIDType(info.CardType);
     entity.CardNum = info.CardNum;
     entity.ParentOrgId = info.ParentOrgId == null ? "" : info.ParentOrgId;
     entity.ParentOrgName = info.ParentOrgName == null ? "" : info.ParentOrgName;
     entity.Reperson = info.Reperson;
     entity.PhoneNum = info.PhoneNum;
     entity.TelePhone = info.TelePhone;
     entity.Email = info.Email;
     entity.Address = info.Address;
     entity.AddTime = info.AddTime;
     entity.Status = info.Status == true ? Status.Enabled : Status.Disable;//Enabled=1,启用 禁用=0//禁用
     return entity;
 }