Exemplo n.º 1
0
        public DL_BankTransReqReturn BankTransferReq(DL_BankTransReq bankReq)
        {
            this.SpName   = DL_StoreProcedure.SP_DHS_API_BankTransReq; //Sp Name
            bankReqReturn = new DL_BankTransReqReturn();
            _IsSuccess    = true;
            try
            {
                SqlParameter[] param = new SqlParameter[7];
                param[0] = new SqlParameter("@UserId", bankReq.UserId);
                param[1] = new SqlParameter("@Account", bankReq.Account);
                param[2] = new SqlParameter("@IFSC", bankReq.IFSC);
                param[3] = new SqlParameter("@CusName", bankReq.Name);
                param[4] = new SqlParameter("@Amount", bankReq.Amount);
                param[5] = new SqlParameter("@Mobile", bankReq.Mobile);
                param[6] = new SqlParameter("@Date", indianTime);

                ds = db.GetDataSet(this.SpName, param);
                if (ds != null && ds.Tables.Count > 0)
                {
                    var row = ds.Tables[0].Rows[0];
                    bankReqReturn = new DL_BankTransReqReturn {
                        Status = row["Status"].ToString(), AvailableBalance = row["AvailableBalance"].ToString(), RefId = row["RefId"].ToString()
                    };
                }
            }
            catch (Exception ex)
            {
                Exception err = ex;
                _IsSuccess = false;
            }

            return(bankReqReturn);
        }
 public HttpResponseMessage BankTransReq(HttpRequestMessage req, DL_BankTransReq bankTransReq)
 {
     try
     {
         User user = new User()
         {
             Password = bankTransReq.Key, UserId = bankTransReq.UserId
         };
         Validation.UserCheck(user);
         if (Validation._IsSuccess)
         {
             if (bankTransReq != null && bankTransReq.Amount > 0 && !string.IsNullOrEmpty(bankTransReq.UserId) &&
                 !string.IsNullOrEmpty(bankTransReq.IFSC) && !string.IsNullOrEmpty(bankTransReq.Key) && !string.IsNullOrEmpty(bankTransReq.Mobile))
             {
                 DL_BankTransReqReturn accountRegReturn = dash.BankTransferReq(bankTransReq);
                 if (dash._IsSuccess)
                 {
                     return(req.CreateResponse <DL_BankTransReqReturn>(HttpStatusCode.OK, accountRegReturn));
                 }
                 else
                 {
                     return(req.CreateErrorResponse(HttpStatusCode.InternalServerError, "ServerError"));
                 }
             }
             Logger.WriteLog(LogLevelL4N.FATAL, "Bad Request");
             return(req.CreateResponse(HttpStatusCode.BadRequest, "Bad Request"));
         }
     }
     catch (Exception ex)
     {
         Logger.WriteLog(LogLevelL4N.ERROR, "Inside the Account Registration api | Error : " + ex.Message);
         return(req.CreateResponse(HttpStatusCode.BadRequest, "Bad Request"));
     }
     Logger.WriteLog(LogLevelL4N.FATAL, "Unauthorized Request");
     return(req.CreateResponse(HttpStatusCode.Unauthorized, "Unauthorized"));
 }