1

谁能指导我如何在 Acumatica 中自定义登录页面?我想在选择公司登录时添加一些信息。感谢您的支持。

4

2 回答 2

1

这是我的把戏

首先修改你的 Frames/Login.aspx.cs 并添加以下函数

    private DataSet GetCompanyList()
    {
        string connectionString = ConfigurationManager.ConnectionStrings["ProjectX"].ConnectionString;
        string queryString = "SELECT b.AcctCD, b.AcctName FROM BAccount b WHERE b.[Type] = 'CP'";
        SqlDataAdapter adapter = new SqlDataAdapter(queryString, connectionString);

        DataSet companies = new DataSet();
        adapter.Fill(companies, "BAccount");

        return companies;
    }

然后编辑 FillCompanyCombo 函数:

private void FillCompanyCombo()
{
    DataSet ds = GetCompanyList();
    DataTable dt = ds.Tables[0];

    string[] companies = PXDatabase.AvailableCompanies;

    var query = from row in dt.AsEnumerable()
                join a in companies on row["AcctCD"].ToString().Trim() equals a
                select new { Code = a, Name = row["AcctName"] };
    var list = query.ToList();

    if (list.Count == 0)
    {
        this.cmbCompany.Visible = false;
    }
    else
    {
        this.cmbCompany.Items.Clear();
        foreach (var item in list)
        {
            this.cmbCompany.Items.Add(new ListItem(item.Code + " - " + item.Name, item.Code));
        }

        if (list.Count == 1)
        {
            this.cmbCompany.Visible = false;
            this.cmbCompany.SelectedValue = this.cmbCompany.Items[0].Value;
        }
        else
        {
            HttpCookie cookie = this.Request.Cookies["CompanyID"];
            if (cookie != null && !string.IsNullOrEmpty(cookie.Value))
                this.cmbCompany.SelectedValue = cookie.Value;
        }
    }
}
于 2014-09-18T05:02:56.413 回答
0

作为建议去哪里看,我可以建议你分析页面 MasterPages\Login.master 并在那里修改一些信息。

于 2014-09-14T19:06:12.333 回答