public BizResponse CreateTransaction(NewTransactionRequestCls NewtransactionReq)
 {
     _Resp = new BizResponse();
     try
     {
         var Newtransaction = new TransactionQueue()
         {
             TrnMode            = NewtransactionReq.TrnMode,
             TrnType            = Convert.ToInt16(NewtransactionReq.TrnType),
             MemberID           = NewtransactionReq.MemberID,
             MemberMobile       = NewtransactionReq.MemberMobile,
             TransactionAccount = NewtransactionReq.TransactionAccount,
             SMSCode            = NewtransactionReq.SMSCode,
             Amount             = NewtransactionReq.Amount,
             Status             = 0,
             StatusCode         = 0,
             StatusMsg          = "Initialise",
             TrnRefNo           = NewtransactionReq.TrnRefNo,
             AdditionalInfo     = NewtransactionReq.AdditionalInfo
         };
         _TransactionRepository.Add(Newtransaction);
         return(new BizResponse {
             ReturnMsg = "Success", ReturnCode = enResponseCodeService.Success
         });
     }
     catch (Exception ex)
     {
         _log.LogError(ex, "exception,\nMethodName:" + System.Reflection.MethodBase.GetCurrentMethod().Name + "\nClassname=" + this.GetType().Name, LogLevel.Error);
         return(new BizResponse {
             ReturnMsg = ex.Message, ReturnCode = enResponseCodeService.InternalError
         });
     }
 }
Exemplo n.º 2
0
        public async Task <JsonResult> Sops(String LINE, String STN, String PARTNO)
        {
            BizRequest req = ClientMgr.Instance.CreateRequest("MES",
                                                              LINE, "ESOP", "LoadESOP", new Dictionary <string, string>()
            {
                { "ln", LINE },
                { "st", STN },
                { "pn", String.IsNullOrEmpty(PARTNO) ? "ALL" : PARTNO }
            });

            req.UserId = User.Identity.Name;

            BizResponse resp = await Task <BizResponse> .Run(() =>
            {
                return(ClientMgr.Instance.RunCmd(req.CmdName, req));
            });

            CmdResponse response = new CmdResponse()
            {
                Code = resp.ErrorCode,
                Msg  = resp.ErrorMessage,
                Data = resp.Data
            };

            return(Json(response));
        }
Exemplo n.º 3
0
        public async Task <BizResponse> CancelTransaction(TransactionCancelModel transactionCancelModel) //add by lalji 23/08/2019
        {
            var buyer = await _buyerRepository.GetBuyerById(transactionCancelModel);

            try
            {
                if (buyer == null)
                {
                    BizResponse bizResponse = new BizResponse();
                    bizResponse.ErrorCode     = Domain.Enum.enErrorCode.TransactionNotFoundError;
                    bizResponse.StatusCode    = (int)TransactionStatus.ProviderFail;
                    bizResponse.StatusMessage = "transaction not found";

                    return(bizResponse);
                }
                else
                {
                    buyer.StatusChangeToCancleStatus();
                    buyer.InsertDateAndTime();
                    await _buyerRepository.UpdateBuyerData(buyer);

                    BizResponse bizResponse = new BizResponse();
                    bizResponse.ErrorCode     = Domain.Enum.enErrorCode.Success;
                    bizResponse.StatusCode    = (int)TransactionStatus.Success;
                    bizResponse.StatusMessage = "Transaction cancelled successfully";
                    return(bizResponse);
                }
            }
            catch (Exception)
            {
                return(new BizResponse {
                    ErrorCode = Domain.Enum.enErrorCode.InternalError, StatusMessage = "Internel error", StatusCode = (int)TransactionStatus.ProviderFail
                });
            }
        }
Exemplo n.º 4
0
        public async Task <IActionResult> SellerCancelTransaction([FromBody] TransactionCancelModel transactionCancelModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            BizResponse response = await _sellerService.CancelTransaction(transactionCancelModel);

            return(Ok(response));
        }
Exemplo n.º 5
0
        public async Task <ActionResult> Index(SopRequest request)
        {
            ViewBag.Title = ModelName;
            await InitSelect(request.LINE, request.STN, request.PARTNO);

            int    p       = request.FILE.FileName.LastIndexOf(".");
            String fileExt = request.FILE.FileName.Substring(p);
            String path    = Path.GetTempFileName() + fileExt;

            ENG_LINESTATION stn = await db.ENG_LINESTATION
                                  .Where(s => s.LINENAME.Equals(request.LINE) && s.L_STNO.Equals(request.STN))
                                  .SingleOrDefaultAsync();

            BizRequest req = ClientMgr.Instance.CreateRequest("MES",
                                                              String.Format("{0};{1};{2}", stn.LINENAME, stn.L_OPNO, stn.L_STNO),
                                                              "ESOP", "UploadESOP", new Dictionary <string, string>()
            {
                { "ln", stn.LINENAME },
                { "st", stn.L_STNO },
                { "pn", request.PARTNO ?? "ALL" },
                { "f", path }
            });

            BizResponse resp = await Task <BizResponse> .Run(() =>
            {
                try
                {
                    request.FILE.SaveAs(path);
                    return(ClientMgr.Instance.RunCmd(req.CmdName, req));
                }
                finally
                {
                    System.IO.File.Delete(path);
                }
            });

            if (!BizResponses.OK.Equals(resp.ErrorCode))
            {
                ModelState.AddModelError("FILE", resp.ErrorMessage);
            }

            return(View(request));
        }
