public JsonResult GetAll(int ddrange, string fromdate, string todate, int ddData)
        {
            List <ENT.WalletRequest> lstEntity = new List <ENT.WalletRequest>();
            //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 sortColumn    = Request.Form.GetValues("columns[" + Request.Form.GetValues("order[0][column]").FirstOrDefault() + "][data]").FirstOrDefault();
            var sortColumnDir = Request.Form.GetValues("order[0][dir]").FirstOrDefault();

            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);
            lstEntity = new BAL.WalletRequest().GetAllSearch(ddrange, fromdate.GetDate(), todate.GetDate(), ddData, User.GetUserlevel(), Guid.Parse(User.Identity.GetUserId()));
            return(Json(new
            {
                draw = draw,
                recordsTotal = lstEntity.Count(),
                recordsFiltered = COM.TTPagination.RecordCount,
                data = lstEntity
            }, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public HttpResponseMessage PendingApprovalRequest(GetPendingWalletRequestModel modal)
        {
            GlobalVarible.Clear();
            List <ENT.WalletRequestApiView> lstEntity = new List <ENT.WalletRequestApiView>();

            try
            {
                //Find paging info
                var start  = modal.PageStart;
                var length = modal.PageSize;

                int pageSize = length != 0 ? length : 0;
                int skip     = start != 0 ? start : 1;
                skip = (skip / pageSize) + 1;

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

                using (BAL.WalletRequest objBal = new BAL.WalletRequest())
                {
                    // lstEntity = new BAL.WalletRequest().GetAllSearch(ddrange, fromdate.GetDate(), todate.GetDate(), ddData, User.GetUserlevel(), Guid.Parse(User.Identity.GetUserId()));

                    if (modal.ddrange == 1)
                    {
                        lstEntity = objBal.GetAllSearchApi(modal.ddrange, modal.fromdate.GetDate(), modal.todate.GetDate(), modal.ddData, User.GetUserlevel(), _LOGINUSERID);
                    }
                    else
                    {
                        lstEntity = objBal.GetAllSearchApi(modal.ddrange, DateTime.Now, DateTime.Now, modal.ddData, User.GetUserlevel(), _LOGINUSERID);
                    }
                }

                GlobalVarible.AddMessage("Approval Pending get successfully.");
                return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult, lstEntity, COM.TTPagination.RecordCount }));
            }
            catch (Exception ex)
            {
                GlobalVarible.AddError(ex.Message);
                ERRORREPORTING.Report(ex, _REQUESTURL, _LOGINUSERID, _ERRORKEY, string.Empty);
                return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { GlobalVarible.FormResult }));
            }
        }
Exemple #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 }));
            }
        }