Пример #1
0
        public HttpResponseMessage approveRequest(approveRequest data)
        {
            COM.DBHelper sqlhelper = new COM.DBHelper();
            GlobalVarible.Clear();
            List <string> strvalidationResult = new List <string>();

            try
            {
                string token = _LOGINUSERID.ToString();

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

                MDL.ApproveRequest model = new ApproveRequest();

                model = new JavaScriptSerializer().Deserialize <MDL.ApproveRequest>(reqdata);

                strvalidationResult = ValidateApproveRequest(model);
                if (strvalidationResult.Count() == 0)
                {
                    if (checkpassword(model.loginpassword))
                    {
                        Guid wrid   = new Guid(model.wr_id);
                        Guid userid = Guid.Parse(User.Identity.GetUserId());

                        string[,] param = { { "WR_ID", wrid.ToString() }, { "UPPERID", userid.ToString() } };

                        COM.DBHelper.SQLReturnValue M = sqlhelper.ExecuteProcWithMessageKMT("WALLET_APPROVED", param, true);

                        if (M.ValueFromSQL == 1)
                        {
                            // get detail user device token

                            using (BAL.WalletRequest objUDT = new BAL.WalletRequest())
                            {
                                ENT.WalletRequest request = objUDT.GetRequestById(Guid.Parse(model.wr_id));

                                if (request != null)
                                {
                                    string message = "Your account is credited with with " + request.wr_amount.ToString();
                                    FCMNOTIFICATION.SendPushNotification(request.udt_devicetoken, message, request.wr_userid, 1);
                                }
                            }
                            GlobalVarible.AddMessage(M.MessageFromSQL);
                        }
                        else
                        {
                            throw new Exception(string.Join("<br />", M.MessageFromSQL));
                        }
                    }
                    else
                    {
                        throw new Exception(string.Join("<br />", "Invalid Password !"));
                    }
                }
                else
                {
                    throw new Exception(string.Join("<br />", strvalidationResult));
                }

                return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
            }
            catch (Exception ex)
            {
                GlobalVarible.AddError(ex.Message);
                ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty);
                return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
            }
        }
Пример #2
0
        public HttpResponseMessage doTransfer(doFundTransferModel data)
        {
            COM.DBHelper sqlhelper = new COM.DBHelper();
            GlobalVarible.Clear();
            List <string> strvalidationResult = new List <string>();

            try
            {
                string token = _LOGINUSERID.ToString();

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

                MDL.FundTransfer model = new FundTransfer();

                model = new JavaScriptSerializer().Deserialize <MDL.FundTransfer>(reqdata);

                strvalidationResult = ValidateFundTransfer(model);
                if (strvalidationResult.Count() == 0)
                {
                    if (checkpassword(model.up_password))
                    {
                        model.up_upperid = Guid.Parse(User.Identity.GetUserId());

                        string[,] param =
                        {
                            { "PARENTID",  model.up_upperid.ToString() },
                            { "USERID",    model.up_userid.ToString()  },
                            { "BALTOADD",  model.up_fundbalance        },
                            { "TRANSMODE", model.up_mode               },
                            { "REMARKS",   model.up_remakrs            },
                        };

                        COM.DBHelper.SQLReturnValue M = sqlhelper.ExecuteProcWithMessageKMT("ADD_FUND_TO_ACCOUNT", param, true);

                        if (M.ValueFromSQL == 1)
                        {
                            // get detail user device token

                            using (BAL.UserDeviceToken objUDT = new BAL.UserDeviceToken())
                            {
                                ENT.UserDeviceToken usertoken = objUDT.GetUserDeviceToken(model.up_userid);

                                if (usertoken != null)
                                {
                                    string message = "Your account is credited with with " + model.up_fundbalance.ToString();
                                    FCMNOTIFICATION.SendPushNotification(usertoken.udt_devicetoken, message, model.up_userid, 1);
                                }
                            }

                            GlobalVarible.AddMessage(M.MessageFromSQL);
                        }
                        else
                        {
                            throw new Exception(string.Join("<br />", M.MessageFromSQL));
                        }
                    }
                    else
                    {
                        throw new Exception(string.Join("<br />", "Invalid Password !"));
                    }
                }
                else
                {
                    throw new Exception(string.Join("<br />", strvalidationResult));
                }

                return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
            }
            catch (Exception ex)
            {
                GlobalVarible.AddError(ex.Message);
                ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty);
                return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
            }
        }
Пример #3
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 }));
            }
        }