public HttpResponseMessage SendNotification()
        {
            GlobalVarible.Clear();

            using (BAL.UserDeviceToken objUDT = new BAL.UserDeviceToken())
            {
                ENT.UserDeviceToken usertoken = objUDT.GetUserDeviceToken(Guid.Parse("5a5537fc-0411-45c1-8960-b24bbf1ea375"));

                if (usertoken != null)
                {
                    string message = "Your account is credited with with 100. : " + DateTime.Now.Ticks.ToString();
                    FCMNOTIFICATION.SendPushNotification(usertoken.udt_devicetoken, message, Guid.Parse("5a5537fc-0411-45c1-8960-b24bbf1ea375"), 1);
                }
            }

            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 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 }));
            }
        }