コード例 #1
0
        public object GetEntityByPerameters(object Entity, Dictionary <string, COM.Enumration.Operators> parFields)
        {
            object objEntity = null;

            try
            {
                objEntity = new COM.DBHelper().GetEnityByPerameters(Entity, parFields);
            }
            catch (Exception)
            {
                objEntity = null;
                throw;
            }
            return(objEntity);
        }
コード例 #2
0
        public object GetEntityByPrimartKey(object Entity)
        {
            object objEntity = null;

            try
            {
                objEntity = new COM.DBHelper().GetEnityByPrimaryKey(Entity);
            }
            catch (Exception)
            {
                objEntity = null;
                throw;
            }
            return(objEntity);
        }
コード例 #3
0
        public HttpResponseMessage doWalletRequest(MDL.WalletRequest model)
        {
            GlobalVarible.Clear();
            List <string> strvalidationResult = new List <string>();

            try
            {
                COM.DBHelper sqlhelper = new COM.DBHelper();
                strvalidationResult = ValidateWalletRequest(model);
                if (strvalidationResult.Count() == 0)
                {
                    model.userid = Guid.Parse(User.Identity.GetUserId());

                    string[,] param = { { "USERID",    model.userid.ToString()               }, { "AMOUNT",   model.wr_amount   }, { "TRANSMODE", model.wr_mode.ToString() },
                                        { "ACCOUNTNO", model.wr_accountno                    }, { "BANKNAME", model.wr_bankname }, { "REFID",     model.wr_refrenceid      },{ "REMARKS", model.wr_remakrs },
                                        { "USERLEVEL", ((int)User.GetUserlevel()).ToString() } };
                    COM.DBHelper.SQLReturnValue M = sqlhelper.ExecuteProcWithMessageKMT("WALLET_REQUEST", param, true);
                    if (M.ValueFromSQL == 1)
                    {
                        GlobalVarible.AddMessage(M.MessageFromSQL);
                    }
                    else
                    {
                        throw new Exception(string.Join("<br />", M.MessageFromSQL));
                    }
                }
                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, new JavaScriptSerializer().Serialize(model));
                return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
            }
        }
コード例 #4
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 }));
            }
        }
コード例 #5
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 }));
            }
        }