public JsonResult ExtendCreditLimit(string agentid)
        {
            SubDistributorManagementCommon amc  = new SubDistributorManagementCommon();
            SubDistributorCreditLimitModel aclm = new SubDistributorCreditLimitModel();

            if (!string.IsNullOrEmpty(agentid))
            {
                string agent_id = agentid.DecryptParameter();
                if (!string.IsNullOrEmpty(agent_id))
                {
                    string username = ApplicationUtilities.GetSessionValue("UserName").ToString();
                    amc            = buss.GetSubDistributorById(agent_id, username);
                    aclm.AgentId   = amc.AgentID.EncryptParameter();
                    aclm.AgentName = amc.AgentName;
                    aclm.AgentCurrentCreditLimit = amc.AgentCreditLimit;

                    string value = string.Empty;
                    value = JsonConvert.SerializeObject(aclm, Formatting.Indented, new JsonSerializerSettings
                    {
                        ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                    });
                    return(Json(value, JsonRequestBehavior.AllowGet));
                }
            }
            this.ShowPopup(1, "Error");
            return(null);
        }
 public void ExtendCreditLimit(SubDistributorCreditLimitModel model)
 {
     if (ModelState.IsValid)
     {
         SubDistributorCreditLimitCommon clc = new SubDistributorCreditLimitCommon();
         clc            = model.MapObject <SubDistributorCreditLimitCommon>();
         clc.AgentId    = clc.AgentId.DecryptParameter();
         clc.ActionUser = ApplicationUtilities.GetSessionValue("UserName").ToString();
         clc.IpAddress  = ApplicationUtilities.GetIP();
         CommonDbResponse dbresp = buss.ExtendCreditLimit(clc);
         if (dbresp.Code == 0)
         {
             this.ShowPopup(0, dbresp.Message);
             return;
         }
         this.ShowPopup(1, dbresp.Message);
         return;
     }
     this.ShowPopup(1, "Credit Limit Not Changed");
     return;
 }