/// <summary>
 /// Initializes a new instance of the <see cref="IdentificationPacket"/> class.
 /// </summary>
 /// <param name="UserNameOrServerName">Name of the user name or server.</param>
 /// <param name="VerificationKeyOrMOTD">The verification key or MOTD.</param>
 /// <param name="UserType">Type of the user.</param>
 /// <remarks></remarks>
 public IdentificationPacket(string UserNameOrServerName, string VerificationKeyOrMOTD, UserType UserType)
 {
     this.ProtocolVersion = 7;
     this.UserNameOrServerName = UserNameOrServerName;
     this.VerificationKeyOrMOTD = VerificationKeyOrMOTD;
     this.UserType = UserType;
 }
Beispiel #2
0
        /// <summary>
        /// The get user.
        /// </summary>
        /// <param name="userType">
        /// The user type.
        /// </param>
        /// <returns>
        /// The <see cref="User"/>.
        /// </returns>
        public static User GetUser(UserType userType)
        {
            switch (userType)
            {
                case UserType.Picker:
                {
                    return new Picker();
                }

                case UserType.Packer:
                {
                    return new Packer();
                }

                case UserType.Stocker:
                {
                    return new Stocker();
                }

                case UserType.Manager:
                {
                   return new Manager();
                }

                case UserType.Customer:
                {
                    return new Customer();
                }

                default:
                {
                    return null;
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// Creates a new user
 /// </summary>
 /// <param name="Name">The name of the user</param>
 /// <param name="Username">The user's username</param>
 /// <param name="Password">The user's password</param>
 /// <param name="Type">The type of the user</param>
 public User(string Name, string Username, string Password, UserType Type)
 {
     this.Name = Name;
     this.Password = Password;
     this.Username = Username;
     this.Type = Type;
 }
 public User(string username, string password, string email, UserType type)
 {
     Username = username;
     Password = password;
     Email = email;
     Type = type;
 }
Beispiel #5
0
 //public Login(string loginName, string userName, string password, UserType userType, int[] sectionedGrades)
 //{
 //    this.loginName = loginName;
 //    this.userName = userName;
 //    this.password = password;
 //    this.userType = userType;
 //    this.sectionedGrades = sectionedGrades;
 //}
 public Login(XElement loginElement)
 {
     loginName = loginElement.Attribute("LoginName").Value;
     userName = loginElement.Element("UserName").Value;
     password = loginElement.Element("Password").Value;
     personName = loginElement.Element("PersonName").Value;
     userType = (UserType)Enum.Parse(typeof(UserType), loginElement.Element("UserType").Value);
     string[] gradesStringArray = loginElement.Element("SectionedGrades").Value.Split(',');
     this.sectionedGrades = new int[gradesStringArray.Length];
     for (int i = 0; i < gradesStringArray.Length; i++)
     {
         sectionedGrades[i] = int.Parse(gradesStringArray[i]);
     }
     if (loginElement.Descendants("NavigationInfo").Any())
     {
         XElement navigationInfoElement = loginElement.Element("NavigationInfo");
         string subjectName;
         foreach (XElement subjectInfoElement in navigationInfoElement.Elements())
         {
             subjectName = subjectInfoElement.Attribute("SubjectName").Value;
             foreach (XElement TaskInfoElement in subjectInfoElement.Elements())
             {
                 TaskInfoList.Add(new TaskInfo(TaskInfoElement, subjectName));
             }
         }
     }
 }
Beispiel #6
0
        public OptionOfBroadcast(UserType typeOfUser, TextBox textBox_Status)
        {

            //определяем соотношение сторон
            //if (pictureBoxTool.ratio == 1.33)
            //{
            //    showWidthRectangleCell = 4;
            //    showHeightRectangleCell = 3;
            //}
            //else if (pictureBoxTool.ratio == 1.78)
            //{
            //    showWidthRectangleCell = 16;
            //    showHeightRectangleCell = 9;
            //}
            //else //1.6
            //{
            //    showWidthRectangleCell = 16;
            //    showHeightRectangleCell = 10;
            //}
            //this.pictureBoxTool = pictureBoxTool;


            partnerIp = IPAddress.Parse(ReadWriteTextFile.GetIpSetting());
            int.TryParse(ReadWriteTextFile.GetPortSetting(), out port);

            textBox = new FormTextBox_Status(textBox_Status);
            this.typeOfUser = typeOfUser;
        }
Beispiel #7
0
 public static void ValidateAdmin(UserType userType)
 {
     if (userType != UserType.Administrator)
     {
         throw new ServerErrorException("User is not an administrator!");
     }
 }
Beispiel #8
0
 public User(string name, UserType type)
 {
     ID = Guid.NewGuid();
     UserName = name;
     Type = type;
     userStatus = UserStatus.Active;
 }
Beispiel #9
0
 public User(string _username, string _password, UserType _usertype)
     : base(EntityType.User)
 {
     this.username = _username;
     this.password = _password;
     this.userType = _usertype;
 }
Beispiel #10
0
 public static void ValidateDealer(UserType userType)
 {
     if (userType != UserType.Dealer)
     {
         throw new ServerErrorException("User is not a dealer!");
     }
 }
Beispiel #11
0
 private CommandHandler(string name, UserType access, DelayType delayType, Func<MessageEventArgs, ChatMemberViewModel, SendMessage> handler)
 {
     Name = name.ToLower();
     Access = access;
     DelayType = delayType;
     Handler = handler;
 }
        //Add an entry in the ACL, and send an invitation email
        public void SendInvitation(string email, Guid ProjectID, UserType userType, IEmailSender emailSender)
        {
            //Database access
            var db = new ApplicationDBContext();

            //make sure this isnt a duplicate
            if (db.UsersAccessProjects.Where(acl => acl.Email == email && acl.ProjectID == ProjectID).Count() == 0)
            {
                //Working with ACL
                var acl = new UsersAccessProjects();
                acl.Email = email;
                acl.invitationAccepted = false;
                acl.ProjectID = ProjectID;
                acl.UserID = null;

                //Save the ACL entry
                db.UsersAccessProjects.Add(acl);
                db.SaveChanges();

                //build an invitaion email
                string body;
                body = "You have been invited to a new project.\n";
                body += "Click the link to accept the invitation.\n";
                body += "http://northcarolinataxrecoverycalculator.apphb.com/Project/AcceptInvite/" + acl.ID;

                //send an invitaion email
                emailSender.SendMail(email, "You have been invited to a project", body);
            }
        }
Beispiel #13
0
	public void SelectOption (int option)
	{
		label.text = labels[option];
		ToggleOptions ();
		CurrentType = (UserType) option;
		ToogleOption ();
	}
Beispiel #14
0
 /// <summary>
 /// Creates a User entity according to given parameters.
 /// In particular, it takes care of storing the hashed password.
 /// </summary>
 /// <param name="userId">User unique identifier.</param>
 /// <param name="userEmail">User email address.</param>
 /// <param name="userPwd">User password (NOT hashed).</param>
 /// <param name="userType">The type of user (admin or common).</param>
 public User(string userId, string userEmail, string userPwd, UserType userType)
     : base(TableName, userId)
 {
     Email = userEmail;
     HashedPassword = Hash.ComputeMD5(userPwd);
     IsAdmin = (userType == UserType.AdminUser);
 }
Beispiel #15
0
        public void ChangeConnectionUser(UserType type)
        {
            Connection.Close();

            switch (type)
            {
                case UserType.STORE_MANAGER:
                    LoginConnStr = @"server=" + Server + ";userid=Storemanager;password=sm!9876;database=ggsr";
                    break;
                case UserType.DEPT_MANAGER:
                    LoginConnStr = @"server=" + Server + ";userid=Deptmanager;password=dm!9876;database=ggsr";
                    break;
                case UserType.TEAM_MEMBER:
                    LoginConnStr = @"server=" + Server + ";userid=Teammember;password=tm!9876;database=ggsr";
                    break;
            }
            try
            {
                Connection = new MySqlConnection(LoginConnStr);
                Connection.Open();
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("Error: " + ex.ToString());
                Connection.Close();
            }
        }
        /// <summary>
        /// Method that checks if the user is authenticated and authorized to execute the method based on the authorization token.
        /// If authorization is optional and the user is not yet authenticated, a new account is created for the user.
        /// </summary>
        /// <param name="allowedUserTypes">Array of authorized UserTypes.</param>
        public void Authorize(UserType[] allowedUserTypes)
        {
            // Get user info using the AuthorizationToken HTTP header
            OpenIDUserInfo userInfo = this.userManager.GetOpenIDUserInfo();

            // Only continue if user info was successfully retrieved from the Access token issuer
            if (userInfo != null)
            {
                // Try to match a user using the user info retrieved from the Access Token issuer
                User matchedUser = this.userManager.MatchUser(userInfo);

                // Set the property that indicates if the user is authenticated
                this.IsAuthenticated = (matchedUser != null);

                // Check if the user is authenticated
                if (this.IsAuthenticated)
                {
                    // The user is authenticated, set the property that indicates if the user is authorized to execute the method
                    this.IsAuthorized = (allowedUserTypes.Count() == 0 || allowedUserTypes.Contains(matchedUser.Type));
                }
                else
                {
                    // The user is not authenticated - check if authorization is optional or if a customer is authorized to execute the method
                    if (allowedUserTypes.Count() == 0 || allowedUserTypes.Contains(UserType.Customer))
                    {
                        // Authorization is optional or a customer is authorized to execute the method, create a new user using the user info retrieved from the Access Token issuer
                        this.userManager.CreateUser(userInfo);

                        // Set the properties that indicate that the user is authenticated and authorized to execute the method
                        this.IsAuthenticated = true;
                        this.IsAuthorized = true;
                    }
                }
            }
        }
Beispiel #17
0
 public User( string username, string password, UserType accesstype)
 {
     //no id, for insertion of new users
     this.UserName = username;
     this.UserPassword = password;
     this.AccessType = accesstype;
 }
Beispiel #18
0
 public User(int id, string username, string password, UserType accesstype)
 {
     this.Id = id;
     this.UserName = username;
     this.UserPassword = password;
     this.AccessType = accesstype;
 }
Beispiel #19
0
 public UserToken(string guid, DateTime lastAccessed, UserType userType, int? id)
 {
     GUID = guid;
     LastAccessed = lastAccessed;
     Type = userType;
     ID = id;
 }
        public RollingRides.WebApp.Components.Datalayer.Models.User RegisterUser(string username, string password, string email, string phoneNumber,
		                  string firstName, string lastName,
		                  string street1, string street2,
		                  string city, string state, string zipcode, 
		                  UserType type, string companyName)
        {
            var user = new Components.Datalayer.Models.User();
            user.AccountType =(int) type;
            user.Username = username;
            user.City = city;
            user.DateJoined = DateTime.Now;
            user.Email = email;
            user.CompanyName = companyName;
            user.Expires = null;
            user.FirstName = firstName;
            user.LastName = lastName;
            //user.Id = -1;
            user.State = state;
            user.Street1 = street1;
            user.Street2 = street2;
            user.ZipCode = zipcode;
            user.PhoneNumber = phoneNumber;
            user.Password = password;
            return _userRepository.AddUpdate (user);
        }
Beispiel #21
0
        public bool Add(UserType userType, int userId, IEnumerable<EmailConfig> values)
        {
            ManagerLock.EnterReadLock();            // Read

            try {
                if (FindUser(userType, userId) != null)
                    return false;
            }
            finally{
                ManagerLock.ExitReadLock();         // EO Read
            }

            ManagerLock.EnterWriteLock();           // Write

            try {
                Configs.Element(userType.ToString())                                   // Não retorna null porque nunca é apagado e existe sempre
                       .Add(new XElement("user",
                                new XAttribute("id", userId),                          // Coloca atributo
                                values.Select(c => new XElement("value", (int)c))      // Coloca coleccao de values
                ));

                // Save persistent to file
                Configs.Save(FileName);
                return true;
            }

            finally{
                ManagerLock.ExitWriteLock();        // EO Write
            }
        }
Beispiel #22
0
 public User(string n, string e, string p, UserType ut)
 {
     _name = n;
     _email = e;
     _password = p;
     _permissions = ut;
 }
Beispiel #23
0
        public bool Delete(UserType userType, int userId)
        {
            ManagerLock.EnterReadLock();            // Read

            XElement userElement;

            try {
                if ((userElement = FindUser(userType, userId)) == null)
                    return false;
            }
            finally{
                ManagerLock.ExitReadLock();         // EO Read
            }

            ManagerLock.EnterWriteLock();           // Write

            try {
                userElement.Remove();

                // Save persistent
                Configs.Save(FileName);
                return true;
            }
            finally{
                ManagerLock.ExitWriteLock();       // EO Write
            }
        }
Beispiel #24
0
        public static void CreateNewUserDashboard(int uid, UserType utype)
        {
            //Adds 4 entries to dashboardsettings table to give user default dash items 1 item for customers
            LINQ_UsersDataContext dc = new LINQ_UsersDataContext();
            List<string> DefaultDashItems = ListDashboardItems(utype);
            if (utype == UserType.AccountCustomer)
            {
                DashBoardSetting ds = new DashBoardSetting();
                ds.DashBoardNumber = 1;
                ds.DashBoardItem = DefaultDashItems[2];
                ds.UserId = uid;

                dc.DashBoardSettings.InsertOnSubmit(ds);
            }
            else
            {
                for (int i = 1; i <= 4; i++)
                {
                    DashBoardSetting ds = new DashBoardSetting();
                    ds.DashBoardNumber = i;
                    ds.DashBoardItem = DefaultDashItems[i];
                    ds.UserId = uid;

                    dc.DashBoardSettings.InsertOnSubmit(ds);
                }
            }
            try
            {
                dc.SubmitChanges();
            }
            catch (Exception ex)
            {
                Database.WriteException("Error inserting new DashBoardSettings items", uid, "Users.CreateNewUserDashboard", ex);
            }
        }
Beispiel #25
0
        public AddUserForm(string userType)
            : this()
        {
            switch (userType)
            {
                case "CloserRelatives":
                    newUserType = UserType.CloserRelatives;
                    break;
                case "FarRelatives":
                    newUserType = UserType.FarRelatives;
                    break;
                case "Department":
                    newUserType = UserType.Department;
                    break;
                case "Company":
                    newUserType = UserType.Company;
                    break;
                case "BestFriends":
                    newUserType = UserType.BestFriends;
                    break;
                case "Teammates":
                    newUserType = UserType.Teammates;
                    break;

                default:
                    MessageBox.Show("Error. Unknown user type");
                    break;
            }

            mainForm = (MainForm)Application.OpenForms[0];
        }
Beispiel #26
0
 public SearchEntry(int id, string name, ResultType restype, UserType usetype)
 {
     ID = id;
     Name = name;
     ResultType = restype;
     UserType = usetype;
     Hit = 1;
 }
Beispiel #27
0
 public MyUser(String _username, String _password, String _name, String _contactno, UserType _usertype)
 {
     this.username = _username;
     this.password = _password;
     this.name = _name;
     this.contactNo = _contactno;
     this.usertype = _usertype;
 }
Beispiel #28
0
        public User(Guid id, UserType userType, EmailAddress emailAddress, string password)
        {
            Id = id;
            UserType = userType;
            EmailAddress = emailAddress;

            UpdatePassword(password);
        }
Beispiel #29
0
 public CustomIdentity(string sUserName, bool bIsAuthenticated, string sAuthenticationType, UserType userType,Guid? supplierId)
 {
     _sUserName = sUserName;
     _bIsAuthenticated = bIsAuthenticated;
     _sAuthenticationType = sAuthenticationType;
     _userType = userType;
     _supplierId = supplierId;
 }
 private void SignIn( bool isPersistent,string username,UserType type)
 {
     AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
     var identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, username), new Claim(ClaimTypes.Role,type.ToString()), new Claim(ClaimTypes.Name,username)}, DefaultAuthenticationTypes.ApplicationCookie, ClaimTypes.Name, ClaimTypes.Role);
         
     AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent}, identity);
 
 }
