Exemplo n.º 1
0
        public UnitOfWork(bool lazyLoadingEnabled, bool proxyCreationEnabled)
        {
            string fullName = System.Diagnostics.Process.GetCurrentProcess().ProcessName;

            context = ModelDb.Create();
            if (fullName == "Win")
            {
                context = ModelDb.Create(DataSource.ConnectionString);
            }
            ; //(/*DataSource.ConnectionString ?? context.Database.Connection.ConnectionString*/);
            this.context.Configuration.LazyLoadingEnabled   = lazyLoadingEnabled;
            this.context.Configuration.ProxyCreationEnabled = proxyCreationEnabled;
        }
Exemplo n.º 2
0
        public UnitOfWork()
        {
            string fullName = System.Diagnostics.Process.GetCurrentProcess().ProcessName;

            context = ModelDb.Create();
            if (fullName == "Win")
            {
                context = ModelDb.Create(DataSource.ConnectionString);
            }



            //(/*DataSource.ConnectionString ?? context.Database.Connection.ConnectionString*/);
        }
Exemplo n.º 3
0
        private async void BtnLogin_Click(object sender, EventArgs e)
        {
            UnitOfWork unitOfWork = new UnitOfWork();

            unitOfWork = new UnitOfWork();

            ApplicationUserManager userManager =
                new ApplicationUserManager(new UserStores(ModelDb.Create()));
            var user = await userManager.FindByNameAsync(txtUserName.Text);

            if (user == null)
            {
                MessageBox.Show("Invalid UserName", "Invalid UserName", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var res = userManager.PasswordHasher.VerifyHashedPassword(user.PasswordHash, txtPassword.Text);

            if (res != Microsoft.AspNet.Identity.PasswordVerificationResult.Success)
            {
                MessageBox.Show("Invalid Password", "Invalid Password", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (chkRemember.Checked)
            {
                Settings.Default.UserName   = txtUserName.Text;
                Settings.Default.Password   = txtPassword.Text;
                Settings.Default.RememberMe = chkRemember.Checked;
                Settings.Default.Save();
            }
            else
            {
                Settings.Default.UserName   = string.Empty;
                Settings.Default.Password   = string.Empty;
                Settings.Default.RememberMe = false;
                Settings.Default.Save();
            }
            User.UserId = user.Id;
            isClosed    = true;
            this.Close();
        }
Exemplo n.º 4
0
 public UnitOfWork()
 {
     context = ModelDb.Create(DataSource.ConnectionString);//(/*DataSource.ConnectionString ?? context.Database.Connection.ConnectionString*/);
 }
Exemplo n.º 5
0
        private ModelDb context;//= new ModelDb();

        public UnitOfWork()
        {
            this.context = ModelDb.Create(DataSource);
        }
Exemplo n.º 6
0
 public UnitOfWork(bool lazyLoadingEnabled, bool proxyCreationEnabled)
 {
     context = ModelDb.Create(DataSource.ConnectionString);//(/*DataSource.ConnectionString ?? context.Database.Connection.ConnectionString*/);
     this.context.Configuration.LazyLoadingEnabled   = lazyLoadingEnabled;
     this.context.Configuration.ProxyCreationEnabled = proxyCreationEnabled;
 }
Exemplo n.º 7
0
 public UnitOfWork(bool lazyLoadingEnabled, bool proxyCreationEnabled)
 {
     this.context.Configuration.LazyLoadingEnabled   = lazyLoadingEnabled;
     this.context.Configuration.ProxyCreationEnabled = proxyCreationEnabled;
     this.context = ModelDb.Create();
 }
Exemplo n.º 8
0
 public UnitOfWork()
 {
     this.context = ModelDb.Create();
 }
Exemplo n.º 9
0
 public FrmLogin()
 {
     InitializeComponent();
     this.userManager = new ApplicationUserManager(new UserStores(ModelDb.Create()));
 }