public void ManageGatewayBalance(GatewayBalanceModel model)
        {
            if (ModelState.IsValid)
            {
                GatewayBalanceCommon common = new GatewayBalanceCommon();
                common.Gatewayid      = model.Gatewayid.DecryptParameter();
                common.BalanceToBeAdd = Math.Abs(model.BalanceToBeAdd);
                common.ActionUser     = Session["UserName"].ToString();
                common.IpAddress      = ApplicationUtilities.GetIP();
                common.Remarks        = model.Remarks;
                CommonDbResponse dbresp = buss.updatebalance(common);

                if (dbresp.Code == 0)
                {
                    this.ShowPopup(0, "Succesfully Added");
                    return;
                    //dbresp.SetMessageInTempData(this);
                    //return ("1");
                    //       return RedirectToAction("Detail");
                }
            }
            else
            {
                this.ShowPopup(1, "Amount Not Added");
            }
        }
        /*
         * public ActionResult GatewayBalanceDetail(string Search = "", int Pagesize = 10)
         * {
         *
         *  var list = buss.GetGatewayList();
         *
         *  //   dynamic list = null;
         *
         *  foreach (var item in list)
         *  {
         *      item.Action = "<input type='button' value='Add Balance' onclick=showpopupmodel('" + item.GatewayId.EncryptParameter() + "')></input>"; // StaticData.GetActions("Gateway", item.GatewayId.EncryptParameter(), this, "/Admin/Gateway/ManageGatewayBalance", "showpopupmodel" + item.GatewayId.EncryptParameter(), item.GatewayStatus);
         *      item.GatewayStatus = "<span class='badge badge-" + (item.GatewayStatus.Trim().ToUpper() == "Y" ? "success" : "danger") + "'>" + (item.GatewayStatus.Trim().ToUpper() == "Y" ? "Enable" : "Disable") + "</span>";
         *  }
         *  //  var list = buss.GetGatewayList(gateway_Id);
         *
         *  IDictionary<string, string> param = new Dictionary<string, string>();
         *  //  param.Add("GatewayId", "Gateway ID");
         *  param.Add("GatewayName", "Gateway Name");
         *  param.Add("GatewayBalance", "Available Balance");
         * //   param.Add("GatewayURL", "Gateway URL");
         *  param.Add("GatewayStatus", "Gateway Status");
         *  param.Add("Action", "Action");
         *
         *  ProjectGrid.column = param;
         *  var grid = ProjectGrid.MakeGrid(list, "Gateway", Search, Pagesize, true, "", "", "Home", "Gateway", "/Admin/Gateway", "");
         *  ViewData["grid"] = grid;
         *  return View();
         * }*/
        #endregion
        public JsonResult ManageGatewayBalance(string GatewayID = "")
        {
            GatewayCommon       gatewaycommon = new GatewayCommon();
            GatewayBalanceModel balance       = new GatewayBalanceModel();

            if (!string.IsNullOrEmpty(GatewayID))
            {
                string gateway_id = GatewayID.DecryptParameter();
                gatewaycommon       = buss.GetGatewayById(gateway_id);
                balance.Gatewayid   = gatewaycommon.GatewayId.EncryptParameter();
                balance.GatewayName = gatewaycommon.GatewayName;
                //gatewaymodel.GatewayUsername = gatewaycommon.GatewayUsername;//.DecryptParameter();
                //gatewaymodel.GatewayPwd = gatewaycommon.GatewayPwd;//.DecryptParameter();
                balance.AvaliableBalance = decimal.Parse(gatewaycommon.GatewayBalance);

                //gatewaymodel.GatewayURL = gatewaycommon.GatewayURL;//.DecryptParameter();
                //gatewaymodel.GatewayAccessCode = gatewaycommon.GatewayAccessCode;//.DecryptParameter();
                //gatewaymodel.GatewaySecurityCode = gatewaycommon.GatewaySecurityCode;//.DecryptParameter();
                //gatewaymodel.GatewayApitoken = gatewaycommon.GatewayApitoken;//.DecryptParameter();
                //balance.GatewayStatus = "<span class='badge badge-" + (gatewaycommon.GatewayStatus.Trim().ToUpper() == "Y" ? "success" : "danger") + "'>" + (gatewaycommon.GatewayStatus.Trim().ToUpper() == "Y" ? "Enable" : "Disable") + "</span>";
                //gatewaymodel.IsDirectGateway = gatewaycommon.IsDirectGateway;
                //gatewaymodel.GatewayType = gatewaycommon.GatewayType;
                //gatewaymodel.GatewayCountry = gatewaycommon.GatewayCountry;
                balance.GatewayCurrency = gatewaycommon.GatewayCurrency;

                //gatewaymodel.GatewayContact = gatewaycommon.GatewayContact;
                string value = string.Empty;
                value = JsonConvert.SerializeObject(balance, Formatting.Indented, new JsonSerializerSettings
                {
                    ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                });
                return(Json(value, JsonRequestBehavior.AllowGet));
            }


            //gatewaymodel.IsDirectGatewayList = LoadDropdownList("directindirect") as List<SelectListItem>;
            //gatewaymodel.GatewayTypeList = LoadDropdownList("gatewaytype") as List<SelectListItem>;
            //// gatewaymodel.GatewayCurrencyList = ApplicationUtilities.SetDDLValue(ICB.sproc_get_dropdown_list("20"), gatewaymodel.GatewayCurrency, "Select Currency");
            //gatewaymodel.GatewayCountryList = ApplicationUtilities.SetDDLValue(ICB.sproc_get_dropdown_list("030"), gatewaymodel.GatewayCurrency, "Select Country");

            this.ShowPopup(1, "Error");
            return(null);
        }