コード例 #1
0
        private DefaultResponse ClientChangePhone(ClientChangeModel model)
        {
            var response = new DefaultResponse();

            try
            {
                AddPhoneRequest request = new AddPhoneRequest
                {
                    ClientID = model.Id,
                    Phone    = Convert.ToInt64(PhoneService.GetPhoneFromStr(model.Phone))
                };
                HttpResponseMessage changeResponse = HttpClientService.PostAsync("api/client/AddPhone", request).Result;
                if (changeResponse.IsSuccessStatusCode)
                {
                    response = changeResponse.Content.ReadAsAsync <DefaultResponse>().Result;
                    return(response);
                }
            }
            catch (Exception e)
            {
                response.ErrorCode = 500;
                response.Message   = e.Message;
            }
            return(response);
        }
コード例 #2
0
        private bool CheckPhoneOrCardNumberIsFree(string phone, string card)
        {
            if (string.IsNullOrEmpty(phone) && string.IsNullOrEmpty(card))
            {
                return(false);
            }
            LCManager.Infrastructure.Request.GetClientInfoRequest request = new LCManager.Infrastructure.Request.GetClientInfoRequest();
            if (!string.IsNullOrEmpty(card))
            {
                try { request.Card = Convert.ToInt64(card); } catch { }
            }
            if (!string.IsNullOrEmpty(phone))
            {
                try { request.Phone = Convert.ToInt64(PhoneService.GetPhoneFromStr(phone)); } catch { }
            }
            try { request.Operator = Convert.ToInt16(JwtProps.GetOperator()); } catch { }
            HttpResponseMessage response = HttpClientService.PostAsync("api/values/ClientInfo", request).Result;

            if (response.IsSuccessStatusCode)
            {
                LCManager.Infrastructure.Response.GetClientInfoResponse data = response.Content.ReadAsAsync <LCManager.Infrastructure.Response.GetClientInfoResponse>().Result;
                if (data.ErrorCode == 0)
                {
                    return
                        (string.IsNullOrEmpty(data.Name) &&
                         string.IsNullOrEmpty(data.Surname) &&
                         string.IsNullOrEmpty(data.Patronymic) &&
                         data.Id == 0 &&
                         data.Card == 0);
                }
                return(true);
            }
            return(false);
        }
コード例 #3
0
        private DefaultResponse ClientChangeInfo(ClientChangeModel model)
        {
            var response = new DefaultResponse();

            try
            {
                var client = new Client
                {
                    allowemail = model.AllowEmail,
                    allowpush  = model.AllowPush,
                    allowsms   = model.AllowSms,
                    email      = model.Email,
                    birthdate  = Convert.ToDateTime(model.Birthdate),
                    firstname  = model.FirstName,
                    lastname   = model.LastName,
                    middlename = model.MiddleName,
                    id         = model.Id,
                    phone      = Convert.ToInt64(PhoneService.GetPhoneFromStr(model.Phone)),
                    gender     = Convert.ToInt32(model.Sex)
                };
                ChangeClientRequest request = new ChangeClientRequest
                {
                    ClientData = client,
                    Operator   = JwtProps.GetOperator()
                };

                HttpResponseMessage changeResponse = HttpClientService.PostAsync("api/values/ChangeClient", request).Result;
                if (changeResponse.IsSuccessStatusCode)
                {
                    response = changeResponse.Content.ReadAsAsync <DefaultResponse>().Result;
                    return(response);
                }
            }
            catch (Exception e)
            {
                response.ErrorCode = 500;
                response.Message   = e.Message;
            }
            return(response);
        }