public bool SendRequest(ReflashRequest reflashRequest, string token)
 {
     ITokenValidator validator = new DatabaseTokenValidator();
     if (validator.IsValid(token))
         return new VtecTeamDBManager().SaveRequest(reflashRequest);
     throw new FaultException("Срок рабочей сессии истек, преезапустите программу");
 }
        public RequestWithCommentsForm(ReflashRequest request)
        {
            InitializeComponent();

            this.request = request;

            this.Text = string.Format("{0} - {1}", this.Text, request.Id);
            lblWachRequest.Text = string.Format("{0} - {1}", lblWachRequest.Text, request.Id);
            txtEcuNumber.Text = request.EcuNumber;
            txtEcuBinaryNumber.Text = request.BinaryNumber;
            txtRequestCarDescription.Text = request.CarDescription;
            txtAdditionalInfo.Text = request.RequestDetails;
            if (request.StockBinary != null)
            {
                txtStockFilePath.Text = request.StockBinaryName;
                btnOpenFile.Enabled = false;
            }

            if (request.EcuPhoto != null)
                txtEcuPhotoStatus.Text = request.EcuPhotoFilename;
            txtUserName.Text = Session.CurrentUser.FirstName;
            txtExpectedDate.Text = request.ExpectedResolveDate == null ? txtExpectedDate.Text : request.ExpectedResolveDate.ToString();
        }
Exemplo n.º 3
0
        private async void btnSendRequest_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtRequestCarDescription.Text))
            {
                MessageBox.Show("Поле Номер Машина обязательно для заполнения");
                return;
            }
            
            var currentStatus = PanelRefresh.StartRefresh(pnlSendRequest, pbRequest);
            await Task.Run(() =>
            {
                var request = new ReflashRequest
                {
                    RequestDetails = txtAdditionalInfo.Text,
                    EcuNumber = txtEcuNumber.Text,
                    BinaryNumber = txtEcuBinaryNumber.Text,
                    UserId = Session.CurrentUser.Id,
                    RequestDate = DateTime.Now,
                    Status = (int) RequestStatuses.New,
                    CarDescription = txtRequestCarDescription.Text,
                    //User = Session.CurrentUser,
                };

                if (File.Exists(txtStockFilePath.Text))
                {
                    request.StockBinary = File.ReadAllBytes(txtStockFilePath.Text);
                    request.StockBinaryName = Path.GetFileName(txtStockFilePath.Text);
                }

                if (File.Exists(txtEcuPhotoStatus.Text))
                {
                    request.EcuPhoto = File.ReadAllBytes(txtEcuPhotoStatus.Text);
                    request.EcuPhotoFilename = Path.GetFileName(txtEcuPhotoStatus.Text);
                }

                RequestExecutor.Execute(() =>
                {
                    var result = WCFServiceFactory.CreateVtecTeamService().SendRequest(request);

                    this.Invoke(() => pbRequest.Image = !result ? Properties.Resources.Error : null);
                    MessageBox.Show(result ? "Запрос успешно отправлен" : "Не удалось отправить запрос.");
                });
            });

            PanelRefresh.StopRefresh(currentStatus);
        }
 public bool SendRequest(ReflashRequest reflashRequest)
 {
     return vtServiceFacade.SendRequest(reflashRequest, incomingUserInfo);
 }