Beispiel #31
0
 public bool SupportsUser(UserType User) => true;
Beispiel #32
0
 public User(string pLoginName, string pPassword, UserType pType)
 {
     this.Name     = pLoginName;
     this.Password = pPassword;
     this.Type     = pType;
 }
Beispiel #33
0
        public ActionResult Index(ReshimgathiMatrimony.Models.Login model)
        {
            if (ModelState.IsValid)
            {
                //LoginOperations loginOp = new LoginOperations();

                //use this WSHttpBinding_ILoginService for http protocol communication
                LoginServices.LoginServiceClient client = new LoginServices.LoginServiceClient("WSHttpBinding_ILoginService");

                //in a similar pattern we are creating registration phase 1 service obj
                RegistrationPhaseI.RegistrationPhaseIClient regClient = new RegistrationPhaseI.RegistrationPhaseIClient("NetTcpBinding_IRegistrationPhaseI");
                regClient.IsRegistrationEnabledToday();
                //by the way above 2 lines code no use of it. But we are implemenetd how second service can be updated and invoked.


                //use this NetTcpBinding_ILoginService when we want communication should be carried out through TCP protocol.
                //LoginServices.LoginServiceClient client = new LoginServices.LoginServiceClient("NetTcpBinding_ILoginService");

                bool loginStatus = client.IsLoggedUserPresent(model.UserName, model.Password);
                //bool loginStatus = loginOp.IsLoggedUserPresent(model.UserName, model.Password);

                if (loginStatus)
                {
                    //WCF service call.
                    //bool IsVerified = loginOp.IsLogInUserVerified(model.UserName, model.Password);
                    bool IsVerified = client.IsLogInUserVerified(model.UserName, model.Password);

                    if (IsVerified)
                    {
                        UserType type        = (UserType)client.LoggedUserType(model.UserName, model.Password);
                        var      userDetails = client.GetUserDetails(model.UserName, model.Password);

                        UserLoginId  = userDetails.Id;
                        BaseUserType = userDetails.UserType;
                        SetSession();

                        if (type == UserType.User)
                        {
                            return(RedirectToAction("Index", "Dashboard"));
                        }
                        else
                        {
                            //Admin user goes here.
                            return(RedirectToAction("Index", "Admin"));
                        }
                    }
                    else
                    {
                        //User is not verified. He/she needs to verify account by his/her email address or Phone number.
                        ModelState.AddModelError(string.Empty, "Signing user is not verified either by Email address or Phone number. Please verify the user.");
                    }
                }
                else
                {
                    //default Index Get view with ErrorMessage. Username and password are wrong.
                    ModelState.AddModelError(string.Empty, "Username or password are not correct. Please try again with the correct details.");
                }
            }

            return(View(model));
        }
