コード例 #1
0
 public IActionResult Edit(int id)
 {
     try
     {
         var fund = _fundService.GetFundById(id);
         return(View(fund));
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        public async Task updateDealFun(int objectID, decimal transactionAmount)
        {
            try
            {
                await _globalConfigurationService.SetValueConfig(Constants.Configuration.ProgramLocked, "true");

                Thread.Sleep(30 * 1000);

                var objectName = _fundService.GetFundById(objectID)?.Title;
                await _fundTransactionHistoryService.ApproveBalanceFund(objectID);

                await _taskCompletedService.SaveTaskCompleted(
                    new TaskCompletedModel()
                {
                    ObjectID          = objectID,
                    ObjectName        = objectName,
                    TaskType          = transactionAmount > 0 ? TaskTypeAccountant.Buy : TaskTypeAccountant.Sell,
                    TransactionAmount = transactionAmount
                });

                SendMailAdmin(objectName, objectName + " : " + transactionAmount.ToString("N0"));
            }
            finally
            {
                await _globalConfigurationService.SetValueConfig(Constants.Configuration.ProgramLocked, "false");
            }
        }
コード例 #3
0
        public IHttpActionResult GetAllFundsById(int id)
        {
            try
            {
                SupplierFundViewModels supplierFundDetailsVM = new SupplierFundViewModels();

                IEnumerable <SupplierFund> supplierFunds = new List <SupplierFund>();
                supplierFunds = _supplierFund.GetSupplierFunds(id);

                Supplier supplier = new Supplier();
                Fund     fund     = new Fund();
                FundMode fundMode = new FundMode();

                supplierFundDetailsVM.supplierFunds = new List <SupplierFundUpdateViewModel>();
                if (supplierFunds != null)
                {
                    foreach (SupplierFund supplierFund in supplierFunds)
                    {
                        SupplierFundUpdateViewModel supplierFundList = new SupplierFundUpdateViewModel();
                        supplier = _supplier.GetSupplier(supplierFund.SupplierId);
                        fund     = _fund.GetFundById(supplierFund.FundId);
                        fundMode = _fundMode.GetFundModeById(supplierFund.FundModeId);

                        supplierFundDetailsVM.supplierId = supplier.Id;

                        supplierFundList.fundModes      = new FundModeViewModels();
                        supplierFundList.fundModes.id   = fundMode.Id;
                        supplierFundList.fundModes.name = fundMode.Name;

                        supplierFundList.fundAmount     = supplierFund.Amount;
                        supplierFundList.supplierFundId = supplierFund.Id;

                        supplierFundList.fundNames      = new FundViewModels();
                        supplierFundList.fundNames.id   = fund.Id;
                        supplierFundList.fundNames.name = fund.Name;

                        //supplierFundDetailsVM.supplier.id = supplierFund.SupplierId;
                        //supplierFundDetailsVM.amount = supplierFund.Amount;
                        //supplierFundDetailsVM.fundModes.id = supplierFund.FundModeId;
                        //supplierFundDetailsVM.fundModes.name = supplierFund.FundMode.Name;
                        //supplierFundDetailsVM.funds = new FundViewModel();
                        //supplierFundDetailsVM.funds.id = _fund.GetFunds().Where(x=>x.Id == supplierFund.FundId).FirstOrDefault().Id;
                        //supplierFundDetailsVM.funds.name = supplierFund.Fund.Name;
                        supplierFundDetailsVM.supplierFunds.Add(supplierFundList);
                    }
                }
                var messageData  = new { code = ReadOnlyValue.SuccessMessageCode, message = ReadOnlyValue.MessageSuccess };
                var returnObject = new { supplierFundDetailsVM = supplierFundDetailsVM, messageCode = messageData };
                return(Ok(returnObject));
            }
            catch (Exception ex)
            {
                string errorLogId   = _eventLogService.WriteLogs(User.Identity.Name, ex, MethodBase.GetCurrentMethod().Name);
                var    messageData  = new { code = ReadOnlyValue.ErrorMessageCode, message = String.Format(ReadOnlyValue.MessageTaskmateError, errorLogId) };
                var    returnObject = new { messageCode = messageData };
                return(Ok(returnObject));
            }
        }