public bool Login(string username, string password, eUserType userType, string ip, string mac, string hostname) { try { using (var context = new WinDbEntities()) { var i = context.Users.FirstOrDefault(u => u.Username == username && u.Password == password && u.Type == (byte)userType); if (i == null) { return(false); } i.LoginTraces.Add(new LoginTrace() { Hostname = hostname, IpAddress = ip, MacAddress = mac, TimeLogin = DateTime.Now }); context.SaveChanges(); return(true); } } catch (Exception ex) { Logger.Error(ex); return(false); } }
public void Init(eUserType UserType) { XmlDocument doc = new XmlDocument(); string ConfigFileSourcePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\UserTypeConfiguration.XML"; // for unit test we might not have this file if (System.IO.File.Exists(ConfigFileSourcePath)) { doc.Load(ConfigFileSourcePath); XmlNamespaceManager manager = XMLDocExtended.GetAllNamespaces(doc); IsSupportAutomate = Boolean.Parse(doc.SelectSingleNode("//Ginger/UserType[@Name='" + UserType + "']/Functionality[@Name='Automate']", manager).Attributes["Enable"].Value); IsSupportExecution = Boolean.Parse(doc.SelectSingleNode("//Ginger/UserType[@Name='" + UserType + "']/Functionality[@Name='Execution']", manager).Attributes["Enable"].Value); IsSupportReports = Boolean.Parse(doc.SelectSingleNode("//Ginger/UserType[@Name='" + UserType + "']/Functionality[@Name='Reports']", manager).Attributes["Enable"].Value); IsSupportSourceControl = Boolean.Parse(doc.SelectSingleNode("//Ginger/UserType[@Name='" + UserType + "']/Functionality[@Name='SourceControl']", manager).Attributes["Enable"].Value); IsSupportALM = Boolean.Parse(doc.SelectSingleNode("//Ginger/UserType[@Name='" + UserType + "']/Functionality[@Name='ALM']", manager).Attributes["Enable"].Value); IsSupportSupport = Boolean.Parse(doc.SelectSingleNode("//Ginger/UserType[@Name='" + UserType + "']/Functionality[@Name='Support']", manager).Attributes["Enable"].Value); IsSupportAnalyzer = Boolean.Parse(doc.SelectSingleNode("//Ginger/UserType[@Name='" + UserType + "']/Functionality[@Name='Analyzer']", manager).Attributes["Enable"].Value); } else { IsSupportAutomate = true; IsSupportExecution = IsSupportReports = true; IsSupportSourceControl = true; IsSupportALM = true; IsSupportSupport = true; IsSupportAnalyzer = true; } }
public UserProfilePage() { InitializeComponent(); //profile image if (string.IsNullOrEmpty(WorkSpace.Instance.UserProfile.ProfileImage)) { xProfileImageImgBrush.ImageSource = ImageMakerControl.GetImageSource(Amdocs.Ginger.Common.Enums.eImageType.User, foreground: (System.Windows.Media.SolidColorBrush)FindResource("$BackgroundColor_DarkBlue"), width: 50); } else { xProfileImageImgBrush.ImageSource = Ginger.General.GetImageStream(Ginger.General.Base64StringToImage(WorkSpace.Instance.UserProfile.ProfileImage)); } GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xUserNameTxtBox, TextBox.TextProperty, WorkSpace.Instance.UserProfile, nameof(UserProfile.UserName), BindingMode.OneWay); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xUserFirstNameTxtBox, TextBox.TextProperty, WorkSpace.Instance.UserProfile, nameof(UserProfile.UserFirstName)); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xUserMiddleNameTxtBox, TextBox.TextProperty, WorkSpace.Instance.UserProfile, nameof(UserProfile.UserMiddleName)); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xUserLastNameTxtBox, TextBox.TextProperty, WorkSpace.Instance.UserProfile, nameof(UserProfile.UserLastName)); mOriginalUserType = WorkSpace.Instance.UserProfile.UserType; xUserTypeComboBox.BindControl(WorkSpace.Instance.UserProfile, nameof(UserProfile.UserType)); xUserTypeNoteLbl.Visibility = Visibility.Collapsed; xUserRoleComboBox.BindControl(WorkSpace.Instance.UserProfile, nameof(UserProfile.UserRole)); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xUserDepartmentTxtBox, TextBox.TextProperty, WorkSpace.Instance.UserProfile, nameof(UserProfile.UserDepartment)); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xUserEmailAddressTxtBox, TextBox.TextProperty, WorkSpace.Instance.UserProfile, nameof(UserProfile.UserEmail)); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xUserPhoneTxtBox, TextBox.TextProperty, WorkSpace.Instance.UserProfile, nameof(UserProfile.UserPhone)); }
/// <summary> /// User Class /// </summary> /// <param name="name">User Name</param> /// <param name="password">Password</param> /// <param name="type">User Type</param> public User(string name, string password, eUserType type) { ID++; Name = name; Password = password; Type = type; }
public SetUserTypePage() { InitializeComponent(); UserTypeCombo.ItemsSource = GingerCore.General.GetEnumValues(typeof(eUserType)); App.ObjFieldBinding(UserTypeCombo, ComboBox.TextProperty, App.UserProfile, nameof(UserProfile.UserType)); mInitialType = App.UserProfile.UserType; }
public User(string i_Name, eUserType i_UserType, int i_Score, eTypeSign i_SoldierSign, eTypeSign i_KingSign, bool i_TurnFlag) { this.m_Name = i_Name; this.m_Score = i_Score; this.m_UserType = i_UserType; this.m_SoldierSign = i_SoldierSign; this.m_KingSign = i_KingSign; this.m_TurnFlag = i_TurnFlag; }
private void setType() { if (r_PlayerName.Equals("Computer")) { m_UserType = eUserType.Computer; } else { m_UserType = eUserType.Uman; } }
/// <summary> /// Get sub-campaign internal user records /// </summary> public static ObjectResult GetSubCampaignUsers(int SubCampaignId, eUserType UserType) { BrightPlatformEntities m_objBrightPlatformEntity = new BrightPlatformEntities(UserSession.EntityConnection); ObjectResult objSubCampaignUsers = null; switch (UserType) { case eUserType.InternalUser: { objSubCampaignUsers = m_objBrightPlatformEntity.FIGetSubCampaignInternalUsers(SubCampaignId); break; } case eUserType.CustomerUser: { objSubCampaignUsers = m_objBrightPlatformEntity.FIGetSubCampaignCustomerUsers(SubCampaignId); break; } } return objSubCampaignUsers; }
/// <summary> /// constructor that initializes the User data member /// </summary> public User(string name, string email, string password, eUserType userType) : base(name) { Email = email; Password = password; UserType = userType; }