Exemplo n.º 6
0
        public async Task <IHttpActionResult> Run([FromBody] CmdRequest request)
        {
            BizRequest req = ClientMgr.Instance.CreateRequest(request.Server, request.Client, request.Entity, request.Cmd, request.Args);

            req.UserId = User.Identity.Name;
            BizResponse resp = await Task <BizResponse> .Run(() =>
            {
                return(ClientMgr.Instance.RunCmd(req.CmdName, req));
            });

            CmdResponse response = new CmdResponse()
            {
                Code  = resp.ErrorCode,
                Msg   = resp.ErrorMessage,
                Code2 = resp.ReturnCode,
                Msg2  = resp.ReturnMessage,
                Data  = resp.Data
            };

            return(Ok(response));
        }
Exemplo n.º 7
0
        public async Task <BizResponse> ProcessCancelOrderAsync(CancelOrderRequest Req, string accessToken)
        {
            BizResponse _Resp = new BizResponse();

            try
            {
                var TradeTranQueueObj = _TradeTransactionRepository.GetSingle(item => item.TrnNo == Req.TranNo);
                if (TradeTranQueueObj != null)
                {
                    _Resp.ErrorCode  = enErrorCode.CancelOrder_NoRecordFound;
                    _Resp.ReturnCode = enResponseCodeService.Fail;
                    _Resp.ReturnMsg  = "No Record Found";
                    return(_Resp);
                }
                if (TradeTranQueueObj.Status != Convert.ToInt16(enTransactionStatus.Hold))
                {
                    _Resp.ErrorCode  = enErrorCode.CancelOrder_TrnNotHold;
                    _Resp.ReturnCode = enResponseCodeService.Fail;
                    _Resp.ReturnMsg  = "Order is not in pending State";
                    return(_Resp);
                }
                if (TradeTranQueueObj.IsCancelled == 1)
                {
                    _Resp.ErrorCode  = enErrorCode.CancelOrder_OrderalreadyCancelled;
                    _Resp.ReturnCode = enResponseCodeService.Fail;
                    _Resp.ReturnMsg  = "Transaction Cancellation request is already in processing";
                    return(_Resp);
                }

                var NewBuyRequestObj = _TradeBuyRequest.GetSingle(item => item.TrnNo == Req.TranNo &&
                                                                  (item.Status == Convert.ToInt16(enTransactionStatus.Hold) ||
                                                                   item.Status == Convert.ToInt16(enTransactionStatus.Pending)));
                if (NewBuyRequestObj != null)
                {
                    if (NewBuyRequestObj.IsProcessing == 0)
                    {
                        _Resp.ErrorCode  = enErrorCode.CancelOrder_YourOrderInProcessMode;
                        _Resp.ReturnCode = enResponseCodeService.Fail;
                        _Resp.ReturnMsg  = "Your Order is in process mode,please try again";
                        return(_Resp);
                    }
                    if (NewBuyRequestObj.PendingQty == 0)
                    {
                        _Resp.ErrorCode  = enErrorCode.CancelOrder_Yourorderfullyexecuted;
                        _Resp.ReturnCode = enResponseCodeService.Fail;
                        _Resp.ReturnMsg  = "Can not initiate Cancellation Request.Your order is fully executed";
                        return(_Resp);
                    }
                    //TradeTranQueueObj.IsCancelled = 1;
                    //_TradeTransactionRepository.Update(TradeTranQueueObj);

                    var HoldTrnNosNotExec = new List <long> {
                    };
                    _Resp = await _SettlementRepository.PROCESSSETLLEMENT(_Resp, NewBuyRequestObj, ref HoldTrnNosNotExec, accessToken, 1);
                }
                else
                {
                    _Resp.ErrorCode  = enErrorCode.CancelOrder_NoRecordFound;
                    _Resp.ReturnCode = enResponseCodeService.Fail;
                    _Resp.ReturnMsg  = "No Record Found";
                    return(_Resp);
                }
            }
            catch (Exception ex)
            {
                HelperForLog.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.GetType().Name, ex);
                _Resp.ErrorCode  = enErrorCode.CancelOrder_InternalError;
                _Resp.ReturnCode = enResponseCodeService.Fail;
                _Resp.ReturnMsg  = "Internal Error";
            }
            return(_Resp);
        }