Beispiel #34
0
    public async Task <User> ResolveUserAsync(string organizationId, string organizationName, UserDefinition userDefinition, UserType userType = UserType.User)
    {
        if (userDefinition is null)
        {
            throw new ArgumentNullException(nameof(userDefinition));
        }

        var userId = await GetUserIdAsync(userDefinition.Identifier)
                     .ConfigureAwait(false);

        if (string.IsNullOrEmpty(userId))
        {
            return(null);
        }

        var user = await userRepository
                   .GetAsync(organizationId, userId)
                   .ConfigureAwait(false);

        user ??= new User
        {
            Id               = userId,
            UserType         = userType,
            Organization     = organizationId,
            OrganizationName = organizationName
        };

        return(user);
    }
Beispiel #35
0
        public Response <User> CreateUser(string login, string password, string name, UserType userType)
        {
            using (var db = new ActivitiesContext())
            {
                var users = db.Users.Where(u => u.Login == login);
                if (users.Count() > 0)
                {
                    return(new Response <User>(
                               $"Użytkownik {login} już istenie w bazie",
                               true
                               ));
                }

                db.Users.Add(new User
                {
                    Login    = login,
                    Password = password,
                    Name     = name,
                    Type     = userType
                });
                db.SaveChanges();

                return(new Response <User>(
                           $"Uzytkownik {login} został stworzony",
                           false
                           ));
            }
        }
