/// <summary> /// Perform Username Association /// </summary> /// <param name="corpUserName"></param> /// <param name="corpPassword"></param> /// <param name="simplUserName"></param> /// <param name="simplPassword"></param> public void PerformAssociation(string corpUserName, string corpPassword, string simplUserName, string simplPassword) { var corpAuthResult = AttemptToLogUserIn(corpUserName, corpPassword).Message; if (corpAuthResult != Constants.Areas.Common.LoginModel.AuthenticationResultMessages.NoUserRoles) { throw new ArgumentException("Corp login credentials are incorrect"); } var simplAuthResult = AttemptToLogUserIn(simplUserName, simplPassword); if (simplAuthResult.Errors) { throw new ArgumentException("SIMPL login credentials are incorrect"); } var myUserManagement = new UserManagement(); var updateResult = myUserManagement.UpdateUsername(simplUserName, corpUserName); if (updateResult == UserManagement.UpdateUsernameResult.Failed) { var errorMessage = string.Format("Username Association Failed - SIMPL Username {0} | CORP Username {1}", simplUserName, corpUserName); throw new Exception(errorMessage); } if (!_userRepository.UpdateHistoricalRecord(corpUserName, simplUserName)) { _errorLogger.LogError(new Exception(string.Format("Historical records failed to update for SIMPL user: {0} to Corp Id:{1}",simplUserName,corpUserName))); } }
void Awake(){ instance = this; GetStoredInfo(); Login("alpha", "abcdefg"); // CreateNewUser("birdimus3","123456","*****@*****.**"); }
/// <summary> /// AttemptToLogUserIn method /// </summary> /// <param name="userName"></param> /// <param name="password"></param> /// <returns></returns> public LoginModel AttemptToLogUserIn(string userName, string password) { LoginModel myLoginModel = new LoginModel(); var myUserManagement = new UserManagement(); var authenticationResult = myUserManagement.Authenticate(userName, password); if ((authenticationResult == UserManagement.AuthenticationResults.InvalidPassword) || (authenticationResult == UserManagement.AuthenticationResults.NoMatchingUser)) { myLoginModel.Message = Constants.Areas.Common.LoginModel.AuthenticationResultMessages.BadOrIncorrectUsernameOrPassword; myLoginModel.Errors = true; return myLoginModel; } if (authenticationResult == UserManagement.AuthenticationResults.ChangePassword) { myLoginModel.Message = Constants.Areas.Common.LoginModel.AuthenticationResultMessages.ChangePassword; myLoginModel.Errors = true; return myLoginModel; } if (authenticationResult != UserManagement.AuthenticationResults.Success) { myLoginModel.Message = Constants.Areas.Common.LoginModel.AuthenticationResultMessages.UnknownResult; myLoginModel.Errors = true; return myLoginModel; } myLoginModel.User = myUserManagement.GetUserDetails(userName); myLoginModel.Groups = myUserManagement.GetUserGroups(userName); if(myLoginModel.User == null || myLoginModel.Groups.Count == 0) { myLoginModel.Message = Constants.Areas.Common.LoginModel.AuthenticationResultMessages.NoUserRoles; myLoginModel.Errors = true; return myLoginModel; } return myLoginModel; }
private void Page_Load(object sender, EventArgs e) { var tempVal = Request.QueryString; ReadQueryString(); InitializeEvents(); this.CanEditAOR = UserManagement.UserCanEdit(WTSModuleOption.AOR); this.CanViewAOR = this.CanEditAOR || UserManagement.UserCanView(WTSModuleOption.AOR); this.CanEditWorkItem = UserManagement.UserCanEdit(WTSModuleOption.WorkItem); DataTable dtCRAOR = LoadData(); if (dtCRAOR != null) { this.DCC = dtCRAOR.Columns; } grdData.AllowPaging = false; grdData.AlternatingRowColor = System.Drawing.Color.White; grdData.DataSource = dtCRAOR; grdData.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { this.IsAdmin = UserManagement.UserIsInRole("Admin"); this.CanEdit = UserManagement.UserCanEdit(WTSModuleOption.MasterData); this.CanView = (CanEdit || UserManagement.UserCanView(WTSModuleOption.MasterData)); readQueryString(); initControls(); if (this.ImageID > 0) { DataTable dt = MasterData.Image_Get(ImageID: this.ImageID); if (dt == null || dt.Rows.Count == 0 || DBNull.Value.Equals(dt.Rows[0]["FileData"])) { return; } byte[] fileData = (byte[])dt.Rows[0]["FileData"]; Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=\"" + dt.Rows[0]["FileName"].ToString() + "\""); Response.AddHeader("Content-Length", fileData.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.OutputStream.Write(fileData, 0, fileData.Length); Response.End(); } else { if (!Page.IsPostBack) { loadGridData(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { User userObj = new User(); UserManagement uDao = new UserManagement(); ////noted,CheEe(001):add this to pass the create user page!!! //if (Session["userType"] == null) //{ // Session["userType"] = "Admin"; // Session["userID"] = 18;// "*****@*****.**"; //} if (Session["userID"] == null || Session["userType"] == null) { Response.Redirect("login.aspx"); } if (Session["userType"].ToString() == Reference.USR_ADM) { userObj = uDao.getAdminByID(Session["userID"].ToString()); adminDiv.Visible = true; userDiv.Visible = false; lbAdminName.Text = userObj.Name; } else if (Session["userType"].ToString() == Reference.USR_MEM) { userObj = uDao.getUserByID(Session["userID"].ToString()); adminDiv.Visible = false; userDiv.Visible = true; lbUserName.Text = userObj.Name; } } }
private void OnChangePassword(Grid grid) { if (grid == null) { return; } IDictionary <string, string> passwords = GetPasswords(grid); string old = passwords["Old"]; string newPassword = passwords["New"]; bool changed = UserManagement.ChangePassword(Repository, old, newPassword); if (changed) { MessageBoxHelper.ShowMessage(Resources.TXT_PASSWORD_HAS_BEEN_CHANGED); } else { MessageBoxHelper.ShowError(Resources.ERR_COULD_NOT_CHANGE_PASSWORD); } ClearPasswords(grid); }
void TokenLogin_Worker(object o) { if (o != null) { string token = o.ToString(); UserConfiguration userConfig = null; userConfig = UserManagement.TokenLogin(token, "TrakHound Client Token Login"); Dispatcher.BeginInvoke(new Action(() => { Login_Finished(userConfig); if (userConfig == null) { Properties.Settings.Default.LoginRememberToken = null; Properties.Settings.Default.Save(); TrakHound_UI.MessageBox.Show("User Login Failed. Please Try Again.", "Login Failed", TrakHound_UI.MessageBoxButtons.Ok); } }), System.Windows.Threading.DispatcherPriority.Background, new object[] { }); } }
private void loadGridData() { _dtSystem = MasterData.SystemList_Get(includeArchive: false, WTS_SYSTEM_SUITEID: _qfSystemSuiteID); _dtResource = UserManagement.LoadUserList(); _dtAORRole = AOR.AORRoleList_Get(); DataTable dt = MasterData.Resource_SystemList_Get(SystemSuiteResourceID: this._systemSuiteResourceID); if (dt != null) { this.DCC = dt.Columns; Page.ClientScript.RegisterArrayDeclaration("_dcc", JsonConvert.SerializeObject(DCC, Newtonsoft.Json.Formatting.None)); InitializeColumnData(ref dt); dt.AcceptChanges(); } int count = dt.Rows.Count; count = count > 0 ? count - 1 : count; //need to subtract the empty row spanRowCount.InnerText = count.ToString(); grdMD.DataSource = dt; grdMD.DataBind(); }
/// <summary> /// Populates a <see cref="DropDownList"/> with all known user accounts. /// </summary> /// <param name="list">The <see cref="DropDownList"/> to fill.</param> protected void FillUsers(DropDownList list) { MembershipUserCollection users = Membership.GetAllUsers(); list.Items.Clear(); if (users.Count > 0) { list.Items.Add(new ListItem("(select a user account)", string.Empty)); // BUGFIX #31 - sort users list by user display name and not username List <ListItem> tempList = new List <ListItem>(); foreach (MembershipUser user in users) { tempList.Add(new ListItem(UserManagement.GetFullName(user), user.UserName)); } foreach (ListItem item in tempList.OrderBy(i => i.Text)) { list.Items.Add(item); } } else { list.Items.Add(new ListItem("(no user accounts exist)")); } }
/// <summary> /// 查询所有用户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnGetUser_Click(object sender, EventArgs e) { lbUser.Items.Clear(); string userName = lbPublicAccount.SelectedValue; ErrorMessage errorMessage; string[] openIds = UserManagement.GetUserList(userName); if (openIds != null && openIds.Length > 0) { foreach (string openId in openIds) { UserInfo user = UserManagement.GetUserInfo(userName, openId, out errorMessage); if (errorMessage.IsSuccess && user != null) { lbUser.Items.Add(new ListItem(string.Format("{0}({1})", user.nickname, user.sex), user.openid)); } } ltrMessage.Text = string.Format("查询所有用户成功。用户数:{0}", openIds.Length); } else { ltrMessage.Text = "查询所有分组失败。"; } }
public IHttpActionResult ResetPassword([FromBody] LoginRequest login) { var loginResponse = new LoginResponse { }; loginResponse.responseMsg = new HttpResponseMessage(); IHttpActionResult response; bool isUsernamePasswordValid = false; UserManagement umgnt = new UserManagement(); long UserId = 0; isUsernamePasswordValid = umgnt.ResetPassword(login.Username, login.Password, out UserId); if (isUsernamePasswordValid) { return(Ok <bool>(isUsernamePasswordValid)); } else { // if credentials are not valid send unauthorized status code in response loginResponse.responseMsg.StatusCode = HttpStatusCode.Unauthorized; response = ResponseMessage(loginResponse.responseMsg); return(response); } }
public ActionResult Registration([Bind(Exclude = "IsEmailVerified,ActivationCode")] UserData user) { bool status = false; string message = ""; if (ModelState.IsValid) { // Validate if the email address is already existed. var emailExisted = IsEmailExist(user.Email); if (emailExisted) { ModelState.AddModelError("EmailExist", "Your Email Address is already in use"); return(View(user)); } // Generate activation code var code = Guid.NewGuid().ToString("N"); user.Password = PasswordHash.CreateHash(user.Password); user.ConfirmPassword = PasswordHash.CreateHash(user.ConfirmPassword); // This is always going to be false... user.IsEmailVerified = false; UserManagement.Add(user); } else { message = "Invalid Request"; } //Password return(View(user)); }
/// <summary> /// Targets account viewer controls toward a specific user account. /// </summary> /// <param name="user">The <see cref="MembershipUser"/> account to use.</param> public new void SetUser(MembershipUser user) { // check for null user if (object.Equals(user, null)) { return; } // check for known user if (object.Equals(Membership.GetUser(user.ProviderUserKey), null)) { return; } base.SetUser(user); if (_candidate != null) { _candidateName.Text = string.Format("{0} (ID: {1})", _candidate.Name, _candidate.ID); } _username.Text = user.UserName; _displayName.Text = UserManagement.GetFullName(user); _email.Text = user.Email; GetActiveStatus(user); GetLockoutStatus(user); _onlineStatus.Checked = user.IsOnline; _lastActivity.Text = user.LastActivityDate.Equals(user.CreationDate) ? Properties.Resources.NeverActiveText : user.LastActivityDate.ToString(); _lastLockedOut.Text = user.LastLockoutDate < user.CreationDate ? Properties.Resources.NeverLockedOutText : user.LastLockoutDate.ToString(); _lastLoggedIn.Text = user.LastLoginDate.Equals(user.CreationDate) ? Properties.Resources.NeverLoggedInText : user.LastLoginDate.ToString(); _lastPasswordChange.Text = user.LastPasswordChangedDate.Equals(user.CreationDate) ? Properties.Resources.NeverChangedPasswordText : user.LastPasswordChangedDate.ToString(); _newComment.Text = user.Comment; _comment.Text = Page.Server.HtmlEncode(user.Comment).Replace("\n", "<br />"); _resetPasswordButton.OnClientClick = string.Format("return confirmReset('{0}','{1}');", user.UserName, user.Email); string caid = UserManagement.GetCaid(user.UserName); _contactType.Text = AccountAnalysis.ParseEntityType(caid).ToString(); _caid.Value = caid; _synchronizeButton.Enabled = !string.IsNullOrEmpty(caid); }
public bool UpdateUser(UserRowData user) { bool success = false; using (var service = new UserManagement()) { try { var updateUser = new UserDetail { UserName = user.UserName, DisplayName = user.DisplayName, EmailAddress = user.EmailAddress, Enabled = user.Enabled }; var groups = new List <AuthorityGroupSummary>(); foreach (UserGroup userGroup in user.UserGroups) { groups.Add(new AuthorityGroupSummary(new EntityRef(userGroup.UserGroupRef), userGroup.Name, userGroup.Name, false, false)); } updateUser.AuthorityGroups = groups; service.UpdateUserDetail(updateUser); success = true; } catch (Exception ex) { Platform.Log(LogLevel.Error, ex, "Unexpected exception updating user: {0}", user.DisplayName); } } return(success); }
/// <summary> /// 得到用户列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnGetUser_Click(object sender, EventArgs e) { string userName = lbPublicAccount.SelectedValue; ErrorMessage errorMessage; rblUser.Items.Clear(); string[] openIds = UserManagement.GetUserList(userName); if (openIds != null && openIds.Length > 0) { foreach (string openId in openIds) { UserInfo user = UserManagement.GetUserInfo(userName, openId, out errorMessage); if (errorMessage.IsSuccess && user != null) { rblUser.Items.Add(new ListItem(user.nickname, openId)); } } ltrMessage.Text = "获取用户成功。"; } else { ltrMessage.Text = "获取用户失败。"; } }
protected void Page_Load(object sender, System.EventArgs e) { PortalDefinition.Tab currentTab = PortalDefinition.CurrentTab; if (currentTab == null || currentTab.tabs == null) { return; } ArrayList tabList = new ArrayList(); foreach (PortalDefinition.Tab t in currentTab.tabs) { if (UserManagement.HasViewRights(Page.User, t.roles)) { DisplayTabItem dt = new DisplayTabItem(); tabList.Add(dt); dt.m_Text = t.title; dt.m_URL = "../../" + Portal.API.Config.GetTabUrl(t.reference); } } Tabs.DataSource = tabList; Tabs.DataBind(); }
public void LogInOkNotExistUserSessionTest() { User user = new User() { Id = Guid.NewGuid(), Name = "Martin", LastName = "Gutman", UserName = "******", Mail = "*****@*****.**", Password = "******" }; var userRepositoryMock = new Mock <IUserRepository>(MockBehavior.Strict); userRepositoryMock.Setup(m => m.GetUserByEmailAndPassword(user.Mail, user.Password)).Returns(user);; var userSessionRepositoryMock = new Mock <IUserSessionRepository>(MockBehavior.Strict); userSessionRepositoryMock.Setup(m => m.GetUserSessionByUserId(user.Id)).Returns(value: null); userSessionRepositoryMock.Setup(m => m.Add(It.IsAny <UserSession>())); UserManagement userLogic = new UserManagement(userRepositoryMock.Object, userSessionRepositoryMock.Object); UserSession userSessionResult = userLogic.LogIn(user.Mail, user.Password); userRepositoryMock.VerifyAll(); Assert.AreEqual(user, userSessionResult.User); }
public void UpdateValidUser() { User user = new User() { Id = Guid.NewGuid(), Name = "Martin", LastName = "Gutman", UserName = "******", Mail = "*****@*****.**", Password = "******" }; user.Name = "Gonzalo"; var userRepositoryMock = new Mock <IUserRepository>(MockBehavior.Strict); userRepositoryMock.Setup(m => m.Get(It.IsAny <Guid>())).Returns(user); userRepositoryMock.Setup(m => m.GetUserByEmail(It.IsAny <string>())).Returns(value: null); userRepositoryMock.Setup(m => m.Update(It.IsAny <User>())); var userLogic = new UserManagement(userRepositoryMock.Object); var result = userLogic.UpdateUser(user.Id, user); userRepositoryMock.VerifyAll(); Assert.AreEqual("Gonzalo", user.Name); }
protected void Page_Load(object sender, EventArgs e) { cvValue = Request.QueryString["ChildView"] == null ? "0" : Request.QueryString["ChildView"].Trim(); this.IsAdmin = UserManagement.UserIsInRole("Admin"); this.CanEdit = UserManagement.UserCanEdit(WTSModuleOption.MasterData); this.CanView = (CanEdit || UserManagement.UserCanView(WTSModuleOption.MasterData)); readQueryString(); if (cvValue == "1") { //From parent //ChildView == 1, 'Allocation Assignment' selected initControlsAA(); loadGridDataAA(); } else { //From parent //ChildView == 0, 'Work Area' selected initControls(); loadGridData(); } }
public ActionResult Delete() { ViewBag.Message = "User Delete (the last user)"; UserManagement request = new UserManagement(ApiKey); request.PrepareSelectRequest(); string response; if (request.SendRequest(SharedKey, out response)) { dynamic data = JsonConvert.DeserializeObject(response); if (data != null && data.users != null && data.users.Count > 0) { int index = data.users.Count - 1; string username = data.users[index].username; request.Username = username; request.PrepareDeleteRequest(); return(SendRequest(request)); } else { TempData.Add("error", "No users to delete"); } } else { TempData.Add("error", string.Format("Could not query users:\r\n{0}", response)); } return(View()); }
public ActionResult UpdateProfile(string id) { var user = new UserManagement().GetUser(id); return(View(user)); }
protected void Page_Load(object sender, EventArgs e) { this.isAdmin = UserManagement.UserIsUserAdmin(UserManagement.GetUserId_FromUsername()); initControls(); }
protected void GetUserInfo(object sender, EventArgs e) { Alias_DropDownList.Items.Clear(); //Create a new client to store authentication RestClient serviceAuthenticationClient = UiDrivenLogin.Authenticate(TenantUrl, AdminServiceAccount); //Parse result challenge list. This is a service account so we can assume the results will be password and that there will only be one result. Dictionary <string, dynamic> mech = serviceAuthenticationClient.ChallengeCollection[0]["Mechanisms"][0]; //Login for service account is assumed to only require password and no MFA. if (mech["AnswerType"] == "Text") { //Call advance authentication with our service account credentials UiDrivenLogin.AdvanceForMech(serviceAuthenticationClient, serviceAuthenticationClient.TenantId, serviceAuthenticationClient.SessionId, true, mech, null, AdminServicePass); } //Something other then text was returned which indicates that the service account is not set up correctly. else { FailureText.Text = "The service account is not set up correctly. It should only require a password an no MFA."; ErrorMessage.Visible = true; UserInfo_div.Visible = false; MyAccount_Start_div.Visible = false; } //Pull authentication client from session RestClient authenticationClient = (RestClient)Session["AuthenticaitonClient"]; //Create a new userManagementClient and pass our authenticated rest client from our login call. UserManagement userManagementClient = new UserManagement(authenticationClient); UserManagement serviceUserManagementClient = new UserManagement(serviceAuthenticationClient); Dictionary <string, dynamic> getAliases = userManagementClient.GetAliasesForTenant(); //Get a list of all tenant Aliases int iCount = 0; foreach (var alias in getAliases["Result"]["Results"]) { Alias_DropDownList.Items.Insert(0, new ListItem(alias["Row"]["ID"], iCount.ToString())); iCount++; } //Get User Info Dictionary <string, dynamic> getUser = userManagementClient.GetUser(); Dictionary <string, dynamic> getUserResult = getUser["Result"]; //Get User UUID Dictionary <string, dynamic> queryResult = serviceUserManagementClient.Query(@"select ID from cduser where Name ='" + getUserResult["Name"] + "'"); int queryCount = queryResult["Count"]; if (queryCount == 1) { //split the username and domain name. add user name into LoginName text box and select the correct domain in the alias dropdown. string s = getUserResult["Name"]; string[] userName = s.Split('@'); Alias_DropDownList.Items.FindByText(userName[1]).Selected = true; //populate user info LoginName.Text = userName[0]; UserUUID.Text = queryResult["Results"][0]["Row"]["ID"]; Email.Text = getUserResult["Mail"]; //check that optional attributes are populated if (getUserResult.ContainsKey("DisplayName")) { DisplayName.Text = getUserResult["DisplayName"]; } if (getUserResult.ContainsKey("OfficeNumber")) { OfficeNumber.Text = getUserResult["OfficeNumber"]; } if (getUserResult.ContainsKey("MobileNumber")) { MobileNumber.Text = getUserResult["MobileNumber"]; } if (getUserResult.ContainsKey("HomeNumber")) { HomeNumber.Text = getUserResult["HomeNumber"]; } if (getUserResult.ContainsKey("InEverybodyRole")) { InEverybodyRole.Checked = getUserResult["InEverybodyRole"]; } //show/hide elements UserInfo_div.Visible = true; } else { FailureText.Text = "There was an error getting the logged in users ID."; //hide unneeded elements. ErrorMessage.Visible = true; UserInfo_div.Visible = false; MyAccount_Start_div.Visible = false; } }
public void RunBeforeBeforeTestMethods() { hasher = new MockHasher(); userRepository = new MockUserRepository(); userManager = new UserManagement(hasher, userRepository); }
public UserController() { _um = new UserManagement(); }
public static Ice.DispatchStatus GetUserList___(UserManagement obj__, IceInternal.Incoming inS__, Ice.Current current__) { checkMode__(Ice.OperationMode.Idempotent, current__.mode); IceInternal.BasicStream is__ = inS__.istr(); is__.startReadEncaps(); int nBegin; nBegin = is__.readInt(); int nCount; nCount = is__.readInt(); int session; session = is__.readInt(); is__.endReadEncaps(); IceInternal.BasicStream os__ = inS__.ostr(); MCS.User[] ret__ = obj__.GetUserList(nBegin, nCount, session, current__); if(ret__ == null) { os__.writeSize(0); } else { os__.writeSize(ret__.Length); for(int ix__ = 0; ix__ < ret__.Length; ++ix__) { (ret__[ix__] == null ? new MCS.User() : ret__[ix__]).write__(os__); } } return Ice.DispatchStatus.DispatchOK; }
/// <summary> /// Add System Admin /// </summary> /// <param name="userName">User name</param> /// <param name="firstName">Full name of user</param> /// <param name="lastName">Last name of user</param> /// <param name="emailId">Email Id</param> /// <param name="password">Password</param> public static void AddSystemAdmin(string userName, string firstName, string lastName, string emailId, string password) { LogExtension.LogInfo("Creating system admin", MethodBase.GetCurrentMethod()); var encrypt = new Cryptography(); var umpUser = new User(); var userManagement = new UserManagement(GlobalAppSettings.QueryBuilder, GlobalAppSettings.DataProvider); var groupManagement = new GroupManagement(GlobalAppSettings.QueryBuilder, GlobalAppSettings.DataProvider); umpUser.Password = Convert.ToBase64String(encrypt.Encryption(password)); umpUser.CreatedDate = DateTime.UtcNow; umpUser.ModifiedDate = DateTime.UtcNow; umpUser.IsActive = true; umpUser.IsDeleted = false; umpUser.ResetPasswordCode = "default"; umpUser.ActivationCode = "default"; umpUser.UserName = userName; umpUser.FirstName = firstName.Trim(); umpUser.LastName = lastName.Trim(); umpUser.DisplayName = (umpUser.FirstName.Trim() + " " + umpUser.LastName.Trim()).Trim(); umpUser.Email = emailId; umpUser.IsActivated = true; var activationCode = String.Empty; var activationExpirationDate = new DateTime(); LogExtension.LogInfo("Adding user in user table", MethodBase.GetCurrentMethod()); var result = userManagement.AddUser(umpUser, out activationExpirationDate, out activationCode); if (result.Status) { LogExtension.LogInfo("Adding user in user table succesful", MethodBase.GetCurrentMethod()); LogExtension.LogInfo("Adding user in super admin group table", MethodBase.GetCurrentMethod()); var userGroup = groupManagement.AddUserInGroup(Convert.ToInt32(result.ReturnValue), 1); LogExtension.LogInfo("Is user added in super admin?" + userGroup, MethodBase.GetCurrentMethod()); //var permissionSet = new PermissionSet(); //permissionSet.AddPermissionToGroup(new Permission //{ // PermissionAccess = PermissionAccess.Create, // PermissionEntity = PermissionEntity.AllCategories, // TargetId = 1 //}); //permissionSet.AddPermissionToGroup(new Permission //{ // PermissionAccess = PermissionAccess.Create, // PermissionEntity = PermissionEntity.AllReports, // TargetId = 1 //}); //permissionSet.AddPermissionToGroup(new Permission //{ // PermissionAccess = PermissionAccess.Create, // PermissionEntity = PermissionEntity.AllSchedules, // TargetId = 1 //}); //permissionSet.AddPermissionToGroup(new Permission //{ // PermissionAccess = PermissionAccess.Create, // PermissionEntity = PermissionEntity.AllDataSources, // TargetId = 1 //}); //permissionSet.AddPermissionToGroup(new Permission //{ // PermissionAccess = PermissionAccess.Create, // PermissionEntity = PermissionEntity.AllFiles, // TargetId = 1 //}); } else { LogExtension.LogInfo("Error in adding user in user table", MethodBase.GetCurrentMethod()); } }
public static void InsertSampleReports() { try { //var itemManagement = new ItemManagement(); //var item = new Item(); var userManagement = new UserManagement(); var userDetail = userManagement.FindUserByUserId(1); var baseUrl = new UriBuilder(HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port).ToString(); var dataSourceId = Guid.Empty; //#region AddCategory //var category = new ItemDetail() //{ // Name = "Sample Reports", // Description = "Check our sample reports in this category", // CreatedById = userDetail.UserId, // CreatedDate = DateTime.UtcNow.ToString(GlobalAppSettings.GetDateTimeFormat()), // ItemType = ItemType.Category, // ModifiedById = userDetail.UserId, // ModifiedDate = DateTime.UtcNow.ToString(GlobalAppSettings.GetDateTimeFormat()) //}; //item.AddNewCategory(category); //#endregion //#region Add Data Sources //List<FileInfo> dataSourceList = // new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "\\SampleReports").GetFiles("*.rds").ToList(); //dataSourceList = dataSourceList.OrderByDescending(o => o.Name).ToList(); //foreach (var dataSource in dataSourceList) //{ // DataSourceDefinition dataSourceDefinition; // var xmlSerializer = new XmlSerializer(typeof(DataSourceDefinition)); // using (var reader = new StreamReader(dataSource.FullName)) // { // dataSourceDefinition = (DataSourceDefinition)xmlSerializer.Deserialize(reader); // reader.Close(); // } // var itemRequest = new ItemRequest // { // Description = "This is a sample data source.", // DataSourceDefinition = dataSourceDefinition, // ItemType = ItemType.Datasource, // Name = Path.GetFileNameWithoutExtension(dataSource.Name), // UserName = userDetail.UserName, // Password = userDetail.Password // }; // using (var webclient = new WebClient()) // { // var serializer = new DataContractJsonSerializer(typeof(ItemRequest)); // var memoryStream = new MemoryStream(); // serializer.WriteObject(memoryStream, itemRequest); // var data = Encoding.UTF8.GetString(memoryStream.ToArray(), 0, (int)memoryStream.Length); // webclient.Headers["Content-type"] = "application/json"; // webclient.Encoding = Encoding.UTF8; // var apiResult = webclient.UploadString(baseUrl.TrimEnd('/') + "/api/reportserverapi/add-data-source", "POST", data); // var itemResponse = JsonConvert.DeserializeObject<ItemResponse>(apiResult); // dataSourceId = itemResponse.PublishedItemId; // } //} //#endregion //#region AddReports //var temporaryDirectory = Path.Combine(GlobalAppSettings.GetItemsPath() + "Temporary_Files"); //if (Directory.Exists(temporaryDirectory) == false) //{ // Directory.CreateDirectory(temporaryDirectory); //} //List<FileInfo> reportList = // new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "\\SampleReports").GetFiles("*.rdl").ToList(); //reportList = reportList.OrderByDescending(o => o.Name).ToList(); //foreach (var report in reportList) //{ // var xmlDocument = new XmlDocument(); // xmlDocument.Load(report.FullName); // var dataSourceNodes = xmlDocument.GetElementsByTagName("DataSource"); // foreach (var dataSourceNode in dataSourceNodes) // { // var xmlLinkedNode = dataSourceNode as XmlLinkedNode; // foreach (var childNodes in xmlLinkedNode.ChildNodes) // { // var xmlChildLinkedNode = childNodes as XmlLinkedNode; // if (xmlChildLinkedNode.Name == "DataSourceReference") // { // xmlChildLinkedNode.InnerText = dataSourceId.ToString(); // } // } // } // var tempReportName = temporaryDirectory + "\\" + report.Name; // xmlDocument.Save(tempReportName); // var itemRequest = new ItemRequest // { // CategoryId = itemManagement.GetItemDetailsFromItemName(category.Name, ItemType.Category).Id, // DataSourceMappingInfo = new List<DataSourceMappingInfo> // { // new DataSourceMappingInfo // { // DataSourceId = dataSourceId, // Name = Path.GetFileNameWithoutExtension(dataSourceList.FirstOrDefault().Name) // } // }, // Description = "This is a sample report.", // ItemContent = File.ReadAllBytes(tempReportName), // ItemType = ItemType.Report, // Name = Path.GetFileNameWithoutExtension(tempReportName), // UserName = userDetail.UserName, // Password = userDetail.Password // }; // using (var webclient = new WebClient()) // { // var serializer = new DataContractJsonSerializer(typeof(ItemRequest)); // var memoryStream = new MemoryStream(); // serializer.WriteObject(memoryStream, itemRequest); // var data = Encoding.UTF8.GetString(memoryStream.ToArray(), 0, (int)memoryStream.Length); // webclient.Headers["Content-type"] = "application/json"; // webclient.Encoding = Encoding.UTF8; // var apiResult = webclient.UploadString(baseUrl.TrimEnd('/') + "/api/reportserverapi/add-report", "POST", data); // var itemResponse = JsonConvert.DeserializeObject<ItemResponse>(apiResult); // } //} //LogExtension.LogInfo("Sample reports has been added successfully.", MethodBase.GetCurrentMethod()); //#endregion } catch (Exception ex) { LogExtension.LogError("Error in adding sample reports.", ex, MethodBase.GetCurrentMethod()); } }
public async Task<ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new User { UserName = model.Username, Email = model.Email, LinkedInProfile = model.LinkedInProfile, FacebookAccount = model.FacebookAccount, Age = model.Age, FirstName = model.FirstName, LastName = model.LastName, Genre = model.Genre, AboutMe = model.AboutMe, CreatedOn = DateTime.Now, Status = Status.Pending, SkypeName = model.SkypeName, IsGroupManager = false, DateRegistered = DateTime.Now }; user.FacultyNumber = this.usersService.GetLastFacultyNumber() + 1; var result = await this.UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await this.SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); //// For more information on how to enable account confirmation and password reset please visit http:////go.microsoft.com/fwlink/?LinkID=320771 //// Send an email with this link //// string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); //// var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); //// await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); var userManegemnet = new UserManagement(this.Server); userManegemnet.EnsureFolder(user.Id); return this.RedirectToAction("Index", "Home"); } this.AddErrors(result); } //// If we got this far, something failed, redisplay form return this.View(model); }
public Channel(IRCBot bot, string channel) { this.bot = bot; this.channel = channel; this.manager = new UserManagement(this); }
public static Ice.DispatchStatus CreateUser___(UserManagement obj__, IceInternal.Incoming inS__, Ice.Current current__) { checkMode__(Ice.OperationMode.Idempotent, current__.mode); IceInternal.BasicStream is__ = inS__.istr(); is__.startReadEncaps(); string user; user = is__.readString(); string pass; pass = is__.readString(); int nRight; nRight = is__.readInt(); int session; session = is__.readInt(); is__.endReadEncaps(); IceInternal.BasicStream os__ = inS__.ostr(); int ret__ = obj__.CreateUser(user, pass, nRight, session, current__); os__.writeInt(ret__); return Ice.DispatchStatus.DispatchOK; }
private void Page_Load(object sender, EventArgs e) { ReadQueryString(); InitializeEvents(); this.CanEditSR = UserManagement.UserCanEdit(WTSModuleOption.SustainmentRequest); this.CanViewSR = this.CanEditSR || UserManagement.UserCanView(WTSModuleOption.SustainmentRequest); this.dtStatus = MasterData.StatusList_Get(includeArchive: false); this.dtStatus.DefaultView.RowFilter = "StatusType IN ('', 'SR')"; this.dtStatus = this.dtStatus.DefaultView.ToTable(); if (dtStatus != null && dtStatus.Rows.Count > 0) { dtStatus.Columns["Status"].ReadOnly = false; dtStatus.Rows[0]["Status"] = "-Select-"; } this.dtType = MasterData.SRTypeList_Get(includeArchive: false); if (dtType != null && dtType.Rows.Count > 0) { dtType.Columns["SRType"].ReadOnly = false; dtType.Rows[0]["SRType"] = "-Select-"; } this.dtPriority = MasterData.PriorityList_Get(includeArchive: false); this.dtSRRank = this.dtPriority; this.dtPriority.DefaultView.RowFilter = "PRIORITYTYPE IN ('', 'SR')"; this.dtPriority = this.dtPriority.DefaultView.ToTable(); if (dtPriority != null && dtPriority.Rows.Count > 0) { dtPriority.Columns["Priority"].ReadOnly = false; dtPriority.Rows[0]["Priority"] = "-Select-"; } this.dtSRRank.DefaultView.RowFilter = "PRIORITYTYPE IN ('', 'SR Rank')"; this.dtSRRank = this.dtSRRank.DefaultView.ToTable(); if (dtSRRank != null && dtSRRank.Rows.Count > 0) { dtSRRank.Columns["Priority"].ReadOnly = false; dtSRRank.Rows[0]["Priority"] = "-Select-"; } if (searchMode) { InitializeSearchModeDisplay(); } DataTable dt = LoadData(); if (dt != null) { this.DCC = dt.Columns; this.TotalCount = dt.Rows.Count; } if (_export && dt != null) { exportExcel(dt); } grdData.DataSource = dt; if (!Page.IsPostBack && this.GridPageIndex > 0 && this.GridPageIndex < ((decimal)dt.Rows.Count / (decimal)25)) { grdData.PageIndex = this.GridPageIndex; } grdData.DataBind(); }
public static Ice.DispatchStatus GetUserCount___(UserManagement obj__, IceInternal.Incoming inS__, Ice.Current current__) { checkMode__(Ice.OperationMode.Idempotent, current__.mode); IceInternal.BasicStream is__ = inS__.istr(); is__.startReadEncaps(); int session; session = is__.readInt(); is__.endReadEncaps(); IceInternal.BasicStream os__ = inS__.ostr(); int ret__ = obj__.GetUserCount(session, current__); os__.writeInt(ret__); return Ice.DispatchStatus.DispatchOK; }
private void loadQF_Assigned() { List <string> Assigned = new List <string>(); bool blnBacklog = false; if (SelectedAssigned != null && SelectedAssigned.Length > 0) { foreach (string s in SelectedAssigned) { if (s == "69") { blnBacklog = true; } Assigned.Add(s.Trim()); } } DataTable dtAssigned = UserManagement.LoadUserList(); // userNameSearch: userName Label lblAssigned = (Label)Page.Master.FindControl("lblms_Item1"); lblAssigned.Text = "Assigned To: "; lblAssigned.Style["width"] = "150px"; HtmlSelect ddlAssigned = (HtmlSelect)Page.Master.FindControl("ms_Item1"); if (dtAssigned != null) { ddlAssigned.Items.Clear(); ListItem item = null; int userID = UserManagement.GetUserId_FromUsername(); foreach (DataRow dr in dtAssigned.Rows) { if (dr["WTS_RESOURCEID"] == null || string.IsNullOrWhiteSpace(dr["WTS_RESOURCEID"].ToString())) { continue; } else { item = new ListItem(dr["UserName"].ToString(), dr["WTS_RESOURCEID"].ToString()); if (dr["RESOURCETYPE"].ToString() == "Not People") { item.Attributes.Add("OptionGroup", "Non-Resources"); item.Selected = false; } else { item.Attributes.Add("OptionGroup", "Resources"); } //Use default values otherwise set the values from the qryString if (ddlChanged == "no" && _myData) { item.Selected = true; ddlAssigned.Items.Add(item); } else { item.Selected = ((Assigned.Count == 0 && item.Text != "IT.Backlog") || Assigned.Contains(dr["WTS_RESOURCEID"].ToString())); ddlAssigned.Items.Add(item); } } } } }
protected void btnSignUp_Click(object sender, EventArgs e) { UserManagement _userManager = new UserManagement(); _userManager.AddUser(txtUserName.Text, txtMail.Text, txtPassword.Text, txtFirstName.Text, txtLastName.Text, txtCivilizationNumber.Text); }
public static string LoadExistingValues(string entityType, string idField, string columnName, string textField, string filterField, string existingValueFilter) { Dictionary <string, string> result = new Dictionary <string, string>() { { "loaded", "false" } , { "CurrentCount", "0" } , { "CurrentOptions", "" } , { "NewCount", "0" } , { "NewOptions", "" } , { "error", "" } }; bool loaded = false; int currentCount = 0, newCount = 0; string errorMsg = string.Empty; int AOR_ID = 0; DataTable dt = null, dtCurrentOptions = null, dtNewValues = null; try { switch (entityType.ToUpper()) { case "AOR": dt = AOR.AORList_Get(AORID: AOR_ID); break; case "CR": dt = AOR.AORCRList_Get(AORID: AOR_ID, AORReleaseID: 0, CRID: 0); break; case "PRIMARYTASK": dt = AOR.AORTaskList_Get(AORID: AOR_ID, AORReleaseID: 0); break; case "SUBTASK": dt = WorkloadItem.WorkItem_GetTaskList(workItemID: 0, showArchived: 0, showBacklog: false); break; } if (existingValueFilter.Length > 0) { dt.DefaultView.RowFilter = filterField + " IN (" + existingValueFilter + ")"; } if (entityType.ToUpper() == "AOR") { dt.DefaultView.RowFilter = "[Workload Allocation Archive] IN (False)"; } dtCurrentOptions = entityType.ToUpper() == "AOR" ? dt.DefaultView.ToTable(distinct: true, columnNames: new string[] { idField, columnName, "Workload Allocation Archive" }) : dt.DefaultView.ToTable(distinct: true, columnNames: new string[] { idField, columnName }); if (dtCurrentOptions != null) { dtCurrentOptions.Columns[idField].ColumnName = "valueField"; dtCurrentOptions.Columns[columnName].ColumnName = "textField"; } dtCurrentOptions.DefaultView.Sort = "textField"; dtCurrentOptions = dtCurrentOptions.DefaultView.ToTable(); currentCount = dtCurrentOptions.Rows.Count; try { switch (entityType.ToUpper()) { case "AOR": switch (columnName.ToUpper()) { case "CURRENT RELEASE": dtNewValues = MasterData.ProductVersionList_Get(includeArchive: false); if (dtNewValues != null) { dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["ProductVersionID"].ColumnName = "valueField"; dtNewValues.Columns["ProductVersion"].ColumnName = "textField"; } break; case "WORKLOAD ALLOCATION": dtNewValues = MasterData.WorkloadAllocationList_Get(includeArchive: 0); if (dtNewValues != null) { dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["WorkloadAllocationID"].ColumnName = "valueField"; dtNewValues.Columns["WorkloadAllocation"].ColumnName = "textField"; } break; default: dtNewValues = null; break; } break; case "CR": switch (columnName.ToUpper()) { case "CONTRACT": dtNewValues = MasterData.ContractList_Get(includeArchive: false); if (dtNewValues != null) { dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["ContractID"].ColumnName = "valueField"; dtNewValues.Columns["Contract"].ColumnName = "textField"; } break; case "STATUS": dtNewValues = MasterData.StatusList_Get(includeArchive: false); if (dtNewValues != null) { dtNewValues.DefaultView.RowFilter = "StatusType = 'AORCR'"; dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["StatusID"].ColumnName = "valueField"; dtNewValues.Columns["Status"].ColumnName = "textField"; } break; case "WEBSYSTEM": dtNewValues = MasterData.SystemList_Get(includeArchive: false); if (dtNewValues != null) { dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["WTS_SYSTEMID"].ColumnName = "valueField"; dtNewValues.Columns["WTS_SYSTEM"].ColumnName = "textField"; } break; default: dtNewValues = null; break; } break; case "PRIMARYTASK": switch (columnName.ToUpper()) { case "ASSIGNED TO": dtNewValues = UserManagement.LoadUserList(organizationId: 0, excludeDeveloper: false, loadArchived: false, userNameSearch: ""); if (dtNewValues != null) { dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["WTS_RESOURCEID"].ColumnName = "valueField"; dtNewValues.Columns["UserName"].ColumnName = "textField"; } break; case "PRIMARY RESOURCE": dtNewValues = UserManagement.LoadUserList(organizationId: 0, excludeDeveloper: false, loadArchived: false, userNameSearch: ""); if (dtNewValues != null) { dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["WTS_RESOURCEID"].ColumnName = "valueField"; dtNewValues.Columns["UserName"].ColumnName = "textField"; } break; case "PRIORITY": dtNewValues = MasterData.PriorityList_Get(includeArchive: false); if (dtNewValues != null) { dtNewValues.DefaultView.RowFilter = "PriorityType = 'Work Item'"; dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["PriorityID"].ColumnName = "valueField"; dtNewValues.Columns["Priority"].ColumnName = "textField"; } break; case "PRODUCTION STATUS": dtNewValues = MasterData.StatusList_Get(includeArchive: false); if (dtNewValues != null) { dtNewValues.DefaultView.RowFilter = "StatusType = 'Production'"; dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["StatusID"].ColumnName = "valueField"; dtNewValues.Columns["Status"].ColumnName = "textField"; } break; case "STATUS": dtNewValues = MasterData.StatusList_Get(includeArchive: false); if (dtNewValues != null) { dtNewValues.DefaultView.RowFilter = "StatusType = 'Work'"; dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["StatusID"].ColumnName = "valueField"; dtNewValues.Columns["Status"].ColumnName = "textField"; } break; case "PRODUCT VERSION": dtNewValues = MasterData.ProductVersionList_Get(includeArchive: false); if (dtNewValues != null) { dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["ProductVersionID"].ColumnName = "valueField"; dtNewValues.Columns["ProductVersion"].ColumnName = "textField"; } break; case "SYSTEM(TASK)": dtNewValues = MasterData.SystemList_Get(includeArchive: false); if (dtNewValues != null) { dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["WTS_SYSTEMID"].ColumnName = "valueField"; dtNewValues.Columns["WTS_SYSTEM"].ColumnName = "textField"; } break; //case "PERCENT COMPLETE": // dtNewValues = MasterData.ProductVersionList_Get(includeArchive: false); // if (dtNewValues != null) // { // dtNewValues = dtNewValues.DefaultView.ToTable(); // dtNewValues.Columns["ProductVersionID"].ColumnName = "valueField"; // dtNewValues.Columns["ProductVersion"].ColumnName = "textField"; // } //break; default: dtNewValues = null; break; } break; case "SUBTASK": switch (columnName.ToUpper()) { case "ASSIGNEDRESOURCE": dtNewValues = UserManagement.LoadUserList(organizationId: 0, excludeDeveloper: false, loadArchived: false, userNameSearch: ""); if (dtNewValues != null) { dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["WTS_RESOURCEID"].ColumnName = "valueField"; dtNewValues.Columns["UserName"].ColumnName = "textField"; } break; case "PRIMARY RESOURCE": dtNewValues = UserManagement.LoadUserList(organizationId: 0, excludeDeveloper: false, loadArchived: false, userNameSearch: ""); if (dtNewValues != null) { dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["WTS_RESOURCEID"].ColumnName = "valueField"; dtNewValues.Columns["UserName"].ColumnName = "textField"; } break; case "PRIORITY": dtNewValues = MasterData.PriorityList_Get(includeArchive: false); if (dtNewValues != null) { dtNewValues.DefaultView.RowFilter = "PriorityType = 'Work Item'"; dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["PriorityID"].ColumnName = "valueField"; dtNewValues.Columns["Priority"].ColumnName = "textField"; } break; case "PRODUCTION STATUS": dtNewValues = MasterData.StatusList_Get(includeArchive: false); if (dtNewValues != null) { dtNewValues.DefaultView.RowFilter = "StatusType = 'Production'"; dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["StatusID"].ColumnName = "valueField"; dtNewValues.Columns["Status"].ColumnName = "textField"; } break; case "STATUS": dtNewValues = MasterData.StatusList_Get(includeArchive: false); if (dtNewValues != null) { dtNewValues.DefaultView.RowFilter = "StatusType = 'Work'"; dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["StatusID"].ColumnName = "valueField"; dtNewValues.Columns["Status"].ColumnName = "textField"; } break; case "PRODUCT VERSION": dtNewValues = MasterData.ProductVersionList_Get(includeArchive: false); if (dtNewValues != null) { dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["ProductVersionID"].ColumnName = "valueField"; dtNewValues.Columns["ProductVersion"].ColumnName = "textField"; } break; case "SYSTEM(TASK)": dtNewValues = MasterData.SystemList_Get(includeArchive: false); if (dtNewValues != null) { dtNewValues = dtNewValues.DefaultView.ToTable(); dtNewValues.Columns["WTS_SYSTEMID"].ColumnName = "valueField"; dtNewValues.Columns["WTS_SYSTEM"].ColumnName = "textField"; } break; //case "PERCENT COMPLETE": // dtNewValues = MasterData.ProductVersionList_Get(includeArchive: false); // if (dtNewValues != null) // { // dtNewValues = dtNewValues.DefaultView.ToTable(); // dtNewValues.Columns["ProductVersionID"].ColumnName = "valueField"; // dtNewValues.Columns["ProductVersion"].ColumnName = "textField"; // } //break; default: dtNewValues = null; break; } break; } } catch (Exception ex) { LogUtility.LogException(ex); dtNewValues = null; } if (dtNewValues != null && dtNewValues.Rows.Count > 0) { dtNewValues.DefaultView.Sort = "textField"; dtNewValues = dtNewValues.DefaultView.ToTable(distinct: true, columnNames: new string[] { "valueField", "textField" }); if (dtNewValues != null) { newCount = dtNewValues.Rows.Count; } } loaded = true; } catch (Exception ex) { LogUtility.LogException(ex); loaded = false; currentCount = 0; errorMsg = ex.Message; } result["loaded"] = loaded.ToString(); result["CurrentCount"] = currentCount.ToString(); result["NewCount"] = newCount.ToString(); result["error"] = errorMsg; if (dtCurrentOptions != null) { result["CurrentOptions"] = JsonConvert.SerializeObject(dtCurrentOptions, Formatting.None); } if (dtCurrentOptions != null) { result["NewOptions"] = JsonConvert.SerializeObject(dtNewValues, Formatting.None); } return(JsonConvert.SerializeObject(result, Formatting.None)); }
//Constructor public StdServerArchitecture(string name) : base(name) { UserManagement = new UserManagement(); }
/// <summary> /// /// </summary> /// <param name="mainFrame"></param> /// <param name="configProxy"></param> /// <param name="keyProxy"></param> /// <param name="userProxy"></param> /// <param name="logProxy"></param> /// <param name="ssProxy"></param> /// <param name="hqProxy"></param> /// <param name="stockProxy"></param> public MainWindowViewModel(Frame mainFrame, IConfigProxy configProxy, IKeyProxy keyProxy, IUserProxy userProxy, ILogProxy logProxy, ISubsidiaryProxy ssProxy, IHeadQuarterProxy hqProxy, IKeyTypeConfigurationProxy stockProxy) { this.configProxy = configProxy ?? new ConfigProxy(KmtConstants.LoginUser); this.keyProxy = keyProxy ?? new KeyProxy(KmtConstants.LoginUser, KmtConstants.HeadQuarterId); this.userProxy = userProxy ?? new UserProxy(); this.logProxy = logProxy ?? new LogProxy(); this.ssProxy = ssProxy ?? new SubsidiaryProxy(); this.hqProxy = hqProxy ?? new HeadQuarterProxy(); this.stockProxy = stockProxy ?? new KeyTypeConfigurationProxy(); this.mainFrame = mainFrame; keyManagement = new KeyManagement(this, this.keyProxy, this.configProxy, this.ssProxy, this.hqProxy); userManagement = new UserManagement(this, this.userProxy); logViewer = new ViewLogs(this, this.logProxy); InitializeNotificationSystem(); RibbonTabIndex = KeyPageIndex; InitializeRoles(); LogTypes.Add(MergedResources.Common_SystemLog); LogTypes.Add(MergedResources.Common_OperationLog); OnCurrentUserRoleChanged(); OnAutoReportChanged(null, null); }