Esempio n. 1
0
        public UserLogin LoginGet(UserLogin userLogin)
        {
            Logging.WriteToFileLog(string.Format(" LoginGet -->userLogin = {0} , UserName = {1} , Password = {2}", userLogin.UserID, userLogin.UserName, userLogin.Password));
            this.userResource.LoginPasswordGet(userLogin.UserName, userLogin.Password, this.UserLoginConverter, userLogin);

            return userLogin;
        }
Esempio n. 2
0
        public UserLogin LoginPasswordReset(UserLogin userLogin)
        {
            userLogin.Password = new Random().Next(1000).ToString();

            this.userResource.LoginPasswordValidateReset(userLogin.UserID.ToString(), userLogin.UserName, userLogin.Password);

            return userLogin;
        }
Esempio n. 3
0
        public UserInfo UserLoginInfoCreate(string externalid, string source, string gender, string preference, string age, string onlinestatus)
        {
            try
            {
                UserLogin userLogin = new UserLogin()
                                        {
                                            ExternalID = externalid,
                                            UserSourceType = (SourceType)Enum.Parse(typeof(SourceType), source)
                                        };
                UserService userService = new UserService();
                userLogin = userService.LoginCreate(userLogin);

                UserInfo userInfo = new UserInfo()
                                        {
                                            UserID = userLogin.UserID,
                                            Age = short.Parse(age),
                                            Preference = (PreferenceType)Enum.Parse(typeof(PreferenceType), preference),
                                            Gender = (GenderType)Enum.Parse(typeof(GenderType), gender),
                                            OnlineStatusID = short.Parse("0" + onlinestatus)
                                        };
                return userService.UserInfoCreate(userInfo);
            }
            catch (Exception e)
            {
                Logging.WriteToEventLog("USER UserLoginInfoCreate " + e.Message);
                return null;
            }
        }
Esempio n. 4
0
        public UserLogin UserLoginCreate(string externalid, string source)
        {
            try
            {
                UserLogin userLogin = new UserLogin()
                {
                    ExternalID = externalid,
                    UserSourceType = (SourceType)Enum.Parse(typeof(SourceType), source)
                };
                UserService userService = new UserService();
                userLogin = userService.LoginCreate(userLogin);

                return userLogin;
            }
            catch (Exception e)
            {
                Logging.WriteToEventLog("USER UserLoginCreate " + e.Message);
                return null;
            }
        }
Esempio n. 5
0
        public UserLogin LoginPasswordValidateGet(string userName, string password)
        {
            try
            {
                UserLogin userLogin = new UserLogin()
                {
                    UserName = userName,
                    Password = password,
                    ExternalID = "0",
                    UserSourceType = SourceType.Internal
                };
                UserService userService = new UserService();
                userLogin = userService.LoginGet(userLogin);

                userLogin.Password = "";

                return userLogin;
            }
            catch (Exception e)
            {
                Logging.WriteToEventLog("USER LoginPasswordValidateCreate " + e.Message);
                return null;
            }
        }
Esempio n. 6
0
        public bool LoginPasswordReset(string userName)
        {
            try
            {
                UserLogin userLogin = new UserLogin()
                {
                    UserName = userName,
                };
                UserService userService = new UserService();
                userLogin = userService.LoginPasswordReset(userLogin);

                return true;
            }
            catch (Exception e)
            {
                Logging.WriteToEventLog("USER LoginPasswordReset " + e.Message);
                return false;
            }
        }
Esempio n. 7
0
        public UserLogin LoginPasswordValidateCreate(UserLogin userLogin)
        {
            this.userResource.LoginPasswordValidateCreate(userLogin.UserName, userLogin.Password, this.UserLoginConverter, userLogin);

            return userLogin;
        }
Esempio n. 8
0
        public UserLogin LoginCreate(UserLogin userLogin)
        {
            this.userResource.LoginCreate(userLogin.UserName, userLogin.Password, userLogin.UserSourceType, userLogin.ExternalID, this.UserLoginConverter, userLogin);

            return userLogin;
        }
Esempio n. 9
0
        private object UserLoginConverter(IDataReader dr, object dataObject)
        {
            UserLogin userLogin = dataObject as UserLogin;

            if (userLogin == null)
            {
                userLogin = new UserLogin();
                Logging.WriteToFileLog("writing ExternalID ");
                userLogin.ExternalID = dr.GetString(1);
                Logging.WriteToFileLog("writing UserSourceType");
                userLogin.UserSourceType = (SourceType)Enum.Parse(typeof(SourceType), dr[2].ToString());
                dataObject = userLogin;
            }
            //Console.WriteLine("before isnew");
            DataTable dt = dr.GetSchemaTable();
            try
            {
                userLogin.IsNew = bool.Parse(dr["IsNEW"].ToString());
                userLogin.Exists = bool.Parse(dr["Exists"].ToString());
                Logging.WriteToFileLog("writing IsNEW = " + dr["IsNEW"].ToString());
                Logging.WriteToFileLog("writing Exists = " + dr["Exists"].ToString());
            }
            catch
            {
                Logging.WriteToFileLog("could not find IsNEW");
                Logging.WriteToFileLog("could not find Exists");
            }

            Logging.WriteToFileLog("writing UserID = " + dr[0].ToString());
            userLogin.UserID = dr.GetInt32(0);
            userLogin.Password = string.Empty;
            Logging.WriteToFileLog("completed transforming");
            return dataObject;
        }
Esempio n. 10
0
 public void UserLoginCreateDB()
 {
     //IUserResource userResource = new MockUserResource();
     IUserService userService = new UserService();
     int i = 2;
     UserLogin ul = new UserLogin();
     ul.ExternalID = "wwwwwwwwww" + i.ToString();
     ul.UserSourceType = Incyte.SourceType.Facebook;
     ul.UserName = "";
     ul.Password = "";
     //userService.LoginCreate(ul);
 }
Esempio n. 11
0
 private int CreateUserLogin()
 {
     //IUserResource userResource = new MockUserResource();
     IUserService userService = new UserService();
     int i = new Random().Next(1000);
     UserLogin ul = new UserLogin();
     ul.ExternalID = "wwwwwwwwww" + i.ToString();
     ul.UserSourceType = Incyte.SourceType.Facebook;
     ul.UserName = "";
     ul.Password = "";
     userService.LoginCreate(ul);
     return ul.UserID;
 }
Esempio n. 12
0
        public UserLogin LoginGet(UserLogin userLogin)
        {
            this.userResource.LoginPasswordGet(userLogin.UserName, userLogin.Password, this.UserLoginConverter, userLogin);

            return userLogin;
        }
Esempio n. 13
0
        private object UserLoginConverter(IDataReader dr, object dataObject)
        {
            UserLogin userLogin = dataObject as UserLogin;

            if (userLogin == null)
            {
                userLogin = new UserLogin();
                userLogin.ExternalID = dr.GetString(1);
                userLogin.UserSourceType = (SourceType)Enum.Parse(typeof(SourceType), dr[2].ToString());
                dataObject = userLogin;
            }
            //Console.WriteLine("before isnew");
            DataTable dt = dr.GetSchemaTable();
            if (dt.Columns.Contains("IsNEW"))
            {
                userLogin.IsNew = bool.Parse(dr["IsNEW"].ToString());
            }

            if (dt.Columns.Contains("Exists"))
            {
                userLogin.IsNew = bool.Parse(dr["Exists"].ToString());
            }
            userLogin.UserID = dr.GetInt32(0);
            userLogin.Password = string.Empty;

            return dataObject;
        }