Beispiel #36
0
 public Coworker(string login, string pass, string pn, string fname, string lname, string mname, UserType type) : this(type)
 {
     Login          = login;
     Password       = pass;
     PersonalNumber = pn;
     FirstName      = fname;
     LastName       = lname;
     MiddleName     = mname;
     UserType       = type;
 }
Beispiel #37
0
 public User(string username, string password, string fullName, string hashcode, string BirthDay, bool man, int gewicht, UserType type)
 {
     this.username = username;
     this.password = password;
     this.FullName = fullName;
     this.hashcode = hashcode;
     this.Man      = man;
     this.gewicht  = gewicht;
     //this.BirthDay = DateTime.Parse(BirthDay);
     this.Type = type;
 }
        /// <summary>
        /// Returns true if User instances are equal
        /// </summary>
        /// <param name="other">Instance of User to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(User other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ContactId == other.ContactId ||
                     ContactId.Equals(other.ContactId)
                     ) &&
                 (
                     GivenName == other.GivenName ||
                     GivenName != null &&
                     GivenName.Equals(other.GivenName)
                 ) &&
                 (
                     Surname == other.Surname ||
                     Surname != null &&
                     Surname.Equals(other.Surname)
                 ) &&
                 (
                     Active == other.Active ||
                     Active.Equals(other.Active)
                 ) &&
                 (
                     Initials == other.Initials ||
                     Initials != null &&
                     Initials.Equals(other.Initials)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     SmUserId == other.SmUserId ||
                     SmUserId != null &&
                     SmUserId.Equals(other.SmUserId)
                 ) &&
                 (
                     AccountId == other.AccountId ||
                     AccountId != null &&
                     AccountId.Equals(other.AccountId)
                 ) &&
                 (
                     UserType == other.UserType ||
                     UserType != null &&
                     UserType.Equals(other.UserType)
                 ) &&
                 (
                     UserRoles == other.UserRoles ||
                     UserRoles != null &&
                     UserRoles.SequenceEqual(other.UserRoles)
                 ));
        }
