public JsonResult UpdateStatus(string transid, int status, string accountid)
        {
            GlobalVarible.Clear();
            try
            {
                COM.MEMBERS.SQLReturnMessageNValue mUpdate = new BAL.Recharge().UpdateRecharge(
                    accountid,
                    !string.IsNullOrEmpty(transid) ? transid : "N/A",
                    status,
                    "Manually by : " + User.Identity.GetUserName());

                if (mUpdate.Outval > 0)
                {
                    GlobalVarible.AddMessage(mUpdate.Outmsg);
                }
                else
                {
                    GlobalVarible.AddError(mUpdate.Outmsg);
                }
            }
            catch (Exception ex)
            {
                GlobalVarible.AddError(ex.Message);
                ERRORREPORTING.Report(ex, Request.Url.ToString(), _LoginUserId, _ERRORKEY, (transid + "|" + status + "|" + accountid));
            }
            MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML();
            return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet));
        }
        public JsonResult getPendingRecharge()
        {
            List <ENT.Recharge> lstEntity = new List <ENT.Recharge>();

            BAL.Recharge objBAL = new BAL.Recharge();
            //jQuery DataTables Param
            var draw = Request.Form.GetValues("draw").FirstOrDefault();
            //Find paging info
            var start  = Request.Form.GetValues("start").FirstOrDefault();
            var length = Request.Form.GetValues("length").FirstOrDefault();
            //Find order columns info

            var search = Request.Form.Get("search[value]");

            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt16(start) : 1;

            skip = (skip / pageSize) + 1;
            COM.TTPagination.isPageing = true;
            COM.TTPagination.PageSize  = pageSize;
            COM.TTPagination.PageNo    = Convert.ToInt64(skip);

            if (User.IsInRole("administrator"))
            {
                lstEntity = objBAL.GetPendingListAdmin(search.ToString());
            }
            else
            {
                lstEntity = objBAL.GetPending(_LoginUserId, search.ToString());
            }

            return(Json(new
            {
                draw = draw,
                recordsTotal = lstEntity.Count(),
                recordsFiltered = COM.TTPagination.RecordCount,
                data = lstEntity
            }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult doRecharge(ENT.Recharge recharge)
        {
            GlobalVarible.Clear();
            try
            {
                recharge.reqvia      = "WEB";
                recharge.countrycode = "IN";
                recharge.accountref  = DateTime.Now.Ticks.ToString();
                recharge.userid      = _LoginUserId;
                recharge.ipaddress   = Request.UserHostAddress.ToString();

                // this will be provided after recharge

                recharge.requestid = string.Empty;

                COM.MEMBERS.SQLReturnMessageNValue response = new COM.MEMBERS.SQLReturnMessageNValue();

                using (BAL.Recharge objBal = new BAL.Recharge())
                {
                    response = objBal.DoRecharge(recharge, _LoginUserId, recharge.ipaddress);
                }

                string LocalID = string.Empty;

                if (response.Outval == 1)
                {
                    // manage route here to call real api for process recharge.
                    string[] REQ = response.Outmsg.Split(';');

                    // add log or response here.
                    new BAL.Log().Insert(new ENT.Log()
                    {
                        logdata         = REQ[1],
                        CreatedDateTime = DateTime.Now,
                        type            = COM.MyEnumration.LOGTYPE.DATA,
                        title           = "PORTAL-REQUEST"
                    });

                    #region WEBSMITHAPI
                    if (REQ[0].Split(':')[2].StartsWith("W"))
                    {
                        LocalID = REQ[0].Split(':')[2].StartsWith("W") ? REQ[0].Split(':')[2].Remove(0, 1) : REQ[0].Split(':')[2];
                        ProcessRecharge(recharge.numbertorecharge, recharge.operatorcode, (int)recharge.amount, LocalID, recharge.reqtype);
                    }
                    else if (REQ[0].Split(':')[2].StartsWith("X"))
                    {
                        LocalID = REQ[0].Split(':')[2].StartsWith("X") ? REQ[0].Split(':')[2].Remove(0, 2) : REQ[0].Split(':')[2];

                        ProcessINOUT(REQ[1], LocalID);
                    }
                    #endregion

                    GlobalVarible.AddMessage(REQ[0].Split(',')[0]);
                }
                else
                {
                    GlobalVarible.AddError(response.Outmsg);
                }
                return(Json(MySession.Current.MessageResult));
            }
            catch (Exception ex)
            {
                ERRORREPORTING.Report(ex, Request.Url.ToString(), _LoginUserId, _ERRORKEY, new JavaScriptSerializer().Serialize(recharge));
                GlobalVarible.AddError(ex.Message);
                return(Json(MySession.Current.MessageResult));
            }
        }
Exemple #4
0
        public HttpResponseMessage DoRechargeEnc(doRechargeModel data)
        {
            try
            {
                string token = _LOGINUSERID.ToString();

                if (String.IsNullOrEmpty(token))
                {
                    GlobalVarible.AddError("Unable to get token");
                    ERRORREPORTING.Report(new Exception("UNABLE TO GET TOKEN"), _REQUESTURL, _LOGINUSERID, _ERRORKEY, new JavaScriptSerializer().Serialize(data));
                    return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
                }

                string reqdata = ENCDESC.Decrypt(data.data, token, data.userid);

                ENT.Recharge recharge = new ENT.Recharge();

                recharge = new JavaScriptSerializer().Deserialize <ENT.Recharge>(reqdata);

                try
                {
                    ERRORREPORTING.Report(new Exception("API CALL STARTED"), _REQUESTURL, _LOGINUSERID, _ERRORKEY, reqdata);

                    recharge.reqvia      = "GPRS";
                    recharge.countrycode = "IN";
                    recharge.accountref  = DateTime.Now.Ticks.ToString();
                    recharge.userid      = _LOGINUSERID;
                    recharge.ipaddress   = HttpContext.Current.Request.UserHostAddress;

                    // this will be provided after recharge

                    recharge.requestid = string.Empty;

                    COM.MEMBERS.SQLReturnMessageNValue response = new COM.MEMBERS.SQLReturnMessageNValue();

                    using (BAL.Recharge objBal = new BAL.Recharge())
                    {
                        response = objBal.DoRecharge(recharge, _LOGINUSERID, recharge.ipaddress);
                    }

                    if (response.Outval == 1)
                    {
                        string[] REQ = response.Outmsg.Split(';');

                        // process for real recharge here.

                        GlobalVarible.AddMessage(REQ[0].Split(',')[0]);
                    }
                    else
                    {
                        GlobalVarible.AddError(response.Outmsg);
                    }
                    return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
                }
                catch (Exception ex)
                {
                    ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, new JavaScriptSerializer().Serialize(recharge));
                    GlobalVarible.AddError(ex.Message);
                    return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
                }
            }
            catch (Exception ex)
            {
                ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, new JavaScriptSerializer().Serialize(data));
                GlobalVarible.AddError(ex.Message);
                return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
            }
        }