();
} event EventHandler UserLogining; void btIn_Click (object sender, EventArgs e)
{uName=tbUserName.Text.Trim (); uPassword=tbUserPassword.Text.Trim (); user=Storage_Coursework.Providers.UserProvider.GetUser (uName, uPassword); (user, new EventArgs ( )) ;. Close ();
} Storage_Coursework
{
partial class FormLogon
{
private System.ComponentModel.IContainer components=null; override void Dispose (bool disposing)
{
if (disposing amp; amp; (components!=null))
{. Dispose ();
}. Dispose (disposing);
}
# region Windows Form Designer generated codevoid InitializeComponent ()
{. gbLogon=new System.Windows.Forms.GroupBox () ;. lbUserName=new System.Windows.Forms.Label () ;. lbUserPassword=new System.Windows.Forms.Label () ; .tbUserName=new System.Windows.Forms.TextBox () ;. tbUserPassword=new System.Windows.Forms.TextBox () ;. btIn=new System.Windows.Forms.Button () ;. gbLogon.SuspendLayout ();.SuspendLayout () ;. gbLogon.Anchor=System.Windows.Forms.AnchorStyles.None;.gbLogon.Controls.Add(this.btIn);.gbLogon.Controls.Add(this.tbUserPassword);.gbLogon.Controls.Add(this.tbUserName);.gbLogon.Controls.Add(this.lbUserPassword);.gbLogon.Controls.Add(this.lbUserName);.gbLogon.Location =New System.Drawing.Point (12, 12) ;. gbLogon.Name= gbLogon raquo ;;. GbLogon.Size=new System.Drawing.Size (425, 145) ;. gbLogon.TabIndex=0; .gbLogon. TabStop=false; .gbLogon.Text= Облікові дані raquo ;;. lbUserName.AutoSize=true; .lbUserName.Location=new System.Drawing.Point (6, 35) ;. lbUserName.Name= lbUserName raquo ;;. lbUserName.Size=new System.Drawing.Size (111, 19) ;. lbUserName.TabIndex=0; .lbUserName.Text= Користувач raquo ;;. lbUserPassword.AutoSize=true; .lbUserPassword.Location=new System.Drawing. Point (6, 69) ;. lbUserPassword.Name= lbUserPassword raquo ;;. lbUserPassword.Size=new System.Drawing.Size (63, 19) ;. lbUserPassword.TabIndex=1; .lbUserPassword.Text= Пароль ; .tbUserName.Location=new System.Drawing.Point (153, 32) ;. tbUserName.Name= tbUserName raquo ;;. tbUserName.Size=new System.Drawing.Size (266, 27) ;. tbUserName.TabIndex= 2; .tbUserName.TextAlign=System.Windows.Forms.HorizontalAlignment.Right; .tbUserPassword.Location=new System.Drawing.Point (153, 66) ;. tbUserPassword.Name= tbUserPassword raquo ;;. tbUserPassword.Size=new System.Drawing.Size (266, 27) ;. tbUserPassword.TabIndex=3; .tbUserPassword.TextAlign=System.Windows.Forms.HorizontalAlignment.Right; .tbUserPassword.UseSystemPasswordChar=true; .btIn.Location=new System.Drawing. Point (330, 99) ;. btIn.Name= btIn raquo ;;. btIn.Size=new System.Drawing.Size (89, 34) ;. btIn.TabIndex=4; .btIn.Text= Вхід ; .btIn.UseVisualStyleBackColor=true; .btIn.Click +=new System.EventHandler (this.btIn_Click) ;. AutoScaleDimensions=new System.Drawing.SizeF (9F, 19F) ;. AutoScaleMode=System.Windows.Forms.AutoScaleMode. Font; .ClientSize=new System.Drawing.Size (449, 169) ;. Controls.Add (this.gbLogon) ;. Font=new System.Drawing.Font ( Tahoma raquo ;, 12F, System.Drawing.FontStyle. Regular, System.Drawing.GraphicsUnit.Point, ((byte) (204))) ;. FormBorderStyle=System.Windows.Forms.FormBorderStyle.FixedToolWindow; .Margin=new System.Windows.Forms.Padding (4, 5, 4 , 5) ;. Name= FormLogon raquo ;;. StartPosition=System.Windows.Forms.FormStartPosition.CenterScreen; .Text=laquo;Входraquo;;.gbLogon.ResumeLayout(false);.gbLogon.PerformLayout();.ResumeLayout(false);
}
# endregion
private System.Windows.Forms.GroupBox gbLogon;
private System.Windows.Forms.Button btIn;
private System.Windows.Forms.TextBox tbUserPassword;
private System.Windows.Forms.TextBox tbUserName;
private System.Windows.Forms.Label lbUserPassword;
private System.Windows.Forms.Label lbUserName;
} Storage_Coursework
{
public partial class FormMain: Form
{
private Storage_Coursework.Objects.User currentUser; FormMain ()
{();
} void UserIn ()
{fl=new FormLogon () ;. UserLogining +=fl_UserLogining; .ShowDialog (this);
} void fl_UserLogining (object sender, EventArgs e)
{
if (sender == null)
{
MessageBox.Show ( У Вас немає прав доступу до додатка );
}=(Storage_Coursework.Objects.User) se...