public ActionResult ManageDistributor(string UserName, string agentId = "")
        {
            DistributorManagementModel DMM = new DistributorManagementModel();

            if (!string.IsNullOrEmpty(agentId))
            {
                DMM.AgentID = agentId.DecryptParameter();
                if (!string.IsNullOrEmpty(DMM.AgentID))
                {
                    DistributorManagementCommon DC = buss.GetDistributorById(DMM.AgentID, UserName.DecryptParameter());
                    DMM         = DC.MapObject <DistributorManagementModel>();
                    DMM.AgentID = DMM.AgentID.EncryptParameter();
                    DMM.UserID  = DMM.UserID.EncryptParameter();
                }
            }
            LoadDropDownList(DMM);
            return(View(DMM));
        }
        // GET: Admin/Distributor/User/Id
        public ActionResult ManageDistributorUsers(string distid, string UserId = "")
        {
            var    UserType = Session["UserType"].ToString();
            string distributor_id = "", IsPrimary = ApplicationUtilities.GetSessionValue("IsPrimaryUser").ToString();

            if (UserType.ToUpper() == "SUB-DISTRIBUTOR")
            {
                return(RedirectToAction("Index", "SubDistributor"));
            }
            else if (UserType.ToUpper() == "DISTRIBUTOR")
            {
                distributor_id = Session["AgentId"].ToString();
            }
            else
            {
                distributor_id = distid.DecryptParameter();
            }
            DistributorManagementCommon DMC = new DistributorManagementCommon();
            var user_id = UserId.DecryptParameter();

            if (string.IsNullOrEmpty(distributor_id))
            {
                return(RedirectToAction("Index"));
            }
            if (!string.IsNullOrEmpty(UserId))
            {
                if (string.IsNullOrEmpty(user_id))
                {
                    return(RedirectToAction("ViewDistributorUser", new { DistId = distributor_id.EncryptParameter() }));
                }
                string username = ApplicationUtilities.GetSessionValue("username").ToString();
                DMC        = buss.GetUserById(distributor_id, user_id, username);
                DMC.UserID = user_id.EncryptParameter();
            }
            DMC.AgentID = distributor_id.EncryptParameter();
            DistributorManagementModel DMM = DMC.MapObject <DistributorManagementModel>();

            LoadDropDownList(DMM);
            return(View(DMM));
        }