我习惯使用带有母版页和会话的 ASP.NET。我把菜单放在母版页中。成功登录后,我将变量保存在会话中。
现在我正在使用 Winform。我用变量替换的会话
和我用表单替换的母版页
所以在成功登录后,我保存在 Session 的变量 insted 中,并使用菜单条关闭和打开面板。
public partial class Principale : Form
static string _ClientId;
public static string ClientId
{
get { return _ClientId; }
set { _ClientId = value; }
}
LeOrdre_BL oOrdre_BL = new LeOrdre_BL();
LeOrdreStatut_Entite_BL oOrdreStat_BL = new LeOrdreStatut_Entite_BL();
public Principale()
{
InitializeComponent();
ClientId = LoginData.Trim().Substring(0, LoginData.Trim().Length - 1);
panelControl_Ordre.Hide();
panelControl_Mag.Hide();
}
private void ordreToolStripMenuItem_Click(object sender, EventArgs e)
{
panelControl_Ordre.Show();
panelControl_Mag.Hide();
GetDataOrdre();
}
private void magasinierToolStripMenuItem_Click(object sender, EventArgs e)
{
panelControl_Ordre.Hide();
panelControl_Mag.Show();
}
public void GetDataOrdre()
{
try
{
bindingSource_OdreStatus.DataSource = oOrdreStat_BL.Get_All_OrdreStatut();
STATUT_ORDRE.DataSource = bindingSource_OdreStatus;
STATUT_ORDRE.DisplayMember = "LIBELLE";
STATUT_ORDRE.ValueMember = "NO";
bindingSource_Ordre.DataSource = oOrdre_BL.Get_Ordre_BL();
dataGridView_ordre.DataSource = bindingSource_Ordre;
dataGridView_ordre.DataMember = "OrdreTable";
}
catch (Exception excThrown)
{
lbl_Princ_Err.Text = excThrown.Message;
}
}
我是否以正确的方式执行此操作,或者您是否有其他想法来替换 Winform 中的 ASP.NET Masterpage?
提前感谢