Esempio n. 1
0
        /// <summary>
        /// 设置旅客为默认常用旅客
        /// </summary>
        /// <param name="id">常用旅客的ID</param>
        /// <returns></returns>
        internal static ReplayBase SetTravellerToDefault(string id)
        {
            ReplayBase result = new ReplayBase();

            //通过id获取fkid
            List <Traveller> trave = MembersExService.RsGetTravellerInfoByfkid(new GetUserExInfoListRequest()
            {
                id = id, onlyDefalut = false
            });

            if (trave.Count > 0)
            {
                Traveller travellerInfo = new Traveller()
                {
                    ravellerId = id,
                    fkId       = trave[0].fkId,
                    fullName   = trave[0].fullName,
                    idCard     = trave[0].idCard,
                    idType     = trave[0].idType,
                    isDefault  = true
                };
                result = MembersExService.RsSaveTraveller(travellerInfo);
            }
            else
            {
                result.ReturnCode    = EnumErrorCode.ServiceError;
                result.ReturnMessage = "服务器错误 500";
            }

            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 删除常用地址(物理删除)
        /// 如果删除的时候默认地址,[则将当前用户最近编辑的一条这是为默认地址(如果有的话)]
        /// </summary>
        /// <param name="id">地址id</param>
        /// <returns></returns>
        internal static ReplayBase DelAddress(string id)
        {
            ReplayBase result = new ReplayBase();

            try
            {
                //根据id获取地址信息,判断该地址是否是默认地址

                List <AddressInfoModel> address = MembersExService.GetAddressListByFkId(new GetUserExInfoListRequest()
                {
                    id = id, onlyDefalut = true
                });
                if (address.Count > 0)
                {
                    //删除之后再将最新操作的一个地址设置为默认地址
                    //1,删除地址
                    MembersExDataBaseManager.DelAddress(id);
                    //2,找到用户id下剩余的地址
                    List <AddressInfoModel> list_address = MembersExService.GetAddressListByFkId(new GetUserExInfoListRequest()
                    {
                        fkId = address[0].fkId, onlyDefalut = false
                    });
                    //3,取到最新操作的一个地址,并且修改为默认地址(如果还有地址)
                    if (list_address.Count > 0)
                    {
                        AddressInfoModel tt = list_address[0];
                        tt.isDefault = true;
                        MembersExService.EditAddress(tt);
                    }
                }
                else
                {
                    //直接删除
                    MembersExDataBaseManager.DelAddress(id);
                }
            }
            catch (Exception e)
            {
                result.ReturnCode    = EnumErrorCode.ServiceError;
                result.ReturnMessage = "服务器错误 500";
                SysManagerService.SysSaveErrorLogMsg(e.ToString(), id);
            }
            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// 删除常用旅客(物理删除)
        /// 如果删除的是默认常用旅客,[则将当前用户最近编辑的一条这是为默认旅客(如果有的话)]
        /// </summary>
        /// <param name="id">常用旅客id</param>
        /// <returns></returns>
        internal static ReplayBase DelTraveller(string id)
        {
            ReplayBase result = new ReplayBase();

            try
            {
                //根据id获取旅客信息,判断该旅客是否是默认常用旅客

                List <Traveller> trave = MembersExService.RsGetTravellerInfoByfkid(new GetUserExInfoListRequest()
                {
                    id = id, onlyDefalut = true
                });
                if (trave.Count > 0)
                {
                    //删除之后再将最新操作的一个旅客设置为默认旅客
                    //1,删除旅客
                    MembersExDataBaseManager.SysDelTraveller(id);
                    //2,找到用户id下剩余的旅客
                    List <Traveller> list_trave = MembersExService.RsGetTravellerInfoByfkid(new GetUserExInfoListRequest()
                    {
                        fkId = trave[0].fkId, onlyDefalut = false
                    });
                    //3,取到最新操作的一个旅客,并且修改为默认旅客(如果还有旅客)
                    if (list_trave.Count > 0)
                    {
                        Traveller tt = list_trave[0];
                        tt.isDefault = true;
                        MembersExService.RsSaveTraveller(tt);
                    }
                }
                else
                {
                    //直接删除
                    MembersExDataBaseManager.SysDelTraveller(id);
                }
            }
            catch (Exception e)
            {
                result.ReturnCode    = EnumErrorCode.ServiceError;
                result.ReturnMessage = "服务器错误 500";
                SysManagerService.SysSaveErrorLogMsg(e.ToString(), id);
            }
            return(result);
        }
Esempio n. 4
0
        /// <summary>
        /// 设置某地址为默认地址
        /// </summary>
        /// <param name="id">地址id</param>
        /// <returns></returns>
        internal static ReplayBase SetAddressToDefault(string id)
        {
            ReplayBase result = new ReplayBase();
            //通过id获取fkid
            List <AddressInfoModel> address = MembersExService.GetAddressListByFkId(new GetUserExInfoListRequest()
            {
                id = id, onlyDefalut = false
            });

            if (address.Count > 0)
            {
                AddressInfoModel addressInfo = new AddressInfoModel()
                {
                    id           = id,
                    fkId         = address[0].fkId,
                    address      = address[0].address,
                    linkMan      = address[0].linkMan,
                    linkPhone    = address[0].linkPhone,
                    postCode     = address[0].postCode,
                    locationInfo = new LocationInfoModel()
                    {
                        DistrictId = address[0].locationInfo.DistrictId, cityInfo = new GeoCityInfoModel()
                        {
                            CityCode = address[0].locationInfo.cityInfo.CityCode
                        }
                    },
                    isDefault = true
                };
                result = MembersExService.EditAddress(addressInfo);
            }
            else
            {
                result.ReturnCode    = EnumErrorCode.ServiceError;
                result.ReturnMessage = "服务器错误 500";
            }
            return(result);
        }