public override void FormLoad() { try { ICollection <AbstractSearch> searchCriteria = new List <AbstractSearch>(); AddCustomSearchCriterias(searchCriteria); if (string.IsNullOrEmpty(this.GridViewSortExpression) || this.GridViewSortExpression == Constants.INVALID_ID_STRING) { this.GridViewSortExpression = "FirstName"; } this.gvPerson.DataSource = AdminClientRef.GetAllPersons(searchCriteria, GridViewSortExpression, GridViewSortDirection); if (NewPageIndex.HasValue) { this.gvPerson.PageIndex = NewPageIndex.Value; } this.gvPerson.DataBind(); } catch (Exception ex) { BaseHelper.Log("Грешка в FormLoad " + formResource.PagePath); BaseHelper.Log(ex.Message); BaseHelper.Log(ex.StackTrace); } }
protected void btnLogin_Click(object sender, EventArgs e) { this.lbError.Text = string.Empty; RequestMeasure requestMeasure = new RequestMeasure("btnLogin_Click"); CallContext resultContext = AdminClientRef.Login(this.tbxUserName.Text, this.tbxPassword.Text); LogDebug(requestMeasure.ToString()); if (resultContext.ResultCode == ETEMEnums.ResultEnum.Success) { this.userProps = new UserProps(); ETEMModel.Models.User currentUser = AdminClientRef.GetUserByUserID(resultContext.EntityID); if (currentUser != null) { this.userProps = MakeLoginByUserID(resultContext.EntityID); LogDebug("Потребител " + this.userProps.UserName + " влезе в системата"); Response.Redirect(Welcome.formResource.PagePath); } else { this.lbError.Text = ETEMModel.Helpers.BaseHelper.GetCaptionString("Съществува проблем с базата данни"); } } else { this.lbError.Text = resultContext.Message; } }
public override void FormLoad() { try { CheckUserActionPermission(ETEMEnums.SecuritySettings.ShowModuleList, true); base.FormLoad(); ICollection <AbstractSearch> searchCriteria = new List <AbstractSearch>(); this.gvModule.DataSource = AdminClientRef.GetAllModule(searchCriteria, GridViewSortExpression, GridViewSortDirection); if (NewPageIndex.HasValue) { this.gvModule.PageIndex = NewPageIndex.Value; } this.gvModule.DataBind(); } catch (Exception ex) { BaseHelper.Log("Грешка в FormLoad " + formResource.PagePath); BaseHelper.Log(ex.Message); BaseHelper.Log(ex.StackTrace); } }
public UserProps MakeLoginByUserID(string UserID) { UserProps userProps = new UserProps(); ETEMModel.Models.User currentUser = AdminClientRef.GetUserByUserID(UserID); if (currentUser != null) { userProps.Roles = AdminClientRef.GetAllRolesByUser(currentUser.idUser.ToString(), null, null); for (int i = 0; i < userProps.Roles.Count; i++) { List <int> currentRolePermmitedActionsIds = AdminClientRef. GetAllPermittedActionsByRole(userProps.Roles[i].idRole.ToString(), null, null) .Select(r => r.idPermittedAction).ToList(); for (int j = 0; j < currentRolePermmitedActionsIds.Count; j++) { bool isDuplicate = userProps.ListUserPermittedActionsID.Any(p => p == currentRolePermmitedActionsIds[j]); if (!isDuplicate) { userProps.ListUserPermittedActionsID.Add(currentRolePermmitedActionsIds[j]); } } } //userProps.ListUserPermittedActionsID = AdminClientRef.getallp userProps.IdUser = currentUser.idUser.ToString(); userProps.UserName = currentUser.UserName; Person person = this.AdminClientRef.GetPersonByPersonID(currentUser.idPerson.ToString()); userProps.PersonNamePlusTitle = person.FullNamePlusTitle; userProps.PersonNameNoTitle = person.FullName; userProps.PersonNameAndFamily = person.FullNameTwo; userProps.PersonTwoNamePlusTitle = person.TwoNamesPlusTitle; userProps.PersonID = person.idPerson.ToString(); userProps.SessionID = this.Session.SessionID; userProps.IPAddress = Request.UserHostAddress; userProps.LoginDateTime = DateTime.Now; this.Session.Timeout = Convert.ToInt32(BasicPage.GetValueFromWebConfig("SessionTimeOut")); userProps.idStudent = Constants.INVALID_ID; userProps.IsCheckDomain = currentUser.idCheckDomain == GetKeyValueByIntCode("YES_NO", "Yes").idKeyValue; userProps.IsKilled = false; this.Session.Add(ETEMModel.Helpers.Constants.SESSION_USER_PROPERTIES, userProps); this.Session.Timeout = Int32.Parse(GetSettingByCode(ETEMEnums.AppSettings.WebSessionTimeOut).SettingValue); Dictionary <string, HttpSessionState> sessionData = (Dictionary <string, HttpSessionState>)Application[Constants.APPLICATION_ALL_SESSIONS]; if (sessionData.Keys.Contains(HttpContext.Current.Session.SessionID)) { sessionData.Remove(HttpContext.Current.Session.SessionID); sessionData.Add(HttpContext.Current.Session.SessionID, HttpContext.Current.Session); } } return(userProps); }
private void BindSettingsGrid(List <AbstractSearch> searchCriterias) { this.gvSetting.DataSource = AdminClientRef.GetAllSettings(this.GridViewSortExpression, this.GridViewSortDirection, searchCriterias); if (NewPageIndex.HasValue) { this.gvSetting.PageIndex = NewPageIndex.Value; } this.gvSetting.DataBind(); }
protected void btnSendNewPasswordMail_OnClick(object sender, EventArgs e) { #region Basic checkings if (this.tbxForgottenUsername.Text == "") { AddErrorMessage(lbResultContext, "Полето 'Потребителско име' е задължително"); return; } if (this.tbxForgottenEGN.Text == "") { AddErrorMessage(lbResultContext, "Полето 'ЕГН/ЛНЧ/ИДН' е задължително"); return; } if (this.tbxForgottenEmail.Text == "") { AddErrorMessage(lbResultContext, "Полето 'Email' е задължително"); return; } #endregion #region dbChecks ETEMModel.Models.User user = AdminClientRef.GetUserByUsername(this.tbxForgottenUsername.Text); if (user == null) { AddErrorMessage(lbResultContext, "Не съществува потребител с това потребителско име"); return; } Person person = AdminClientRef.GetPersonByPersonID(user.idPerson.ToString()); string egn = GetEgnOrIdnOrLnch(person); if (egn != this.tbxForgottenEGN.Text) { AddErrorMessage(lbResultContext, "Данните в полето 'ЕГН/ЛНЧ/ИДН' не съвпадат с тези от потребителя"); return; } if (person.EMail != this.tbxForgottenEmail.Text) { AddErrorMessage(lbResultContext, "Данните в полето 'Email' не съвпадат с тези от потребителя"); return; } #endregion CallContext = AdminClientRef.ChangeUserForgottenPasswordPassword(user, person, CallContext); CheckIfResultIsSuccess(lbResultContext); this.lbResultContext.Text = CallContext.Message; }
protected void btnSave_Click(object sender, EventArgs e) { string idPerson = this.FormContext.QueryString["idResource"].ToString(); foreach (GridViewRow row in this.gvUploadedFiles.Rows) { if (row.RowType == DataControlRowType.DataRow) { //ID на прикачени файл HiddenField hdnRowMasterKey = row.FindControl("hdnIdUploadedFile") as HiddenField; //radio button RadioButton rbtn = row.FindControl("rbtnSelectedFile") as RadioButton; //описание за всеки прикачен файл TextBox tbxDescription = row.Cells[0].FindControl("tbxDescription") as TextBox; string descr = tbxDescription.Text; //Update на всички редове като записваме само описанието this.currentEntity = CommonClientRef.GetUploadFileByID(hdnRowMasterKey.Value); currentEntity.Description = descr; CallContext resultContext = new CallContext(); resultContext.CurrentConsumerID = this.UserProps.IdUser; resultContext = CommonClientRef.UploadedFileSave(currentEntity, resultContext); //update на снимката на потребителя if (rbtn.Checked) { this.personEntity = this.AdminClientRef.GetPersonByPersonID(idPerson); if (this.personEntity != null) { this.personEntity.ImagePath = this.currentEntity.FilePath.Replace("\\", "/").Replace("C:", string.Empty); CallContext resultPersontContext = new CallContext(); resultPersontContext.CurrentConsumerID = this.UserProps.IdUser; resultPersontContext = AdminClientRef.PersonSave(this.personEntity, resultPersontContext); } //refresh Parent form string script = "this.window.opener.location=this.window.opener.location;"; if (!ClientScript.IsClientScriptBlockRegistered("REFRESH_PARENT")) { ClientScript.RegisterClientScriptBlock(typeof(string), "REFRESH_PARENT", script, true); } } } } }
public void LoadPersonsList() { try { ICollection <AbstractSearch> searchCriteria = new List <AbstractSearch>(); AddCustomSearchCriterias(searchCriteria); List <PersonDataView> list = AdminClientRef.GetAllPersons(searchCriteria, GridViewSortExpression, GridViewSortDirection); LoadSearchResult(list); } catch (Exception ex) { BaseHelper.Log("Грешка в LoadPersonsList " + formResource.PagePath); BaseHelper.Log(ex.Message); BaseHelper.Log(ex.StackTrace); } }
public override void FormLoad() { try { CheckUserActionPermission(ETEMEnums.SecuritySettings.RoleShowList, true); this.gvRole.DataSource = AdminClientRef.GetAllRoles(GridViewSortExpression, GridViewSortDirection); if (NewPageIndex.HasValue) { this.gvRole.PageIndex = NewPageIndex.Value; } this.gvRole.DataBind(); } catch (Exception ex) { BaseHelper.Log("Грешка в FormLoad " + formResource.PagePath); BaseHelper.Log(ex.Message); BaseHelper.Log(ex.StackTrace); } }
protected void btnSearch_Click(object sender, EventArgs e) { try { ICollection <AbstractSearch> searchCriteria = new List <AbstractSearch>(); AddCustomSearchCriterias(searchCriteria); List <PersonDataView> list = AdminClientRef.GetAllPersons(searchCriteria, GridViewSortExpression, GridViewSortDirection); LoadSearchResult(list); this.pnlFilterData.Visible = false; } catch (Exception ex) { BaseHelper.Log("Грешка в btnSearch_Click " + formResource.PagePath); BaseHelper.Log(ex.Message); BaseHelper.Log(ex.StackTrace); } }
public override void FormLoad() { try { ICollection <AbstractSearch> searchCriteria = new List <AbstractSearch>(); AddCustomSearchCriterias(searchCriteria); this.gvPermittedAction.DataSource = AdminClientRef.GetAllPermittedActions(searchCriteria, GridViewSortExpression, GridViewSortDirection); if (NewPageIndex.HasValue) { this.gvPermittedAction.PageIndex = NewPageIndex.Value; } this.gvPermittedAction.DataBind(); } catch (Exception ex) { BaseHelper.Log("Грешка в FormLoad " + formResource.PagePath); BaseHelper.Log(ex.Message); BaseHelper.Log(ex.StackTrace); } }
public override void AlphabetClick(string alpha) { try { if (alpha == Constants.ALL_CHARACTERS) { List <AbstractSearch> searchCriteria = new List <AbstractSearch>(); List <PersonDataView> list = AdminClientRef.GetAllPersons(searchCriteria, GridViewSortExpression, GridViewSortDirection); ClearFilterForm(); LoadSearchResult(list); } else { ICollection <AbstractSearch> searchCriteria = new List <AbstractSearch>(); AddCustomSearchCriterias(searchCriteria); searchCriteria.Add(new TextSearch { Comparator = TextComparators.StartsWith, Property = "FirstName", SearchTerm = alpha }); List <PersonDataView> list = AdminClientRef.GetAllPersons(searchCriteria, GridViewSortExpression, GridViewSortDirection); LoadSearchResult(list); } } catch (Exception ex) { BaseHelper.Log("Грешка в AlphabetClick " + formResource.PagePath); BaseHelper.Log(ex.Message); BaseHelper.Log(ex.StackTrace); } }
protected void btnUpload_Click(object sender, EventArgs e) { //update на снимката на потребителя if (!string.IsNullOrEmpty(this.hdnRowMasterKey.Value) && this.hdnRowMasterKey.Value != Constants.INVALID_ID_STRING) { string idPerson = this.hdnRowMasterKey.Value; this.currentEntity = this.ownerPage.AdminClientRef.GetPersonByPersonID(idPerson); //създава и отваря ресурсна папка с име - idPerson_PersonName string folderName = this.hdnRowMasterKey.Value + "_" + BaseHelper.ConvertCyrToLatin(this.currentEntity.FirstName.Trim()); string resourcesFolderName = GeneralPage.GetSettingByCode(ETEMEnums.AppSettings.ResourcesFolderName).SettingValue + @"\Person\"; //ID с което започва папката за импорт. Пример C:\Resources_UMS_Person\198_Kiril string idStartFolder = folderName.Split('_')[0].ToString(); DirectoryInfo folder = new DirectoryInfo(resourcesFolderName);// + folderName); //Винаги изтриваме целевата папка за да не се пълни с всяка следваща снимка if (folder.Exists) { DirectoryInfo[] directories = folder.GetDirectories(); foreach (var file in directories) { if (file.Name.StartsWith(idStartFolder + "_")) { FileInfo[] filesToDelete = file.GetFiles(); foreach (var delFile in filesToDelete) { File.Delete(delFile.FullName); } //Directory.Delete(file.FullName); break; } } } //и отново създаваме потребителската директория folder = new DirectoryInfo(resourcesFolderName + folderName); if (!folder.Exists) { folder = Directory.CreateDirectory(resourcesFolderName + folderName); } //ако сме избрали нещо if (!string.IsNullOrEmpty(FileUpload1.FileName)) { //записваме картинката в папката string pathToSave = (folder.FullName.EndsWith("\\") ? folder.FullName : folder.FullName + "\\") + FileUpload1.FileName; FileUpload1.SaveAs(pathToSave); //update Person if (this.currentEntity != null) { this.currentEntity.ImagePath = GeneralPage.GetSettingByCode(ETEMEnums.AppSettings.WebResourcesFolderName).SettingValue + "/Person/" + folderName + "/" + FileUpload1.FileName; CallContext resultPersontContext = new CallContext(); resultPersontContext.CurrentConsumerID = idPerson; resultPersontContext = AdminClientRef.PersonSave(this.currentEntity, resultPersontContext); } } this.CurrentEntityMasterID = idPerson; } this.pnlAddPersonImage.Visible = false; }