예제 #1
0
파일: MockService.cs 프로젝트: radtek/vas
        public Task <IServiceResult <string> > Adjust(InvoiceAdjustment param)
        {
            //Essentialy need to Send to the Adjustment Service and then re-fetch the summary again.
            var mock   = GetInvoiceSummary(Int32.Parse(param.InvoiceId)).Result;
            var result = new Task <IServiceResult <string> >(() =>
                                                             new ServiceResult <string>(Success, string.Empty, true));

            result.RunSynchronously(TaskScheduler.Default);
            return(result);
        }
예제 #2
0
 private object GetAdjustmentSerializationData(InvoiceAdjustment param)
 {
     return(new
     {
         InvoiceId = !string.IsNullOrEmpty(param.InvoiceId) ? param.InvoiceId : string.Empty,
         ReasonId = param.ReasonId,
         NarrativeText = !string.IsNullOrEmpty(param.NarrativeText) ? param.NarrativeText : string.Empty,
         AdjustmentMode = !string.IsNullOrEmpty(param.AdjustmentModeText) ? param.AdjustmentModeText : string.Empty,
         AdjustmentAmount = !string.IsNullOrEmpty(param.AdjustmentAmount) ? param.AdjustmentAmount : string.Empty,
         AdjustmentType = !string.IsNullOrEmpty(param.AdjustmentTypeText) ? param.AdjustmentTypeText : string.Empty,
         AdjustmentStyle = !string.IsNullOrEmpty(param.AdjustmentStyleText) ? param.AdjustmentStyleText : string.Empty,
         NetTotal = !string.IsNullOrEmpty(param.NetTotal) ? param.NetTotal : string.Empty
     });
 }
예제 #3
0
        public async void SaveAdjustment()
        {
            try
            {
                T360Validator.ValidateAdjustInvoice(AdjustedAmount.ToString(), SelectedReasonId);

                var isOk = await ShowConfirmationMessage(Constants.AdjustConfirmationMsg, Constants.AdjustmentConfirmation);

                if (!isOk)
                {
                    return;
                }

                IsBusy         = true;
                AdjustmentInfo = new InvoiceAdjustment();
                AdjustmentInfo.NarrativeText    = NarrativeText;
                AdjustmentInfo.AdjustmentStyle  = AdjustmentByTo;
                AdjustmentInfo.InvoiceId        = this.InvoiceSummary.InvoiceId.ToString();
                AdjustmentInfo.AdjustmentAmount = AdjustmentSign == AdjustmentSign.Positive
                                                ? Convert.ToDouble(AdjustedAmount).ToString(CultureInfo.InvariantCulture)
                                                : "-" + Convert.ToDouble(AdjustedAmount).ToString(CultureInfo.InvariantCulture);
                AdjustmentInfo.ReasonId       = SelectedReasonId;
                AdjustmentInfo.NetTotal       = CleanNetTotal(NetAmount, true);
                AdjustmentInfo.AdjustmentMode = AdjustmentToggleType;
                AdjustmentInfo.AdjustmentType = AdjustmentType;

                var serializableData = GetAdjustmentSerializationData(AdjustmentInfo);
                var data             = await ServiceInvoker.Instance.InvokeServiceUsingPost <string>(ServiceInvoker.Instance.AppendUrl(ServiceInvoker.AdjustInvoiceService), serializableData, true, false);

                IsBusy = false;
                Messenger.Default.Send <ResetListParameter>(new ResetListParameter()
                {
                });
                Navigator.Navigate(Destination.InvoiceListView, ExistingViewBehavior.Remove, new object[] { });
            }
            catch (T360Exception ex)
            {
                string message = getMessages(ex);
                ShowErrorMessage(message, Constants.AdjustmentFailed);
            }
        }
예제 #4
0
        public ActionResult AddInvoice(Invoice invoice, InvoiceAdjustment invoiceAdjustment)
        {
            string path     = GlobalConst.ConstantChar.Blank;
            string filename = Guid.NewGuid().ToString() + GlobalConst.Extension.PDF;
            int    _InvID;
            var    _depID = 0;

            if (invoice.InvoiceID == 0)
            {
                if (invoice.DepartmentId == 5)
                {
                    _depID = GlobalConst.CommonValues.Five;
                }
                else
                {
                    _depID = GlobalConst.CommonValues.One;
                }

                if (invoice.DepartmentId == 5 && invoice.UploadFile != null)
                {
                    filename = Guid.NewGuid().ToString() + GlobalConst.Extension.PDF;
                    invoice.InvoiceFileName = filename;
                    string _dueDateString = _paymentRefund.GetNetworkingDays(Convert.ToString(invoice.InvoiceDate), _depID);
                    invoice.InvoiceDueDate = Convert.ToDateTime(_dueDateString);
                    _InvID = _invoice.AddInvoiceRecord(Mapper.Map <LMGEDI.Core.Data.Model.Invoice>(invoice));
                    path   = _storageServices.CreateInvoiceICFolder(_InvID, Server.MapPath(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath]));
                    path   = path + GlobalConst.ConstantChar.SingleQouteDoubleSlash + filename;
                    invoice.UploadFile.SaveAs(path);
                }
                else
                {
                    invoice.InvoiceDueDate = Convert.ToDateTime(_paymentRefund.GetNetworkingDays(Convert.ToString(invoice.InvoiceDate), _depID));
                    _InvID = _invoice.AddInvoiceRecord(Mapper.Map <LMGEDI.Core.Data.Model.Invoice>(invoice));
                }
                invoiceAdjustment.InvoiceID = _InvID;
                if (_InvID != 0)
                {
                    int InvAdjID = _invoice.AddInvoiceAdjustment(Mapper.Map <LMGEDI.Core.Data.Model.InvoiceAdjustment>(invoiceAdjustment));
                }
                return(Json(_InvID, GlobalConst.ContentTypes.TextHtml));
            }
            else
            {
                if (invoice.DepartmentId == 5 && invoice.UploadFile != null)
                {
                    path = _storageServices.CreateInvoiceICFolder(invoice.InvoiceID, Server.MapPath(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath]));
                    path = path + GlobalConst.ConstantChar.SingleQouteDoubleSlash + filename;
                    invoice.UploadFile.SaveAs(path);
                    invoice.InvoiceFileName = filename;
                }


                if (invoice.DepartmentId == 5)
                {
                    _depID = GlobalConst.CommonValues.Five;
                }
                else
                {
                    _depID = GlobalConst.CommonValues.One;
                }


                invoice.InvoiceDueDate = Convert.ToDateTime(_paymentRefund.GetNetworkingDays(Convert.ToString(invoice.InvoiceDate), _depID));
                _InvID = _invoice.UpdateInvoiceRecord(Mapper.Map <LMGEDI.Core.Data.Model.Invoice>(invoice));
                invoiceAdjustment.InvoiceID = invoice.InvoiceID;
                int InvAdjID = _invoice.AddInvoiceAdjustment(Mapper.Map <LMGEDI.Core.Data.Model.InvoiceAdjustment>(invoiceAdjustment));

                return(Json(invoice.InvoiceID, GlobalConst.ContentTypes.TextHtml));
            }
        }