Beispiel #39
0
 public Coworker(UserType type) : this()
 {
     UserType = type;
 }
        //int main_department_id = new CaresoftHMISEntities().Departments.FirstOrDefault(d => d.DepartmentName.Equals("PATHOLOGY")).Id;

        //Setting Department Names,
        //Key_ = "PathologyDepartmentMarquee",
        //Value = "Pathology",
        public void setUpSettingsParameters()
        {
            //DPathology/Marquee
            var pathMarq = new PathKeyValuePair
            {
                Key_  = "PathologyDepartmentMarquee",
                Value = "Enter Pathology Marquee"
            };
            var pathDep = new PathKeyValuePair
            {
                Key_  = "PathologyDepartmentName",
                Value = "Pathology Department",
            };

            //radiology
            var radMarq = new PathKeyValuePair
            {
                Key_  = "RadiologyDepartmentMarquee",
                Value = "Enter Radiology Marquee"
            };
            var radDep = new PathKeyValuePair
            {
                Key_  = "RadiologyDepartmentName",
                Value = "Radiology Department",
            };

            //HistoCyto
            var histoCytoMarq = new PathKeyValuePair
            {
                Key_  = "HistoCytoDepartmentMarquee",
                Value = "HistoCyto Department",
            };
            var histoCytoDep = new PathKeyValuePair
            {
                Key_  = "HistoCytoDepartmentName",
                Value = "HistoCyto Department",
            };

            dblabs.PathKeyValuePairs.Add(pathMarq);
            dblabs.PathKeyValuePairs.Add(pathDep);

            dblabs.PathKeyValuePairs.Add(radMarq);
            dblabs.PathKeyValuePairs.Add(radDep);

            dblabs.PathKeyValuePairs.Add(histoCytoMarq);
            dblabs.PathKeyValuePairs.Add(histoCytoDep);

            //Add Ally types Of Users
            var userType1 = new UserType
            {
                UserType1 = "Admin",
            };
            var userType2 = new UserType
            {
                UserType1 = "Team Leader",
            };
            var userType3 = new UserType
            {
                UserType1 = "Lab Technichian",
            };

            dblabs.UserTypes.Add(userType1);
            dblabs.UserTypes.Add(userType2);
            dblabs.UserTypes.Add(userType3);


            //Add gender
            var genderFemale = new Gender {
                Type = "Female"
            };
            var genderMale = new Gender {
                Type = "Male"
            };
            var genderOther = new Gender {
                Type = "All"
            };

            dblabs.Genders.Add(genderFemale);
            dblabs.Genders.Add(genderMale);
            dblabs.Genders.Add(genderOther);


            //Add Period Types
            var Days = new Period {
                Days = "Days"
            };
            var Months = new Period {
                Days = "Months"
            };
            var Years = new Period {
                Days = "Years"
            };

            dblabs.Periods.Add(Days);
            dblabs.Periods.Add(Months);
            dblabs.Periods.Add(Years);


            //Add Status
            List <string> statuses = new List <string>();

            statuses.Add("Authorized");
            statuses.Add("Default");
            statuses.Add("SampleCollection");
            statuses.Add("TestResultEntry");
            statuses.Add("Rejected");

            statuses.Add("Tested");
            statuses.Add("Partial Tested");
            statuses.Add("Partial Authorized");
            statuses.Add("Printed");


            statuses.Add("Partially Printed");
            statuses.Add("Registered");



            foreach (string status in statuses)
            {
                var s = new Status
                {
                    StatusValue = status,
                };
                dblabs.Status.Add(s);
            }


            //Configure colors
            var LabsQueueColorSeen = new PathKeyValuePair
            {
                Key_  = "LabsQueueColorSeen",
                Value = "green",
            };


            var LabsColorBillPaid = new PathKeyValuePair
            {
                Key_  = "LabsColorBillPaid",
                Value = "#FF9800",
            };
            var LabsColorPartialBillPaid = new PathKeyValuePair
            {
                Key_  = "LabsColorPartialBillPaid",
                Value = "#0000FF",
            };
            var LabsColorPendingBill = new PathKeyValuePair
            {
                Key_  = "LabsColorPendingBill",
                Value = "#F74519",
            };
            var LabsColorSampleCollectionDone = new PathKeyValuePair
            {
                Key_  = "LabsColorSampleCollectionDone",
                Value = "#008000",
            };
            var LabsColorSampleCollectionPending = new PathKeyValuePair
            {
                Key_  = "LabsColorSampleCollectionPending",
                Value = "#F073F0",
            };

            dblabs.PathKeyValuePairs.Add(LabsQueueColorSeen);

            dblabs.PathKeyValuePairs.Add(LabsColorBillPaid);
            dblabs.PathKeyValuePairs.Add(LabsColorPartialBillPaid);
            dblabs.PathKeyValuePairs.Add(LabsColorPendingBill);
            dblabs.PathKeyValuePairs.Add(LabsColorSampleCollectionDone);
            dblabs.PathKeyValuePairs.Add(LabsColorSampleCollectionPending);

            var LabsColorRegistered = new PathKeyValuePair
            {
                Key_  = "LabsColorRegistered",
                Value = "#D4FFD5",
            };
            var LabsColorTested = new PathKeyValuePair
            {
                Key_  = "LabsColorTested",
                Value = "#FBFDC8",
            };
            var LabsColorAuthorized = new PathKeyValuePair
            {
                Key_  = "LabsColorAuthorized",
                Value = "#ABABAB",
            };
            var LabsColorPartialAuthorized = new PathKeyValuePair
            {
                Key_  = "LabsColorPartialAuthorized",
                Value = "#FCE8FC",
            };
            var LabsColorPartialTested = new PathKeyValuePair
            {
                Key_  = "LabsColorPartialTested",
                Value = "#FCD951",
            };
            var LabsColorPartiallyPrinted = new PathKeyValuePair
            {
                Key_  = "LabsColorPartiallyPrinted",
                Value = "#DBB8D1",
            };
            var LabsColorPrinted = new PathKeyValuePair
            {
                Key_  = "LabsColorPrinted",
                Value = "#B8F765",
            };


            dblabs.PathKeyValuePairs.Add(LabsColorRegistered);
            dblabs.PathKeyValuePairs.Add(LabsColorTested);
            dblabs.PathKeyValuePairs.Add(LabsColorAuthorized);
            dblabs.PathKeyValuePairs.Add(LabsColorPartialAuthorized);
            dblabs.PathKeyValuePairs.Add(LabsColorPartialTested);
            dblabs.PathKeyValuePairs.Add(LabsColorPartiallyPrinted);
            dblabs.PathKeyValuePairs.Add(LabsColorPrinted);

            var LabsColorAccessionDonePatient = new PathKeyValuePair
            {
                Key_  = "LabsColorAccessionDonePatient",
                Value = "#FFA6A3",
            };
            var LabsColorAccessionPendingPatient = new PathKeyValuePair
            {
                Key_  = "LabsColorAccessionPendingPatient",
                Value = "#2F7500",
            };

            dblabs.PathKeyValuePairs.Add(LabsColorAccessionDonePatient);
            dblabs.PathKeyValuePairs.Add(LabsColorAccessionPendingPatient);


            var ShowInQueueBillNotPaid = new PathKeyValuePair
            {
                Key_  = "ShowInQueueBillNotPaid",
                Value = "true",
            };

            dblabs.PathKeyValuePairs.Add(ShowInQueueBillNotPaid);

            dblabs.SaveChanges();
        }
Beispiel #41
0
 public static string Die(UserType callerType, long callerId, UserType targetType, long targetId) => $"die {(byte)callerType} {callerId} {(byte)targetType} {targetId}";
Beispiel #42
0
 public RepositoriesTests(Platform platform, UserType userType) : base(platform, userType)
 {
 }
Beispiel #43
0
 public static string Out(UserType type, long callerId) => $"out {(byte)type} {callerId}";
Beispiel #44
0
        public User(string username, string password, string fullName, string date, bool man, int gewicht, UserType type)
        {
            this.username = username;
            this.password = password;
            this.FullName = fullName;
            this.BirthDay = DateTime.Parse(date);
            this.Type     = type;
            this.Man      = man;
            this.gewicht  = gewicht;
            string test = Encoding.Default.GetString(new SHA256Managed().ComputeHash(Encoding.Default.GetBytes(DateTime.UtcNow.Ticks.ToString() + username)));

            makeHashcodeValid(test);
        }
 public UserTypeChangedMessage(object sender, UserType userType) : base(sender)
 {
     this.UserType = userType;
 }
Beispiel #46
0
        public ActionResult Edit(int id)
        {
            UserType obj = GetById(id);

            return(View(obj));
        }
 public UserModel(string userName, UserType userType, Guid userIdentifier)
 {
     UserName       = userName;
     UserType       = userType;
     UserIdentifier = userIdentifier;
 }
Beispiel #48
0
 public UserType AddUserType(UserType userType)
 {
     _context.UserTypes.Add(userType);
     _context.SaveChanges();
     return(userType);
 }
