示例#1
0
        /// <summary>
        /// 将选定顾客分配给目标用户
        /// </summary>
        /// <param name="vo"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public static void DispatchCustomersToTargetUsers(TransterCustomerVo vo, String token)
        {
            RestClient rc      = new RestClient();
            var        request = new RestRequest(GlobalConfig.CUSTOMER_DISPATCH);

            request.AddHeader(GlobalConfig.AUTHORIZATION, token);
            request.AddJsonBody(vo);
            IRestResponse response;

            try
            {
                response = rc.Execute(request, Method.PATCH);
            }
            catch (Exception ex)
            {
                throw new BusinessException(ex.Message);
            }
            if (response.StatusCode == 0)
            {
                throw new BusinessException("请检查网络");
            }
            if (response.StatusCode != HttpStatusCode.NoContent)
            {
                var res             = rc.Deserialize <CustomException>(response);
                var customException = res.Data;
                throw new BusinessException(customException.message);
            }
        }
        private void tranfer()
        {
            if (lvUsers.SelectedItems.Count < 1)
            {
                MessageBox.Show("请选择一个用户", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            bool reDispatch = false;

            if (MessageBox.Show("是否是重新分派(如果是,那么将重新指定分派人)?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)
                == DialogResult.Yes)
            {
                reDispatch = true;
            }
            ListViewItem lviSelected = lvUsers.SelectedItems[0];
            UserDto      target      = (UserDto)lviSelected.Tag;

            try
            {
                TransterCustomerVo vo = new TransterCustomerVo();
                vo.customerIds  = customerIds;
                vo.targetUserId = target.id;
                vo.reDispatch   = reDispatch;
                CustomerService.AdminTransferCustomersToTargetUsers(vo, Global.USER_TOKEN);
                DialogResult = DialogResult.OK;
            }
            catch (BusinessException ex)
            {
                MessageBox.Show("客户转移发生错误" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#3
0
        private void tranfer()
        {
            if (lvUsers.SelectedItems.Count < 1)
            {
                MessageBox.Show("请选择一个用户", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            ListViewItem lviSelected = lvUsers.SelectedItems[0];
            UserDto      target      = (UserDto)lviSelected.Tag;

            try
            {
                TransterCustomerVo vo = new TransterCustomerVo();
                vo.customerIds  = customerIds;
                vo.targetUserId = target.id;
                CustomerService.TransferCustomersToTargetUsers(vo, Global.USER_TOKEN);
                DialogResult = DialogResult.OK;
            }
            catch (BusinessException ex)
            {
                MessageBox.Show("客户转移发生错误" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }