Exemplo n.º 1
0
        private void mbtnLogin_Click(object sender, EventArgs e)
        {
            if (this.txtUserName.Text != "" && this.txtPassword.Text != "")
            {
                var user = new UserLoginEntity();
                user.UserName = this.txtUserName.Text.Trim();
                user.UserPass = this.txtPassword.Text.Trim();

                var userRep = new UserLoginRepo();
                if (user.UserName.Substring(0, 1) == "A" || user.UserName.Substring(0, 1) == "a")
                {
                    if (userRep.UserLoginAdmin(user))
                    {
                        MessageBox.Show("Welcome Admin");
                        this.Visible = false;
                        var admin = new AdminDash(txtUserName.Text.Trim());
                        admin.Visible = true;
                    }
                    else
                    {
                        MessageBox.Show("Invalid Id or Password");
                    }
                }
                else if (user.UserName.Substring(0, 1) == "R" || user.UserName.Substring(0, 1) == "r")
                {
                    if (userRep.UserLoginReciptionist(user))
                    {
                        //MessageBox.Show("Hey There");
                        var reciption = new ReceptionistDash(txtUserName.Text.Trim());
                        //this.Visible = false;
                        this.Hide();
                        reciption.Show();
                        //reciption.Visible = true;
                    }
                    else
                    {
                        MessageBox.Show("Invalid Id or Password");
                    }
                }
                else if (user.UserName.Substring(0, 1) == "D" || user.UserName.Substring(0, 1) == "d")
                {
                    if (userRep.UserLoginDoctor(user))
                    {
                        MessageBox.Show("Welcome Doctor");
                        var doctor = new DoctorDash(txtUserName.Text.Trim());
                        this.Visible   = false;
                        doctor.Visible = true;
                    }
                    else
                    {
                        MessageBox.Show("Invalid Id or Password");
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void DeleteUserByID(dynamic param)
        {
            List <UserLogin> _UserLogin = new List <UserLogin>();

            try
            {
                UserLoginRepo rp = new UserLoginRepo();
                int           ID = Convert.ToInt32(param.FilterParameter.ID);
                rp.DeleteByID(ID);
            }
            catch (Exception ex)
            {
                DBLogger loger = new DBLogger(Convert.ToInt32(param.FilterParameter.UserLoginID));
                loger.LogMessage = "Apı  => DeleteUserByID => Exception : " + ex.Message;
                LogManager lm = new LogManager(loger);
                lm.LogMe();
            }
        }
Exemplo n.º 3
0
        public List <UserLogin> GetUsers(dynamic param)
        {
            List <UserLogin> _UserLogin = new List <UserLogin>();

            try
            {
                UserLoginRepo rp = new UserLoginRepo();
                _UserLogin = rp.GetAll();
            }
            catch (Exception ex)
            {
                DBLogger loger = new DBLogger(Convert.ToInt32(param.FilterParameter.UserLoginID));
                loger.LogMessage = "Apı  => GetUsers => Exception : " + ex.Message;
                LogManager lm = new LogManager(loger);
                lm.LogMe();
            }
            return(_UserLogin);
        }
Exemplo n.º 4
0
        public UserLogin GetLoginUser(dynamic param)
        {
            UserLogin _UserLogin = new UserLogin();

            try
            {
                UserLoginRepo rp = new UserLoginRepo();
                _UserLogin = rp.GetLogin(param.FilterParameter.UserName.ToString(), param.FilterParameter.UserPassword.ToString());
            }
            catch (Exception ex)
            {
                DBLogger loger = new DBLogger(Convert.ToInt32(param.FilterParameter.UserLoginID));
                loger.LogMessage = "Apı  => GetLoginUser => Exception : " + ex.Message;
                LogManager lm = new LogManager(loger);
                lm.LogMe();
            }
            return(_UserLogin);
        }
Exemplo n.º 5
0
        public void UpdateUser(dynamic param)
        {
            List <UserLogin> _UserLogin = new List <UserLogin>();

            try
            {
                UserLoginRepo rp = new UserLoginRepo();
                UserLogin     ul = new UserLogin();
                ul.ID           = Convert.ToInt32(param.FilterParameter.ID);
                ul.UserName     = param.FilterParameter.UserName.ToString();
                ul.UserPassword = param.FilterParameter.UserPassword.ToString();

                rp.Update(ul);
            }
            catch (Exception ex)
            {
                DBLogger loger = new DBLogger(Convert.ToInt32(param.FilterParameter.UserLoginID));
                loger.LogMessage = "Apı  => UpdateUser => Exception : " + ex.Message;
                LogManager lm = new LogManager(loger);
                lm.LogMe();
            }
        }
Exemplo n.º 6
0
 public void AddUser(dynamic param)
 {
     //  UserLogin _UserLogin = new UserLogin();
     try
     {
         UserLoginRepo rp = new UserLoginRepo();
         UserLogin     ul = new UserLogin();// JsonConvert.DeserializeObject<UserLogin>(param.FilterParameter);
         ul.UserName     = param.FilterParameter.UserName.ToString();
         ul.UserPassword = param.FilterParameter.UserPassword.ToString();
         if (!string.IsNullOrEmpty(ul.UserName) && !string.IsNullOrEmpty(ul.UserPassword))
         {
             rp.Insert(ul);
         }
     }
     catch (Exception ex)
     {
         DBLogger loger = new DBLogger(Convert.ToInt32(param.FilterParameter.UserLoginID));
         loger.LogMessage = "Apı  => AddUser => Exception : " + ex.Message;
         LogManager lm = new LogManager(loger);
         lm.LogMe();
     }
     // return _UserLogin;
 }
Exemplo n.º 7
0
 public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
 {
     try
     {
         context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" });
         UserLoginRepo ulr = new UserLoginRepo();
         UserLogin     ul  = ulr.GetLogin(context.UserName, context.Password);
         if (ul != null)
         {
             var identity = new ClaimsIdentity(context.Options.AuthenticationType);
             identity.AddClaim(new Claim(ClaimTypes.Role, "Role Ayarlanicak"));
             identity.AddClaim(new Claim(ClaimTypes.Name, context.UserName));
             context.Validated(identity);
         }
         else
         {
             context.SetError("invalid_grant", "Username and Password is Incorrect");
             return;
         }
     }
     catch (Exception ex)
     {
     }
 }