Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 使用其他用户覆盖登录_Asp.net Mvc_C# 4.0_Login - Fatal编程技术网

Asp.net mvc 使用其他用户覆盖登录

Asp.net mvc 使用其他用户覆盖登录,asp.net-mvc,c#-4.0,login,Asp.net Mvc,C# 4.0,Login,我正在使用asp.net mvc4应用程序 我有一些登录。我使用用户名和密码登录salesagent(ShopAccountType) 但现在我有一些其他登录只有一个代码。因此,目的是超级帐户(SalesAgent)使用用户名和密码登录。然后其他销售代理(balie用户)使用代码登录。因此,必须使用balie用户代码覆盖superaccount 我有一个控制器类,如下所示: public class V_ExtendedProfileController : ProfileController

我正在使用asp.net mvc4应用程序

我有一些登录。我使用用户名和密码登录salesagent(ShopAccountType)

但现在我有一些其他登录只有一个代码。因此,目的是超级帐户(SalesAgent)使用用户名和密码登录。然后其他销售代理(balie用户)使用代码登录。因此,必须使用balie用户代码覆盖superaccount

我有一个控制器类,如下所示:

 public class V_ExtendedProfileController : ProfileController
    {

        protected override void RegisterSystemRoutes(SanaRouteCollection routes)
        {
            routes.MapSystemPageRoute("Profile", "BalieNr", "BalieNr", "Profile/BalieNr");

            base.RegisterSystemRoutes(routes);
        }

        [HttpGet]
        public ActionResult BalieNr()
        {
            return View();
        }


        [HttpPost]
        [SanaValidateAntiForgeryToken]
        public ActionResult BalieNr(IEntityListLoadOptions options, ExtendedSalesAgentInfoModel model, string accountSalesAgentID, Guid? accountID  /*string accountId, ShopAccountType accountType,Customer.ICustomerListLoadOptions hallo*/)
        {

            var salesAgent = CommerceFramework.ShopAccounts.GetShopAccounts(options);

            Entity SalesAgenWithBaliecodeNr = new Entity();
            //IShopAccount LoginSalesAgent = CommerceFramework.ShopAccounts.GetShopAccount(accountID, true);



            if (ModelState.IsValid)
            {
                foreach (var item in salesAgent)
                {
                    if (item.ShopAccountType == ShopAccountType.SalesAgent)
                    {
                        if (model.Baliecode == "DB"    /*item.ReferenceId.Contains("HD")*/)
                        {
                            model.Name = "Dick Beekman";
                            var modelagent = ObjectManager.GetInstance<ExtendedSalesAgentInfoModel>();
                            modelagent.Name = Shop.ShopAccount.Name;
                            modelagent.Name = model.Name;





                        }

                        //var customer = CommerceFrameworkBase.SalesPersons.GetSalesPerson(accountID);
                        Console.WriteLine(accountID);

                    }
                    else
                        Console.WriteLine("false");
                }
            }

            Console.WriteLine(salesAgent);



            return View();
        }




    }
@{

    Layout = LayoutPaths.General;
}

@model Sana.Commerce.Customization.Account.ExtendedSalesAgentInfoModel

<div class="semicolumn">
    @*<div class="text">@Sana.RichText("Login_IntroductionText", makeImagesResponsive: true)</div>*@
    <div class="form-holder">
      @using (Html.BeginForm(htmlAttributes: new { @class = "form" }))
      {
            @Html.AntiForgeryToken()

            <table>
                <tr>
                    <th>
                        @Html.DisplayNameFor(model => model.Baliecode)
                    </th>
                    <th></th>
                </tr>

                <tr>
                    <td>
                        @Html.TextBoxFor(modelItem => modelItem.Baliecode)
                    </td>

                </tr>


            </table>
            <div class="form-row">


                @*@Sana.SubmitButton("Login", "btn btn-medium btn-login")*@
                <input type="submit" value="Login" />
            </div>
        }
    </div>
    <div>

    </div>
</div>
我在modelagent和model上看到Dick Beekman。但我仍然看到:

欢迎汉斯·阿尔伯特

那么,如何覆盖balie用户的superaccount

多谢各位

因此,如何超越现有的登录名,而不是用户名和密码。但是只有一个baliecode(字符串)。这就是问题所在


谢谢

请修改您的问题,使其更清楚。这没有意义。我编辑了这个问题。有人有什么建议吗?非常感谢。
 modelagent.Name = model.Name;