Beispiel #49
0
 public AppLecturer(string lecturerCode, string firstName, string surname, string username, UserType userType) : base(firstName, surname, username, userType)
 {
     LecturerCode = lecturerCode;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SingleClassInheritanceWithInterfacesTypeTree"/> class.
 /// </summary>
 /// <param name="baseClassUserType">The base class user type.</param>
 /// <param name="factory">The user type factory.</param>
 public SingleClassInheritanceWithInterfacesTypeTree(UserType baseClassUserType, UserTypeFactory factory)
 {
     BaseClassUserType = UserTypeTree.Create(baseClassUserType, factory);
 }
Beispiel #51
0
        public int UpdateUserTypeDetail(UserTypeEntity userType)
        {
            UserType         _userTypeDtl     = null;
            History_UserType _userTypeHistory = new History_UserType();

            int retVal = 0;

            using (var db = new DbContext(CONNECTION_NAME))
            {
                try
                {
                    _userTypeDtl = db.Set <UserType>().Where(s => s.UsT_UserTypeID == userType.UsT_UserTypeID).FirstOrDefault <UserType>();
                    UserType CodeCheck = db.Set <UserType>().Where(s => (s.UsT_UserTypeCode == userType.UsT_UserTypeCode && s.UsT_AccountID == userType.UsT_AccountID && s.UsT_isDeleted == false && s.UsT_UserTypeID != userType.UsT_UserTypeID)).FirstOrDefault <UserType>();
                    UserType TypeCheck = db.Set <UserType>().Where(s => (s.UsT_UserType == userType.UsT_UserType && s.UsT_AccountID == userType.UsT_AccountID && s.UsT_isDeleted == false && s.UsT_UserTypeID != userType.UsT_UserTypeID)).FirstOrDefault <UserType>();
                    if (CodeCheck != null)
                    {
                        return(retVal = 2);
                    }
                    if (TypeCheck != null)
                    {
                        return(retVal = 3);
                    }
                    if (_userTypeDtl == null)
                    {
                        return(retVal);
                    }

                    #region Saving History into History_UserType Table

                    //check for  _userTypeDtl.UsT_ModifiedDate as created date to history table
                    DateTime dtAccCreatedDate = _userTypeDtl.UsT_ModifiedDate ?? DateTime.Now;

                    db.Set <History_UserType>().Add(new History_UserType
                    {
                        History_UsT_UserTypeID          = _userTypeDtl.UsT_UserTypeID,
                        History_AccountID               = _userTypeDtl.UsT_AccountID,
                        History_UsT_UserTypeCode        = _userTypeDtl.UsT_UserTypeCode,
                        History_UsT_UserType            = _userTypeDtl.UsT_UserType,
                        History_UsT_UserTypeDescription = _userTypeDtl.UsT_UserTypeDescription,
                        History_UsT_ActiveStatus        = _userTypeDtl.UsT_ActiveStatus,
                        History_UsT_Version             = _userTypeDtl.UsT_Version,
                        History_UsT_CreatedDate         = dtAccCreatedDate,
                        History_UsT_CreatedBy           = _userTypeDtl.UsT_CreatedBy,
                        History_UsT_ModifiedDate        = _userTypeDtl.UsT_ModifiedDate,
                        History_UsT_ModifiedBy          = _userTypeDtl.UsT_ModifiedBy,
                        History_UsT_isDeleted           = _userTypeDtl.UsT_isDeleted
                    });
                    #endregion

                    #region Saving UserType info Table

                    _userTypeDtl.UsT_AccountID           = userType.UsT_AccountID;
                    _userTypeDtl.UsT_UserTypeCode        = userType.UsT_UserTypeCode;
                    _userTypeDtl.UsT_UserType            = userType.UsT_UserType;
                    _userTypeDtl.UsT_UserTypeDescription = userType.UsT_UserTypeDescription;
                    // _userTypeDtl.UsT_ActiveStatus = userType.UsT_ActiveStatus;
                    _userTypeDtl.UsT_Version      = userType.UsT_Version;
                    _userTypeDtl.UsT_ModifiedDate = System.DateTime.Now;
                    _userTypeDtl.UsT_ModifiedBy   = userType.UsT_ModifiedBy;
                    _userTypeDtl.UsT_isDeleted    = userType.UsT_isDeleted;
                    #endregion
                    db.Entry(_userTypeDtl).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    retVal = 1;
                }
                catch (Exception ex)
                {
                    retVal = -1;
                }
                return(retVal);
            }
        }
Beispiel #52
0
        private UserType LoginUser(string user, string pass)
        {
            // Creates the connection
            MySqlConnection conn = new MySqlConnection(App.connectionString);

            // Construct the SELECT statement
            StringBuilder sb = new StringBuilder();

            sb.Append("SELECT * FROM Person p INNER JOIN Student s ON p.personid = s.personid ");
            sb.Append(" WHERE p.Email = '").Append(user).Append("' ");
            sb.Append(" OR s.Login = '******' ");
            sb.Append("; "); // Note that there are TWO select statement in the same string. Use the semi-colon to split them
            sb.Append("SELECT * FROM Person p INNER JOIN Staff s ON p.personid = s.personid ");
            sb.Append(" WHERE p.Email = '").Append(user).Append("' ");
            sb.Append(" OR s.Login = '******' ");
            sb.Append("; ");


            // Creates the SQL commands
            MySqlCommand command = new MySqlCommand(sb.ToString(), conn);

            MySqlDataReader dr;                      // Creates a reader to read the data

            string   passCompare = "";               // Variable to store the password from the DataBase
            UserType result      = UserType.Unknown; // Variable to store the result of this method
            string   userName    = "";

            conn.Open();                  // Open the connection to execute the Student Select
            dr = command.ExecuteReader(); // Execute the command and attach to the reader

            // Because I've put the select from Student First. I will check for student
            // Check if there are rows in the Student Select
            if (dr.HasRows)
            {
                // If so, get the password in the database
                while (dr.Read())
                {
                    // Get the password from DataBase
                    passCompare = dr.GetString("Password");
                }
                if (passCompare == pass)
                {
                    result         = UserType.Student;
                    App.userLogged = dr.GetString("FirstName") + " " + dr.GetString("LastName");
                }
            }
            else
            {
                // If there are no rows in the Student, check the Staff select using the NextResult() method
                // Make sure that there is more results
                if (dr.NextResult())
                {
                    // Check if there are rows in the new result
                    if (dr.HasRows)
                    {
                        while (dr.Read())
                        {
                            // Get the password from DataBase
                            passCompare = dr.GetString("Password");
                        }
                        if (passCompare == pass)
                        {
                            result         = UserType.Staff;
                            App.userLogged = dr.GetString("FirstName") + " " + dr.GetString("LastName");
                        }
                    }
                }
            }

            return(result); // Return the result
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            //var user1 = new User()
            //{
            //    username = "******",
            //    firstname = "Bob",
            //    lastname = "Best",
            //    password = "******",
            //    phone = "555-555-5555"
            //};

            //List<User> users2 = new List<User> { user1, user1 };
            //var listJson = JsonConvert.SerializeObject(users2);

            const string graphUrl = "https://localhost:44376/graphql";
            //const string graphUrl = "http://getmealife.azurewebsites.net/graphql";

            var userType = new UserType()
            {
                id          = 1,
                userid      = 1,
                eventtypeid = 1,
                occurrences = 3
            };

            userType = Api.Update(graphUrl, userType, userType.id);
            Console.WriteLine("yay");


            //var events = Api.GetList<Event>(graphUrl, new Event());
            //foreach (var evnt in events)
            //{
            //    Console.WriteLine(evnt.ToString());
            //}

            //var users = Api.GetList<User>(graphUrl, new User());

            //var user = Api.Get<User>(graphUrl, new User(), users.FirstOrDefault().id);

            //user.username = user.username + " UPDATED";

            //var updatedUser = Api.Update<User>(graphUrl, user, user.id);

            //var createdUser = Api.Create<User>(graphUrl, user1);

            //var file = "C:\\Users\\cwestover\\Desktop\\EventData.csv";

            //string[] csvRows = File.ReadAllLines(file);
            //List<Event> events = new List<Event>();
            //List<EventType> eventTypes = new List<EventType>();
            //bool skip = true;
            //foreach (var row in csvRows)
            //{
            //    if (skip)
            //    {
            //        skip = false;
            //        continue;
            //    }
            //    var fields = row.Split(",");
            //    var eventType = new EventType()
            //    {
            //        name = fields[9]
            //    };
            //    if (!eventTypes.Contains(eventType))
            //        eventTypes.Add(eventType);

            //    var eventTypeIndex = eventTypes.IndexOf(eventType) + 1;

            //    var evnt = new Event()
            //    {
            //        accessibility = (fields[7] == "Relaxed" ? 0.2 : 0.4) + (fields[14] == "Participant" ? 0.0 : (fields[14] == "Varies" ? .3 : .15)),
            //        description = fields[6],
            //        eventdate = DateTime.Parse(fields[2]),
            //        eventstart = DateTime.Parse(fields[2]) + TimeSpan.Parse(fields[3]),
            //        eventend = DateTime.Parse(fields[2]) + TimeSpan.Parse(fields[4]),
            //        eventtypeid = eventTypeIndex,
            //        latitude = 0.0,
            //        longitude = 0.0,
            //        locationaddress = (fields[11] + fields[12] + fields[13]).Replace("\"", ""),
            //        locationname = fields[10],
            //        name = fields[1],
            //        participants = fields[8] == "Small" ? 0 : 2,
            //        price = Double.Parse(fields[5])
            //    };

            //    events.Add(evnt);
            //}

            ////foreach (var eventType in eventTypes)
            ////{
            ////    var committedEvent = Api.Create<EventType>(graphUrl, eventType);
            ////    Console.WriteLine(committedEvent.ToJson());
            ////}

            //foreach (var evnt in events)
            //{
            //    var committedEvent = Api.Create<Event>(graphUrl, evnt);
            //    Console.WriteLine(committedEvent.ToJson());
            //}

            //var user = User.ReadFromJson<User>(jsonNeedsToBe);
        }
Beispiel #54
0
        static void Main(string[] args)
        {
            // Пример использования коллекции с идентификатором
            // в виде пользовательского типа UserType

            Console.WriteLine("Cоздаём и наполняем коллекцию:");
            var collection = new UserCollection <UserType, string, string>();
            // Пользовательские Id
            var id1 = new UserType(1, "a");
            var id2 = new UserType(2, "b");
            var id3 = new UserType(3, "c");
            // Набор ключей
            var k1 = new Tuple <UserType, string>(id1, "Mike");
            var k2 = new Tuple <UserType, string>(id2, "Mike");
            var k3 = new Tuple <UserType, string>(id2, "Jane");
            var k4 = new Tuple <UserType, string>(id3, "Max");

            // Добавляем элементы по ключам
            collection.Add(k1, "Employee");
            collection.Add(k2, "Manager");
            collection.Add(k3, "Looser");
            collection.Add(k4, "Looser");
            Console.WriteLine("Элементов в коллекции: " + collection.Count);

            Console.WriteLine("Поиск по Id = [2, b]:");
            var elementsByName = collection.SearchById(id2);

            foreach (KeyValuePair <string, string> x in elementsByName)
            {
                Console.WriteLine("[" + x.Key + "] = " + x.Value);
            }

            Console.WriteLine("Поиск по Name = [Mike]:");
            var elementsById = collection.SearchByName("Mike");

            foreach (KeyValuePair <UserType, string> x in elementsById)
            {
                Console.WriteLine("[" + x.Key.id1 + ", " + x.Key.id2 + "] = " + x.Value);
            }

            Console.WriteLine("Получение значения по составному ключу = [[3,c],Max]:");
            string element;

            if (collection.TryGetValue(k4, out element))
            {
                Console.WriteLine("[[3,c],Max] = " + element);
            }
            else
            {
                Console.WriteLine("Элемент с ключом [[3,c],Max] не найден");
            }

            Console.WriteLine("Удаление элемента по составному ключу = [[3,c],Max]:");
            if (collection.Remove(k4))
            {
                Console.WriteLine("Удаление прошло успешно");
            }
            else
            {
                Console.WriteLine("Удаление прошло неуспешно ");
            }
            if (collection.TryGetValue(k4, out element))
            {
                Console.WriteLine("[[3,c],Max] = " + element);
            }
            else
            {
                Console.WriteLine("Элемент с ключом [[3,c],Max] не найден");
            }

            // Более подробно с работой этих и других функций
            // можно ознакомиться в описании к ним и в тестах

            if (System.Diagnostics.Debugger.IsAttached)
            {
                Console.ReadLine();
            }
        }
Beispiel #55
0
 public User()
 {
     this.Name     = "";
     this.Password = "";
     this.Type     = UserType.Student;
 }
        /// <summary>
        /// Create a new DriverWay
        /// </summary>
        /// <param name="accountId"></param>
        /// <param name="sourceCity"></param>
        /// <param name="destCity"></param>
        /// <param name="createTime"></param>
        /// <returns></returns>
        public static CallLog CreateCallLog(Guid?specwayId, Guid?gooderProudctId, Guid sourceAccountId, UserType userType, Guid destAccountId, string message)
        {
            var callLog = new CallLog();

            callLog.SpecwayId       = specwayId;
            callLog.GooderProudctId = gooderProudctId;

            callLog.SourceAccountId = sourceAccountId;
            callLog.UserType        = userType;

            callLog.DestAccountId = destAccountId;
            callLog.Message       = message;

            callLog.CreateOn = DateTime.Now;

            callLog.GenerateNewIdentity();


            return(callLog);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UserTypeInstance"/> class.
 /// </summary>
 /// <param name="userType">The user type.</param>
 protected UserTypeInstance(UserType userType)
     : base(userType.CodeNaming)
 {
     UserType = userType;
 }
Beispiel #58
0
        public static void SetFakeUserAndUserType(this Controller controller, string userId, UserType userType)
        {
            SetFakeHttpContextIfNotAlreadySet(controller);

            var claimsPrincipal = new ClaimsPrincipal();

            claimsPrincipal.AddIdentity(new ClaimsIdentity(new List <Claim>
            {
                new Claim(ClaimTypes.NameIdentifier, userId),
                new Claim(AllReady.Security.ClaimTypes.UserType, Enum.GetName(typeof(UserType), userType))
            }));

            Mock.Get(controller.HttpContext).SetupGet(httpContext => httpContext.User).Returns(claimsPrincipal);
        }
Beispiel #59
0
 public static string SkillUsed(UserType type, long callerId, byte secondaryType, long targetId, short skillVNum, short cooldown, short attackAnimation, short skillEffect, short x, short y, bool isAlive, int health, int damage, int hitmode, byte skillType) => $"su {(byte)type} {callerId} {secondaryType} {targetId} {skillVNum} {cooldown} {attackAnimation} {skillEffect} {x} {y} {(isAlive ? 1 : 0)} {health} {damage} {hitmode} {skillType}";
Beispiel #60
0
 public static string CastOnTarget(UserType type, long callerId, byte secondaryType, long targetId, short castAnimation, short castEffect, short skillVNum) => $"ct {(byte)type} {callerId} {secondaryType} {targetId} {castAnimation} {castEffect} {skillVNum}";