Exemplo n.º 1
0
        public async Task <IActionResult> OnPostAsync(int id, QuoteStatus status)
        {
            var quote = await Context.Quote.FirstOrDefaultAsync(m => m.QuoteID == id);

            if (quote == null)
            {
                return(NotFound());
            }

            var quoteOperation = (status == QuoteStatus.Approved)
                                        ? QuoteOperations.Approve
                                        : QuoteOperations.Reject;

            var isAuthorized = await AuthorizationService.AuthorizeAsync(
                User,
                quote,
                quoteOperation);

            if (!isAuthorized.Succeeded)
            {
                Forbid();
            }

            quote.Status = status;
            Context.Quote.Update(quote);
            await Context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 2
0
        public static void Execute(CorrigoService service, int woid, QuoteStatus newStatus)
        {
            var specifier = new EntitySpecifier
            {
                EntityType = EntityType.WorkOrder,
                Id         = woid
            };

            string[] properties = { nameof(WorkOrder.Estimate) + ".*" };
            var      workOrder  = service.Retrieve(specifier, new PropertySet {
                Properties = properties
            }) as WorkOrder;

            var oldStatus = workOrder.Estimate.StatusId;

            workOrder.Estimate.StatusId = newStatus;

            var command = new UpdateCommand
            {
                Entity      = workOrder,
                PropertySet = new PropertySet {
                    Properties = new[] { "Estimate.StatusId" }
                }
            };

            var response = service.Execute(command) as OperationCommandResponse;

            Debug.Print(response?.ErrorInfo?.Description
                        ?? $"Successfully updated an Estimate from status {oldStatus} to {newStatus}");
        }
 public OrderResponseReceivedEvent(Guid quoteId, CurrencyPair currencyPair, decimal notional, decimal?rate, bool isLastMessage, QuoteStatus status)
 {
     QuoteId       = quoteId;
     CurrencyPair  = currencyPair;
     Notional      = notional;
     Rate          = rate;
     IsLastMessage = isLastMessage;
     Status        = status;
 }
Exemplo n.º 4
0
 public RfqResponse(Guid quoteId, CurrencyPair currencyPair, decimal notional, decimal?rate, QuoteStatus quoteStatus, bool isLastMessage = false)
 {
     QuoteId       = quoteId;
     CurrencyPair  = currencyPair;
     Notional      = notional;
     Rate          = rate;
     QuoteStatus   = quoteStatus;
     IsLastMessage = isLastMessage;
 }
Exemplo n.º 5
0
 private void OnTraderSendQuoteEvent(TraderSendQuoteEvent e)
 {
     if (e.QuoteId != _quoteId)
     {
         return;
     }
     _quoteStatus = QuoteStatus.Quoting;
     _rfqServiceGateway.SendUpdate(this);
 }
Exemplo n.º 6
0
 public RfqDetails(CurrencyPair currencyPair, decimal notional, Guid quoteId, IRfqServiceGateway rfqServiceGateway)
 {
     _currencyPair      = currencyPair;
     _notional          = notional;
     _quoteId           = quoteId;
     _rfqServiceGateway = rfqServiceGateway;
     _rate        = new Field <decimal?>();
     _quoteStatus = QuoteStatus.New;
 }
Exemplo n.º 7
0
 private void OnClientRejectQuoteEvent(ClientRejectQuoteEvent e)
 {
     if (e.QuoteId != _quoteId)
     {
         return;
     }
     _quoteStatus = QuoteStatus.ClientRejected;
     _rfqServiceGateway.SendUpdate(this, true);
 }
Exemplo n.º 8
0
 public Quote(Guid _id, Trip _trip, VehicleRate _vehicleRate, List <Traveller> _travellers, decimal _amount, QuoteStatus _status)
 {
     Id          = _id;
     Trip        = _trip;
     VehicleRate = _vehicleRate;
     Travellers  = _travellers;
     Amount      = _amount;
     Currency    = _trip.Destination.Location.Currency;
     Status      = _status;
 }
Exemplo n.º 9
0
 private void OnTraderRejectQuoteEvent(TraderRejectQuoteEvent e)
 {
     if (e.QuoteId != _quoteId)
     {
         return;
     }
     _quoteStatus = QuoteStatus.TraderRejected;
     _rate.Value  = null;
     _rfqServiceGateway.SendUpdate(this);
 }
Exemplo n.º 10
0
        private void OnClientClosedQuoteEvent(ClientClosedQuoteEvent e)
        {
            if (e.QuoteId != _quoteId)
            {
                return;
            }
            var isAlreadyAtEndState = _quoteStatus == QuoteStatus.Booked || _quoteStatus == QuoteStatus.ClientRejected || _quoteStatus == QuoteStatus.TraderRejected;

            if (!isAlreadyAtEndState)
            {
                _quoteStatus = QuoteStatus.ClientRejected;
            }
        }
Exemplo n.º 11
0
 public void CreateOrUpdateDescription(TableDescriptionDto input)
 {
     if (input.tableIndex == 1)//Rolescategory
     {
         var client = new RolesCategory()
         {
             Id          = input.Id,
             Description = input.Description
         };
         _rolescategory.InsertOrUpdate(client);
     }
     else if (input.tableIndex == 2)//RepairType
     {
         var client = new RepairTypes()
         {
             Id          = input.Id,
             Description = input.Description
         };
         _repairtypes.InsertOrUpdate(client);
     }
     else if (input.tableIndex == 3)//QuoteStatus
     {
         var client = new QuoteStatus()
         {
             Id          = input.Id,
             Description = input.Description
         };
         _quotestatus.InsertOrUpdate(client);
     }
     else if (input.tableIndex == 4)//JobStatus
     {
         var client = new Jobstatus()
         {
             Id          = input.Id,
             Description = input.Description
         };
         _jobstatus.InsertOrUpdate(client);
     }
     else if (input.tableIndex == 10)//JobstatusMask
     {
         var client = new JobstatusMask()
         {
             Id           = input.Id,
             Description1 = input.Description
         };
         _jobstatusmask.InsertOrUpdate(client);
     }
 }
Exemplo n.º 12
0
        protected override void ExecuteWorkflowLogic()
        {
            var quoteCloseRequest = new CloseQuoteRequest()
            {
                Status     = QuoteStatus.Get(Context.ExecutionContext),
                QuoteClose = new Entity("quoteclose")
                {
                    ["subject"]     = Subject.Get(Context.ExecutionContext),
                    ["quoteid"]     = Quote.Get(Context.ExecutionContext),
                    ["actualend"]   = CloseDate.Get(Context.ExecutionContext),
                    ["description"] = Description.Get(Context.ExecutionContext)
                }
            };

            Context.UserService.Execute(quoteCloseRequest);
        }
Exemplo n.º 13
0
        public async Task <bool> UpdateQuoteStatusAndSwapId(long quoteId, QuoteStatus newStatus, QuoteStatus oldStatus, string swapOperationId)
        {
            var sql = string.Format(_sqlUpdateStatusAndSwapOperationId, (int)newStatus, swapOperationId, quoteId, (int)oldStatus);

            try
            {
                var affectedRows = await Database.ExecuteSqlRawAsync(sql);

                return(affectedRows != 0);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Exemplo n.º 14
0
        protected void btnSave_ServerClick(object sender, EventArgs e)
        {
            lblError.Visible = false;

            int status = Convert.ToInt32(slctType.Items[slctType.SelectedIndex].Value);

            if (status == 0)
            {
                lblError.Visible   = true;
                lblError.InnerHtml = "İşlem Tipi seçiniz...";
                return;
            }

            QuoteStatus quoteStatus = (QuoteStatus)status;
            string      quoteNo     = txtSalesNo.Value;

            Dictionary <Guid, QuoteStatus> quoteInfo = GetQuoteId(quoteNo);

            if (quoteInfo == null)
            {
                lblError.Visible   = true;
                lblError.InnerHtml = "Satış bulunamadı...";
                return;
            }
            else
            {
                if (quoteStatus == QuoteStatus.MuhasebeyeAktarıldı)
                {
                    MsCrmResult result = QuoteHelper.Muhasebelestir(quoteInfo.Keys.FirstOrDefault().ToString());

                    lblError.Visible   = true;
                    lblError.InnerHtml = result.Result;
                    return;
                }
                else //if(quoteStatus==QuoteStatus.İptalEdildi)
                {
                    //if(quoteInfo.Values.FirstOrDefault()==QuoteStatus.İptalEdildi || quoteInfo.Values.FirstOrDefault()==QuoteStatus.İptalAktarıldı)
                    //{
                    MsCrmResult resultIptal = IptalEt(quoteInfo.Keys.FirstOrDefault().ToString());

                    lblError.Visible   = true;
                    lblError.InnerHtml = resultIptal.Result;
                    return;
                    //}
                }
            }
        }
Exemplo n.º 15
0
        public async Task <SaveResult> SaveEntity(QuoteStatusViewModel viewModel)
        {
            SaveResult saveResult = new SaveResult();
            Dictionary <bool, string> dictionary = new Dictionary <bool, string>();

            var entity = new QuoteStatus();

            try
            {
                if (viewModel.Id != 0)
                {
                    if (_context.QuoteStatus.IgnoreQueryFilters().Any(a => a.Id == viewModel.Id))
                    {
                        entity = await _context.QuoteStatus.IgnoreQueryFilters().FirstOrDefaultAsync(a => a.Id == viewModel.Id);
                    }
                    entity = viewModel.ToEntity(entity);
                    _context.QuoteStatus.Update(entity);
                }
                else
                {
                    entity = viewModel.ToEntity(entity);
                    _context.QuoteStatus.Add(entity);
                }

                await _context.SaveChangesAsync();

                if (entity.Id > 0)
                {
                    saveResult.IsSuccess = true;
                    saveResult.Id        = entity.Id;
                }
            }
            catch (DbUpdateException upDateEx)
            {
                var    results = upDateEx.GetSqlerrorNo();
                string msg     = results == (int)SqlErrNo.FK ? ConstEntity.MissingValueMsg : ConstEntity.UniqueKeyMsg;
                saveResult = dictionary.GetValidateEntityResults(msg).ToSaveResult();
            }
            catch (Exception ex)
            {
                saveResult.Message = CrudError.SaveErrorMsg;
            }


            return(saveResult);
        }
Exemplo n.º 16
0
 private void OnRequestQuoteEvent(OrderScreen model)
 {
     Log.DebugFormat("Beginning RFQ");
     _quoteId = Guid.NewGuid();
     _status  = QuoteStatus.Requesting;
     _inFlightRfqQuoteDetails = new InFlightRfqQuoteDetails
     {
         QuoteId      = _quoteId,
         CurrencyPair = model.Inputs.CurrencyPair.Value,
         Notional     = model.Inputs.Notional.Value.Value
     };
     _orderDisposable.Disposable = _rfqGateway.BegingGetQuote(
         _inFlightRfqQuoteDetails.QuoteId,
         _inFlightRfqQuoteDetails.CurrencyPair,
         _inFlightRfqQuoteDetails.Notional
         );
 }
Exemplo n.º 17
0
        protected override void ExecuteWorkflowLogic()
        {
            var convertQuoteToSalesOrderRequest = new ConvertQuoteToSalesOrderRequest()
            {
                ColumnSet             = new ColumnSet("salesorderid"),
                QuoteCloseDate        = CloseDate.Get(Context.ExecutionContext),
                QuoteCloseDescription = Description.Get(Context.ExecutionContext),
                QuoteCloseStatus      = QuoteStatus.Get(Context.ExecutionContext),
                QuoteCloseSubject     = Subject.Get(Context.ExecutionContext),
                QuoteId = Quote.Get(Context.ExecutionContext).Id
            };

            var convertQuoteToSalesOrderResponse =
                (ConvertQuoteToSalesOrderResponse)Context.UserService.Execute(convertQuoteToSalesOrderRequest);

            SalesOrder.Set(Context.ExecutionContext, convertQuoteToSalesOrderResponse.Entity.ToEntityReference());
        }
Exemplo n.º 18
0
        public void ChangeStatus(StatusDto input)
        {
            if (input.tableIndex == 1)//Rolescategory
            {
                var client = new RolesCategory()
                {
                    Id      = input.Id,
                    Enabled = input.Status
                };
                _rolescategory.Update(client);
            }
            else if (input.tableIndex == 2)//RepairType
            {
                var client = new RepairTypes()
                {
                    Id      = input.Id,
                    Enabled = input.Status
                };
                _repairtypes.Update(client);
            }
            else if (input.tableIndex == 3)//QuoteStatus
            {
                var client = new QuoteStatus()
                {
                    Id      = input.Id,
                    Enabled = input.Status
                };
                _quotestatus.Update(client);
            }

            else if (input.tableIndex == 10)//JobstatusMask
            {
                var client = new JobstatusMask()
                {
                    Id      = input.Id,
                    Enabled = input.Status
                };
                _jobstatusmask.Update(client);
            }
        }
Exemplo n.º 19
0
 private void OnOrderResponseReceivedEvent(OrderResponseReceivedEvent e)
 {
     if (e.QuoteId != _quoteId)
     {
         return;
     }
     Log.DebugFormat("RFQ response received");
     if (e.HasException)
     {
         // todo
     }
     else
     {
         _rate   = e.Rate;
         _status = e.Status;
     }
     if (_status.IsEndState())
     {
         _inFlightRfqQuoteDetails = null;
         _quoteId = Guid.Empty;
     }
 }
Exemplo n.º 20
0
 private void OnRejectQuoteEvent()
 {
     Log.DebugFormat("Rejecting quote");
     _status = QuoteStatus.Rejecting;
     _rejectQuoteDisposable.Disposable = _rfqGateway.BegingRejectQuote(_quoteId);
 }
Exemplo n.º 21
0
 private void OnAcceptQuoteEvent()
 {
     Log.DebugFormat("Accepting quote");
     _status = QuoteStatus.Booking;
     _acceptQuoteDisposable.Disposable = _rfqGateway.BegingAcceptQuote(_quoteId);
 }
Exemplo n.º 22
0
 public async Task <QuoteEntity> GetByOperationIdAndStatusAsync(string operationId, QuoteStatus status)
 {
     try
     {
         return(await Quotes
                .Where(q => q.OperationId == operationId)
                .Where(q => q.Status == status)
                .FirstOrDefaultAsync());
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }