protected void btnМакеHistory_Click(object sender, EventArgs e) { if (!this.ownerPage.CheckUserActionPermission(ETEMEnums.SecuritySettings.PersonSave, false)) { return; } PersonHistory newPersonHistory = new PersonHistory(); this.currentEntity = this.ownerPage.AdminClientRef.GetPersonByPersonID(this.MasterKeyID); newPersonHistory.idPerson = currentEntity.idPerson; newPersonHistory.FirstName = currentEntity.FirstName; newPersonHistory.SecondName = currentEntity.SecondName; newPersonHistory.LastName = currentEntity.LastName; newPersonHistory.IdentityNumber = currentEntity.IDCard; newPersonHistory.IdentityNumberDate = currentEntity.IdentityNumberDate; newPersonHistory.IdentityNumberIssueBy = currentEntity.IdentityNumberIssueBy; newPersonHistory.idCreateUser = Int32.Parse(this.ownerPage.UserProps.IdUser); newPersonHistory.idModifyUser = Int32.Parse(this.ownerPage.UserProps.IdUser); newPersonHistory.CreationDate = DateTime.Now; newPersonHistory.ModifyDate = DateTime.Now; this.ownerPage.CallContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser; this.ownerPage.AdminClientRef.PersonHistorySave(newPersonHistory, this.ownerPage.CallContext); LoadPersonHistory(); }
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 override void UserControlLoad() { if (this.ownerPage == null) { throw new UMSException("Current Page is null or is not inheritor of BasicPage."); } this.currentEntity = this.ownerPage.AdminClientRef.GetPersonByPersonID(this.CurrentEntityMasterID); this.ucPersonalData.CurrentEntityMasterID = this.CurrentEntityMasterID; this.ucPersonalData.SetHdnField(this.CurrentEntityMasterID); this.ucPersonalData.UserControlLoad(); this.pnlFormData.Visible = true; }
private string GetEgnOrIdnOrLnch(Person person) { if (!string.IsNullOrEmpty(person.EGN)) { return person.EGN; } else if (!string.IsNullOrEmpty(person.IdentityNumber)) { return person.IdentityNumber; } else if (!string.IsNullOrEmpty(person.IDN)) { return person.IDN; } return ""; }
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; }
public override Tuple <CallContext, string> UserControlSave() { bool isNewEntity = true; if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value) || this.hdnRowMasterKey.Value == Constants.INVALID_ID_STRING) { this.currentEntity = new Person(); } else { this.currentEntity = this.ownerPage.AdminClientRef.GetPersonByPersonID(this.hdnRowMasterKey.Value); if (this.currentEntity == null) { this.lbResultContext.Text = String.Format(BaseHelper.GetCaptionString("Entity_Person_Not_Found_By_ID"), this.hdnRowMasterKey.Value); string falseResult = String.Format(BaseHelper.GetCaptionString("Entity_is_not_update_in_tab"), BaseHelper.GetCaptionString("Personal_Data")); this.ownerPage.CallContext.ResultCode = ETEMEnums.ResultEnum.Error; this.ownerPage.CallContext.Message = falseResult; return(new Tuple <CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("Personal_Data"))); } isNewEntity = false; } currentEntity.IdentityNumber = this.tbxIdentityNumber.Text; currentEntity.FirstName = this.tbxFirstName.Text; currentEntity.SecondName = this.tbxSecondName.Text; currentEntity.LastName = this.tbxLastName.Text; currentEntity.idSex = this.dllSex.SelectedValueINT; DateTime?tmpBirthDate = null; if (this.tbxBirthDate.TextAsDateParseExact.HasValue) { tmpBirthDate = this.tbxBirthDate.TextAsDateParseExact; } else if (!string.IsNullOrEmpty(this.tbxEGN.Text)) { try { string firstPartEGN = this.tbxEGN.Text.Substring(0, 6); int year = int.Parse(firstPartEGN.Substring(0, 2)); int month = int.Parse(firstPartEGN.Substring(2, 2)); int day = int.Parse(firstPartEGN.Substring(4, 2)); if (month > 40) { month = month - 40; year = year + 2000; } else { year = year + 1900; } tmpBirthDate = new DateTime( year, month, day ); this.tbxBirthDate.Text = tmpBirthDate.Value.ToString("dd.MM.yyyy"); } catch { } } currentEntity.BirthDate = tmpBirthDate; currentEntity.EMail = this.tbxEMail.Text; currentEntity.MobilePhone = this.tbxMobilePhone.Text; currentEntity.Phone = this.tbxPhone.Text; currentEntity.EGN = this.tbxEGN.Text; currentEntity.IDN = this.tbxIDN.Text; currentEntity.IdentityNumber = this.tbxIdentityNumber.Text; currentEntity.Title = this.tbxTitle.Text; this.ownerPage.CallContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser; this.ownerPage.CallContext = this.ownerPage.AdminClientRef.PersonSave(currentEntity, this.ownerPage.CallContext); if (this.ownerPage.CallContext.ResultCode == ETEMEnums.ResultEnum.Success) { this.lbResultContext.Text = this.ownerPage.CallContext.Message; this.hdnRowMasterKey.Value = this.ownerPage.CallContext.EntityID; CheckIfResultIsSuccess(lbResultContext); this.PersonInfo = this.currentEntity.FullName; if (!string.IsNullOrEmpty(PersonUsedFor)) { if (PersonUsedFor == ETEMEnums.PersonTypeEnum.Employe.ToString()) { if (isNewEntity) { Employe newEmploye = new Employe(); newEmploye.idPerson = Convert.ToInt32(this.ownerPage.CallContext.EntityID); CallContext callContext = new CallContext(); callContext = this.ownerPage.EmployeClientRef.EmployeSave(newEmploye, callContext); if (callContext.ResultCode == ETEMEnums.ResultEnum.Success) { this.DetailsKeyID = callContext.EntityID; } else { this.DetailsKeyID = Constants.INVALID_ID_STRING; } } } } } this.pnlDivSearchStudent.Visible = false; if (string.IsNullOrWhiteSpace(this.PersonUsedFor)) { this.ownerPage.FormLoad(); } return(new Tuple <CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("Personal_Data"))); }
public override void UserControlLoad() { SetEmptyValues(); if (NoLoadUserPanel == Constants.TRUE_VALUE_TEXT) { this.pnlDivSearchStudent.Visible = false; } if (this.ownerPage == null) { throw new UMSException("Current Page is null or is not inheritor of BasicPage."); } loadInitControls(); this.currentEntity = this.ownerPage.AdminClientRef.GetPersonByPersonID(this.CurrentEntityMasterID); if (currentEntity != null) { this.pnlDivSearchStudent.Visible = false; this.tbxIdentityNumber.Text = currentEntity.IdentityNumber; this.tbxFirstName.Text = currentEntity.FirstName; this.tbxSecondName.Text = currentEntity.SecondName; this.tbxLastName.Text = currentEntity.LastName; this.dllSex.SelectedValue = currentEntity.idSex.ToString(); this.tbxBirthDate.SetTxbDateTimeValue(currentEntity.BirthDate); this.tbxEMail.Text = currentEntity.EMail; this.tbxMobilePhone.Text = currentEntity.MobilePhone; this.tbxPhone.Text = currentEntity.Phone; this.tbxEGN.Text = currentEntity.EGN; this.tbxIDN.Text = currentEntity.IDN; this.tbxIdentityNumber.Text = currentEntity.IdentityNumber; this.tbxTitle.Text = currentEntity.Title; this.hdnRowMasterKey.Value = currentEntity.idPerson.ToString(); ClearResultContext(this.lbResultContext); this.lbResultContext.Attributes.Remove("class"); if (!string.IsNullOrEmpty(currentEntity.ImagePath)) { this.imgBtnPerson.ImageUrl = currentEntity.ImagePath; } else { this.imgBtnPerson.ImageUrl = @"~/Images/person-clip-art-2.png"; } this.PersonInfo = this.currentEntity.FullName; LoadPersonHistory(); } else { LoadDdlLoadStudentInfoBy(); if (this.PersonUsedFor == ETEMEnums.PersonTypeEnum.Student.ToString()) { this.ucTextForSearchStudent.CustomCase = "StudentAndCandidateByName"; this.ucTextForSearchStudent.AdditionalWhereParam = (this.IdAcademicPeriod != Constants.INVALID_ID ? "idAcademicPeriod=" + this.IdAcademicPeriod : string.Empty); } else if (this.PersonUsedFor == ETEMEnums.PersonTypeEnum.StudentCandidate.ToString()) { this.ucTextForSearchStudent.CustomCase = "PreparationANDStudentAndCandidateByName"; } else if (this.PersonUsedFor == ETEMEnums.PersonTypeEnum.ArtModel.ToString()) { this.ucTextForSearchStudent.CustomCase = "PersonALLByName"; } else if (this.PersonUsedFor == ETEMEnums.PersonTypeEnum.PhD.ToString()) { this.ucTextForSearchStudent.CustomCase = "PersonsAllTypes"; } else { this.ucTextForSearchStudent.CustomCase = "PersonALLByName"; } this.ucTextForSearchStudent.Text = string.Empty; this.ucTextForSearchStudent.UserControlLoad(); SetEmptyValues(); this.gvPersonHistory.DataSource = null; this.gvPersonHistory.DataBind(); } }
public override Tuple<CallContext, string> UserControlSave() { bool isNewEntity = true; if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value) || this.hdnRowMasterKey.Value == Constants.INVALID_ID_STRING) { this.currentEntity = new Person(); } else { this.currentEntity = this.ownerPage.AdminClientRef.GetPersonByPersonID(this.hdnRowMasterKey.Value); if (this.currentEntity == null) { this.lbResultContext.Text = String.Format(BaseHelper.GetCaptionString("Entity_Person_Not_Found_By_ID"), this.hdnRowMasterKey.Value); string falseResult = String.Format(BaseHelper.GetCaptionString("Entity_is_not_update_in_tab"), BaseHelper.GetCaptionString("Personal_Data")); this.ownerPage.CallContext.ResultCode = ETEMEnums.ResultEnum.Error; this.ownerPage.CallContext.Message = falseResult; return new Tuple<CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("Personal_Data")); } isNewEntity = false; } currentEntity.IdentityNumber = this.tbxIdentityNumber.Text; currentEntity.FirstName = this.tbxFirstName.Text; currentEntity.SecondName = this.tbxSecondName.Text; currentEntity.LastName = this.tbxLastName.Text; currentEntity.FirstNameEN = this.tbxFirstNameEN.Text; currentEntity.SecondNameEN = this.tbxSecondNameEN.Text; currentEntity.LastNameEN = this.tbxLastNameEN.Text; currentEntity.idSex = this.dllSex.SelectedValueINT; currentEntity.idCitizenship = this.ddlCitizenship.SelectedValueINT; currentEntity.idSecondCitizenship = this.ddlSecondCitizenship.SelectedValueINT; currentEntity.idPermanentAdressCountry = this.ddlCitizenshipPermanentAdress.SelectedValueINT; currentEntity.idPermanentAdressMunicipality = this.ddlMunicipalityPermanentAdress.SelectedValueINT; currentEntity.idPermanentAdressCity = this.ucAutoCompleteLocationPermanentAdress.SelectedValueINT; //currentEntity.idLocation = ; currentEntity.idPlaceOfBirthCountry = this.ddlCitizenshipPlaceOfBirth.SelectedValueINT; currentEntity.idPlaceOfBirthMunicipality = this.ddlMunicipalityPlaceOfBirth.SelectedValueINT; currentEntity.idPlaceOfBirthCity = this.ucAutoCompleteLocationPlaceOfBirth.SelectedValueINT; currentEntity.idCorespondationCountry = (this.ddlCitizenshipCorespondention.SelectedValueINT != Constants.INVALID_ID) ? this.ddlCitizenshipCorespondention.SelectedValueINT : this.ddlCitizenshipPermanentAdress.SelectedValueINT; currentEntity.idCorespondationMunicipality = (this.ddlMunicipalityCorespondation.SelectedValueINT != Constants.INVALID_ID) ? this.ddlMunicipalityCorespondation.SelectedValueINT : this.ddlMunicipalityPermanentAdress.SelectedValueINT; currentEntity.idCorespondationCity = (this.ucAutoCompleteLocationCoreposndation.SelectedValueINT != null) ? this.ucAutoCompleteLocationCoreposndation.SelectedValueINT : this.ucAutoCompleteLocationPermanentAdress.SelectedValueINT; if (this.currentEntity.idCorespondationCountry.HasValue) { SelectEKATEsData(this.ddlCitizenshipCorespondention, this.ddlMunicipalityCorespondation, this.currentEntity.idCorespondationCountry.ToString(), this.currentEntity.idCorespondationMunicipality, this.ucAutoCompleteLocationCoreposndation, this.currentEntity.idCorespondationCity); } currentEntity.Address = this.tbxPermanentAddressAddition.Text; currentEntity.CorespondationAddress = (!string.IsNullOrEmpty(this.tbxCorespondationAddress.Text)) ? this.tbxCorespondationAddress.Text : this.tbxPermanentAddressAddition.Text; this.tbxCorespondationAddress.Text = currentEntity.CorespondationAddress; DateTime? tmpBirthDate = null; if (this.tbxBirthDate.TextAsDateParseExact.HasValue) { tmpBirthDate = this.tbxBirthDate.TextAsDateParseExact; } else if (!string.IsNullOrEmpty(this.tbxEGN.Text)) { try { string firstPartEGN = this.tbxEGN.Text.Substring(0, 6); int year = int.Parse(firstPartEGN.Substring(0, 2)); int month = int.Parse(firstPartEGN.Substring(2, 2)); int day = int.Parse(firstPartEGN.Substring(4, 2)); if (month > 40) { month = month - 40; year = year + 2000; } else { year = year + 1900; } tmpBirthDate = new DateTime( year, month, day ); this.tbxBirthDate.Text = tmpBirthDate.Value.ToString("dd.MM.yyyy"); } catch { } } currentEntity.BirthDate = tmpBirthDate; currentEntity.EMail = this.tbxEMail.Text; currentEntity.MobilePhone = this.tbxMobilePhone.Text; currentEntity.Phone = this.tbxPhone.Text; currentEntity.EGN = this.tbxEGN.Text; currentEntity.ForeignerIdentityNumber = this.tbxForeignerIdentityNumber.Text; currentEntity.IDN = this.tbxIDN.Text; currentEntity.IdentityNumber = this.tbxIdentityNumber.Text; currentEntity.IdentityNumberDate = this.tbxIdentityNumberDate.TextAsDateParseExact; currentEntity.IdentityNumberIssueBy = this.tbxIdentityNumberIssueBy.Text; currentEntity.Title = this.tbxTitle.Text; currentEntity.IDCard = this.tbxIDCard.Text; currentEntity.AccessCard1 = this.tbxAccessCard1.Text; currentEntity.AccessCard2 = this.tbxAccessCard2.Text; currentEntity.idPosition = this.ddlPosition.SelectedValueINT; currentEntity.PermanentPostCode = this.tbxPermanentPostCode.Text; currentEntity.CorespondationPostCode = (!string.IsNullOrEmpty(this.tbxCorespondationPostCode.Text)) ? this.tbxCorespondationPostCode.Text : this.tbxPermanentPostCode.Text; this.tbxCorespondationPostCode.Text = currentEntity.CorespondationPostCode; currentEntity.idMaritalstatus = this.ddlMaritalStatus.SelectedValueINT; this.ownerPage.CallContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser; this.ownerPage.CallContext = this.ownerPage.AdminClientRef.PersonSave(currentEntity, this.ownerPage.CallContext); if (this.ownerPage.CallContext.ResultCode == ETEMEnums.ResultEnum.Success) { this.lbResultContext.Text = this.ownerPage.CallContext.Message; this.hdnRowMasterKey.Value = this.ownerPage.CallContext.EntityID; CheckIfResultIsSuccess(lbResultContext); this.PersonInfo = this.currentEntity.FullName; if (!string.IsNullOrEmpty(PersonUsedFor)) { if (PersonUsedFor == ETEMEnums.PersonTypeEnum.Employe.ToString()) { if (isNewEntity) { Employe newEmploye = new Employe(); newEmploye.idPerson = Convert.ToInt32(this.ownerPage.CallContext.EntityID); CallContext callContext = new CallContext(); callContext = this.ownerPage.EmployeClientRef.EmployeSave(newEmploye, callContext); if (callContext.ResultCode == ETEMEnums.ResultEnum.Success) { this.DetailsKeyID = callContext.EntityID; } else { this.DetailsKeyID = Constants.INVALID_ID_STRING; } } } } } this.pnlDivSearchStudent.Visible = false; if (string.IsNullOrWhiteSpace(this.PersonUsedFor)) { this.ownerPage.FormLoad(); } if (this.PersonUsedFor == ETEMEnums.PersonTypeEnum.Student.ToString() || this.PersonUsedFor == ETEMEnums.PersonTypeEnum.PhD.ToString()) { if (string.IsNullOrEmpty(this.tbxIDN.Text)) { this.divIDN.Visible = true; } else { this.divIDN.Visible = false; } } else { this.divIDN.Visible = false; } return new Tuple<CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("Personal_Data")); }
protected void btnDeleteNoticeTo_Click(object sender, EventArgs e) { personToNotice = new List<Person>(); HiddenField hdnRowDetailKey; CheckBox chbxDeleteNotificationTo; foreach (GridViewRow row in this.gvSendNoticeTo.Rows) { hdnRowDetailKey = row.FindControl("hdnRowDetailKey") as HiddenField; chbxDeleteNotificationTo = row.FindControl("chbxDeleteNotificationTo") as CheckBox; if (!chbxDeleteNotificationTo.Checked) { personToSend = this.AdminClientRef.GetPersonByPersonID(hdnRowDetailKey.Value); if (personToNotice != null) { personToNotice.Add(new Person { idPerson = personToSend.idPerson, Title = personToSend.Title, FirstName = personToSend.FirstName, LastName = personToSend.LastName } ); } } } this.gvSendNoticeTo.DataSource = personToNotice; this.gvSendNoticeTo.DataBind(); }
protected void btnAddNoticeTo_Click(object sender, EventArgs e) { if (this.ddlGroup.SelectedValue != Constants.INVALID_ID_STRING && string.IsNullOrEmpty(this.hdnRowMasterKey.Value)) { //List<OrderUserLink> list = new List<OrderUserLink>(); CallContext resultContext = new CallContext(); //дублиране на лицата за известяване personToNotice = new List<Person>(); //Добавяне на списък потребители от група if (!string.IsNullOrEmpty(this.ddlGroup.SelectedValue) && this.ddlGroup.SelectedValue != Constants.INVALID_ID_STRING) { Group group = this.AdminClientRef.GetGroupByID(this.ddlGroup.SelectedValueINT); List<GroupPersonLinkDataView> groupPersonLink = this.AdminClientRef.GetGroupPersonLinkDataViewByGroupID(group.idGroup); int? idUser; foreach (var item in groupPersonLink) { idUser = this.ownerPage.AdminClientRef.GetUserByPersonID(item.idPerson).idUser; if (personToNotice.Where(d => idUser.HasValue && d.idPerson == item.idPerson).Count() == 0) { personToNotice.Add(new Person { idPerson = item.idPerson, Title = item.Title, FirstName = item.FirstName, LastName = item.LastName } ); } } } HiddenField hdnRowDetailKey; CheckBox chbxDeleteNotificationTo; //добавяме и редовете от грида, ако има такива foreach (GridViewRow row in this.gvSendNoticeTo.Rows) { hdnRowDetailKey = row.FindControl("hdnRowDetailKey") as HiddenField; chbxDeleteNotificationTo = row.FindControl("chbxDeleteNotificationTo") as CheckBox; if (!chbxDeleteNotificationTo.Checked) { personToSend = this.AdminClientRef.GetPersonByPersonID(hdnRowDetailKey.Value); if (personToNotice != null && personToNotice.Where(z => z.idPerson == personToSend.idPerson).Count() == 0) { personToNotice.Add(new Person { idPerson = personToSend.idPerson, Title = personToSend.Title, FirstName = personToSend.FirstName, LastName = personToSend.LastName } ); } } } this.gvSendNoticeTo.DataSource = personToNotice; this.gvSendNoticeTo.DataBind(); } }
/// <summary> /// Deprecated Method for adding a new object to the Persons EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPersons(Person person) { base.AddObject("Persons", person); }
/// <summary> /// Create a new Person object. /// </summary> /// <param name="idPerson">Initial value of the idPerson property.</param> public static Person CreatePerson(global::System.Int32 idPerson) { Person person = new Person(); person.idPerson = idPerson; return person; }
public override void UserControlLoad() { if (!this.ownerPage.UserProps.IsCheckDomain) { this.idDivChangePassword.Visible = true; } else { this.idDivChangePassword.Visible = false; } this.tbxOldPass.Text = string.Empty; this.tbxNewPass1.Text = string.Empty; this.tbxNewPass2.Text = string.Empty; currentEntity = this.ownerPage.AdminClientRef.GetPersonByPersonID(this.ownerPage.UserProps.PersonID); this.ddlCitizenshipCorespondention.UserControlLoad(); if (currentEntity != null) { this.tbxFirstName.Text = currentEntity.FirstName; this.tbxSecondName.Text = currentEntity.SecondName; this.tbxLastName.Text = currentEntity.LastName; this.tbxEMail.Text = currentEntity.EMail; this.tbxMobilePhone.Text = currentEntity.MobilePhone; this.tbxPhone.Text = currentEntity.Phone; this.tbxCorespondationPostCode.Text = currentEntity.CorespondationPostCode; this.tbxCorespondationAddress.Text = currentEntity.CorespondationAddress; if (this.currentEntity.idCorespondationCountry.HasValue) { SelectEKATEsData(this.ddlCitizenshipCorespondention, this.ddlMunicipalityCorespondation, this.currentEntity.idCorespondationCountry.ToString(), this.currentEntity.idCorespondationMunicipality, this.ucAutoCompleteLocationCoreposndation, this.currentEntity.idCorespondationCity); } else { SelectEKATEsData(this.ddlCitizenshipCorespondention, this.ddlMunicipalityCorespondation, Constants.INVALID_ID_STRING, Constants.INVALID_ID_NULLABLE, this.ucAutoCompleteLocationCoreposndation, Constants.INVALID_ID_NULLABLE); } } }
public override Tuple<CallContext, string> UserControlSave() { bool isNewEntity = true; if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value) || this.hdnRowMasterKey.Value == Constants.INVALID_ID_STRING) { this.currentEntity = new Person(); } else { this.currentEntity = this.ownerPage.AdminClientRef.GetPersonByPersonID(this.hdnRowMasterKey.Value); if (this.currentEntity == null) { this.lbResultContext.Text = String.Format(BaseHelper.GetCaptionString("Entity_Person_Not_Found_By_ID"), this.hdnRowMasterKey.Value); string falseResult = String.Format(BaseHelper.GetCaptionString("Entity_is_not_update_in_tab"), BaseHelper.GetCaptionString("Personal_Data")); this.ownerPage.CallContext.ResultCode = ETEMEnums.ResultEnum.Error; this.ownerPage.CallContext.Message = falseResult; return new Tuple<CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("Personal_Data")); } isNewEntity = false; } currentEntity.IdentityNumber = this.tbxIdentityNumber.Text; currentEntity.FirstName = this.tbxFirstName.Text; currentEntity.SecondName = this.tbxSecondName.Text; currentEntity.LastName = this.tbxLastName.Text; currentEntity.idSex = this.dllSex.SelectedValueINT; DateTime? tmpBirthDate = null; if (this.tbxBirthDate.TextAsDateParseExact.HasValue) { tmpBirthDate = this.tbxBirthDate.TextAsDateParseExact; } else if (!string.IsNullOrEmpty(this.tbxEGN.Text)) { try { string firstPartEGN = this.tbxEGN.Text.Substring(0, 6); int year = int.Parse(firstPartEGN.Substring(0, 2)); int month = int.Parse(firstPartEGN.Substring(2, 2)); int day = int.Parse(firstPartEGN.Substring(4, 2)); if (month > 40) { month = month - 40; year = year + 2000; } else { year = year + 1900; } tmpBirthDate = new DateTime( year, month, day ); this.tbxBirthDate.Text = tmpBirthDate.Value.ToString("dd.MM.yyyy"); } catch { } } currentEntity.BirthDate = tmpBirthDate; currentEntity.EMail = this.tbxEMail.Text; currentEntity.MobilePhone = this.tbxMobilePhone.Text; currentEntity.Phone = this.tbxPhone.Text; currentEntity.EGN = this.tbxEGN.Text; currentEntity.IDN = this.tbxIDN.Text; currentEntity.IdentityNumber = this.tbxIdentityNumber.Text; currentEntity.Title = this.tbxTitle.Text; this.ownerPage.CallContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser; this.ownerPage.CallContext = this.ownerPage.AdminClientRef.PersonSave(currentEntity, this.ownerPage.CallContext); if (this.ownerPage.CallContext.ResultCode == ETEMEnums.ResultEnum.Success) { this.lbResultContext.Text = this.ownerPage.CallContext.Message; this.hdnRowMasterKey.Value = this.ownerPage.CallContext.EntityID; CheckIfResultIsSuccess(lbResultContext); this.PersonInfo = this.currentEntity.FullName; if (!string.IsNullOrEmpty(PersonUsedFor)) { if (PersonUsedFor == ETEMEnums.PersonTypeEnum.Employe.ToString()) { if (isNewEntity) { Employe newEmploye = new Employe(); newEmploye.idPerson = Convert.ToInt32(this.ownerPage.CallContext.EntityID); CallContext callContext = new CallContext(); callContext = this.ownerPage.EmployeClientRef.EmployeSave(newEmploye, callContext); if (callContext.ResultCode == ETEMEnums.ResultEnum.Success) { this.DetailsKeyID = callContext.EntityID; } else { this.DetailsKeyID = Constants.INVALID_ID_STRING; } } } } } this.pnlDivSearchStudent.Visible = false; if (string.IsNullOrWhiteSpace(this.PersonUsedFor)) { this.ownerPage.FormLoad(); } return new Tuple<CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("Personal_Data")); }
public override void UserControlLoad() { SetEmptyValues(); if (NoLoadUserPanel == Constants.TRUE_VALUE_TEXT) { this.pnlDivSearchStudent.Visible = false; } if (this.ownerPage == null) { throw new UMSException("Current Page is null or is not inheritor of BasicPage."); } loadInitControls(); this.currentEntity = this.ownerPage.AdminClientRef.GetPersonByPersonID(this.CurrentEntityMasterID); if (currentEntity != null) { this.pnlDivSearchStudent.Visible = false; this.tbxIdentityNumber.Text = currentEntity.IdentityNumber; this.tbxFirstName.Text = currentEntity.FirstName; this.tbxSecondName.Text = currentEntity.SecondName; this.tbxLastName.Text = currentEntity.LastName; this.tbxFirstNameEN.Text = currentEntity.FirstNameEN; this.tbxSecondNameEN.Text = currentEntity.SecondNameEN; this.tbxLastNameEN.Text = currentEntity.LastNameEN; this.dllSex.SelectedValue = currentEntity.idSex.ToString(); this.ddlCitizenship.SelectedValue = currentEntity.idCitizenship.ToString(); this.ddlSecondCitizenship.SelectedValue = currentEntity.idSecondCitizenship.ToString(); this.tbxPermanentAddressAddition.Text = currentEntity.Address; this.tbxBirthDate.SetTxbDateTimeValue(currentEntity.BirthDate); //this.tbxBirthDate.Text = currentEntity.BirthDateStr; this.tbxEMail.Text = currentEntity.EMail; this.tbxMobilePhone.Text = currentEntity.MobilePhone; this.tbxPhone.Text = currentEntity.Phone; this.tbxEGN.Text = currentEntity.EGN; this.tbxForeignerIdentityNumber.Text = currentEntity.ForeignerIdentityNumber; this.tbxIDN.Text = currentEntity.IDN; if (this.PersonUsedFor == ETEMEnums.PersonTypeEnum.Student.ToString() || this.PersonUsedFor == ETEMEnums.PersonTypeEnum.PhD.ToString()) { if (string.IsNullOrEmpty(this.tbxIDN.Text)) { this.divIDN.Visible = true; } else { this.divIDN.Visible = false; } } else { this.divIDN.Visible = false; } this.tbxIdentityNumber.Text = currentEntity.IdentityNumber; this.tbxIdentityNumberDate.SetTxbDateTimeValue(currentEntity.IdentityNumberDate); // this.tbxIdentityNumberDate.Text = currentEntity.IdentityNumberDateStr; this.tbxIdentityNumberIssueBy.Text = currentEntity.IdentityNumberIssueBy; this.tbxTitle.Text = currentEntity.Title; this.tbxIDCard.Text = currentEntity.IDCard; this.tbxPermanentPostCode.Text = currentEntity.PermanentPostCode; this.tbxCorespondationPostCode.Text = currentEntity.CorespondationPostCode; this.ddlMaritalStatus.SelectedValue = currentEntity.idMaritalstatus.ToString(); this.tbxCorespondationAddress.Text = currentEntity.CorespondationAddress; this.tbxAccessCard1.Text = currentEntity.AccessCard1; this.tbxAccessCard2.Text = currentEntity.AccessCard2; this.ddlPosition.SelectedValue = currentEntity.idPosition.ToString(); this.hdnRowMasterKey.Value = currentEntity.idPerson.ToString(); ClearResultContext(this.lbResultContext); this.lbResultContext.Attributes.Remove("class"); if (!string.IsNullOrEmpty(currentEntity.ImagePath)) { this.imgBtnPerson.ImageUrl = currentEntity.ImagePath; } else { this.imgBtnPerson.ImageUrl = @"~/Images/person-clip-art-2.png"; } if (this.currentEntity.idLocation.HasValue) { var location = this.ownerPage.AdminClientRef.GetLocationById(this.currentEntity.idLocation.Value.ToString()); this.ucAutoCompleteLocationPermanentAdress.Text = (location != null ? location.LocationName : string.Empty); } if (this.currentEntity.idPlaceOfBirthCountry.HasValue) { SelectEKATEsData(this.ddlCitizenshipPlaceOfBirth, this.ddlMunicipalityPlaceOfBirth, this.currentEntity.idPlaceOfBirthCountry.ToString(), this.currentEntity.idPlaceOfBirthMunicipality, this.ucAutoCompleteLocationPlaceOfBirth, this.currentEntity.idPlaceOfBirthCity); } else { SelectEKATEsData(this.ddlCitizenshipPlaceOfBirth, this.ddlMunicipalityPlaceOfBirth, Constants.INVALID_ID_STRING, Constants.INVALID_ID_NULLABLE, this.ucAutoCompleteLocationPlaceOfBirth, Constants.INVALID_ID_NULLABLE); } if (this.currentEntity.idPermanentAdressCountry.HasValue) { SelectEKATEsData(this.ddlCitizenshipPermanentAdress, this.ddlMunicipalityPermanentAdress, this.currentEntity.idPermanentAdressCountry.ToString(), this.currentEntity.idPermanentAdressMunicipality, this.ucAutoCompleteLocationPermanentAdress, this.currentEntity.idPermanentAdressCity); } else { SelectEKATEsData(this.ddlCitizenshipPermanentAdress, this.ddlMunicipalityPermanentAdress, Constants.INVALID_ID_STRING, Constants.INVALID_ID_NULLABLE, this.ucAutoCompleteLocationPermanentAdress, Constants.INVALID_ID_NULLABLE); } if (this.currentEntity.idCorespondationCountry.HasValue) { SelectEKATEsData(this.ddlCitizenshipCorespondention, this.ddlMunicipalityCorespondation, this.currentEntity.idCorespondationCountry.ToString(), this.currentEntity.idCorespondationMunicipality, this.ucAutoCompleteLocationCoreposndation, this.currentEntity.idCorespondationCity); } else { SelectEKATEsData(this.ddlCitizenshipCorespondention, this.ddlMunicipalityCorespondation, Constants.INVALID_ID_STRING, Constants.INVALID_ID_NULLABLE, this.ucAutoCompleteLocationCoreposndation, Constants.INVALID_ID_NULLABLE); } this.PersonInfo = this.currentEntity.FullName; LoadPersonHistory(); } else { LoadDdlLoadStudentInfoBy(); //this.ucTextForSearchStudent.CustomCase = (this.PersonUsedFor == UMSEnums.PersonTypeEnum.StudentCandidate.ToString() ? // "PersonAndCandidateByName" : "StudentAndCandidateByName"); if (this.PersonUsedFor == ETEMEnums.PersonTypeEnum.Student.ToString()) { this.ucTextForSearchStudent.CustomCase = "StudentAndCandidateByName"; this.ucTextForSearchStudent.AdditionalWhereParam = (this.IdAcademicPeriod != Constants.INVALID_ID ? "idAcademicPeriod=" + this.IdAcademicPeriod : string.Empty); } else if (this.PersonUsedFor == ETEMEnums.PersonTypeEnum.StudentCandidate.ToString()) { this.ucTextForSearchStudent.CustomCase = "PreparationANDStudentAndCandidateByName"; } else if (this.PersonUsedFor == ETEMEnums.PersonTypeEnum.ArtModel.ToString()) { this.ucTextForSearchStudent.CustomCase = "PersonALLByName"; } else if (this.PersonUsedFor == ETEMEnums.PersonTypeEnum.PhD.ToString()) { this.ucTextForSearchStudent.CustomCase = "PersonsAllTypes"; } else { this.ucTextForSearchStudent.CustomCase = "PersonALLByName"; } this.ucTextForSearchStudent.Text = string.Empty; this.ucTextForSearchStudent.UserControlLoad(); //this.pnlDivSearchStudent.Visible = true; SetEmptyValues(); this.gvPersonHistory.DataSource = null; this.gvPersonHistory.DataBind(); } }
public override Tuple <CallContext, string> UserControlSave() { bool isNewEntity = true; if (string.IsNullOrEmpty(this.hdnRowMasterKey.Value) || this.hdnRowMasterKey.Value == Constants.INVALID_ID_STRING) { this.currentEntity = new Person(); } else { this.currentEntity = this.ownerPage.AdminClientRef.GetPersonByPersonID(this.hdnRowMasterKey.Value); if (this.currentEntity == null) { this.lbResultContext.Text = String.Format(BaseHelper.GetCaptionString("Entity_Person_Not_Found_By_ID"), this.hdnRowMasterKey.Value); string falseResult = String.Format(BaseHelper.GetCaptionString("Entity_is_not_update_in_tab"), BaseHelper.GetCaptionString("Personal_Data")); this.ownerPage.CallContext.ResultCode = ETEMEnums.ResultEnum.Error; this.ownerPage.CallContext.Message = falseResult; return(new Tuple <CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("Personal_Data"))); } isNewEntity = false; } currentEntity.IdentityNumber = this.tbxIdentityNumber.Text; currentEntity.FirstName = this.tbxFirstName.Text; currentEntity.SecondName = this.tbxSecondName.Text; currentEntity.LastName = this.tbxLastName.Text; currentEntity.FirstNameEN = this.tbxFirstNameEN.Text; currentEntity.SecondNameEN = this.tbxSecondNameEN.Text; currentEntity.LastNameEN = this.tbxLastNameEN.Text; currentEntity.idSex = this.dllSex.SelectedValueINT; currentEntity.idCitizenship = this.ddlCitizenship.SelectedValueINT; currentEntity.idSecondCitizenship = this.ddlSecondCitizenship.SelectedValueINT; currentEntity.idPermanentAdressCountry = this.ddlCitizenshipPermanentAdress.SelectedValueINT; currentEntity.idPermanentAdressMunicipality = this.ddlMunicipalityPermanentAdress.SelectedValueINT; currentEntity.idPermanentAdressCity = this.ucAutoCompleteLocationPermanentAdress.SelectedValueINT; //currentEntity.idLocation = ; currentEntity.idPlaceOfBirthCountry = this.ddlCitizenshipPlaceOfBirth.SelectedValueINT; currentEntity.idPlaceOfBirthMunicipality = this.ddlMunicipalityPlaceOfBirth.SelectedValueINT; currentEntity.idPlaceOfBirthCity = this.ucAutoCompleteLocationPlaceOfBirth.SelectedValueINT; currentEntity.idCorespondationCountry = (this.ddlCitizenshipCorespondention.SelectedValueINT != Constants.INVALID_ID) ? this.ddlCitizenshipCorespondention.SelectedValueINT : this.ddlCitizenshipPermanentAdress.SelectedValueINT; currentEntity.idCorespondationMunicipality = (this.ddlMunicipalityCorespondation.SelectedValueINT != Constants.INVALID_ID) ? this.ddlMunicipalityCorespondation.SelectedValueINT : this.ddlMunicipalityPermanentAdress.SelectedValueINT; currentEntity.idCorespondationCity = (this.ucAutoCompleteLocationCoreposndation.SelectedValueINT != null) ? this.ucAutoCompleteLocationCoreposndation.SelectedValueINT : this.ucAutoCompleteLocationPermanentAdress.SelectedValueINT; if (this.currentEntity.idCorespondationCountry.HasValue) { SelectEKATEsData(this.ddlCitizenshipCorespondention, this.ddlMunicipalityCorespondation, this.currentEntity.idCorespondationCountry.ToString(), this.currentEntity.idCorespondationMunicipality, this.ucAutoCompleteLocationCoreposndation, this.currentEntity.idCorespondationCity); } currentEntity.Address = this.tbxPermanentAddressAddition.Text; currentEntity.CorespondationAddress = (!string.IsNullOrEmpty(this.tbxCorespondationAddress.Text)) ? this.tbxCorespondationAddress.Text : this.tbxPermanentAddressAddition.Text; this.tbxCorespondationAddress.Text = currentEntity.CorespondationAddress; DateTime?tmpBirthDate = null; if (this.tbxBirthDate.TextAsDateParseExact.HasValue) { tmpBirthDate = this.tbxBirthDate.TextAsDateParseExact; } else if (!string.IsNullOrEmpty(this.tbxEGN.Text)) { try { string firstPartEGN = this.tbxEGN.Text.Substring(0, 6); int year = int.Parse(firstPartEGN.Substring(0, 2)); int month = int.Parse(firstPartEGN.Substring(2, 2)); int day = int.Parse(firstPartEGN.Substring(4, 2)); if (month > 40) { month = month - 40; year = year + 2000; } else { year = year + 1900; } tmpBirthDate = new DateTime( year, month, day ); this.tbxBirthDate.Text = tmpBirthDate.Value.ToString("dd.MM.yyyy"); } catch { } } currentEntity.BirthDate = tmpBirthDate; currentEntity.EMail = this.tbxEMail.Text; currentEntity.MobilePhone = this.tbxMobilePhone.Text; currentEntity.Phone = this.tbxPhone.Text; currentEntity.EGN = this.tbxEGN.Text; currentEntity.ForeignerIdentityNumber = this.tbxForeignerIdentityNumber.Text; currentEntity.IDN = this.tbxIDN.Text; currentEntity.IdentityNumber = this.tbxIdentityNumber.Text; currentEntity.IdentityNumberDate = this.tbxIdentityNumberDate.TextAsDateParseExact; currentEntity.IdentityNumberIssueBy = this.tbxIdentityNumberIssueBy.Text; currentEntity.Title = this.tbxTitle.Text; currentEntity.IDCard = this.tbxIDCard.Text; currentEntity.AccessCard1 = this.tbxAccessCard1.Text; currentEntity.AccessCard2 = this.tbxAccessCard2.Text; currentEntity.idPosition = this.ddlPosition.SelectedValueINT; currentEntity.PermanentPostCode = this.tbxPermanentPostCode.Text; currentEntity.CorespondationPostCode = (!string.IsNullOrEmpty(this.tbxCorespondationPostCode.Text)) ? this.tbxCorespondationPostCode.Text : this.tbxPermanentPostCode.Text; this.tbxCorespondationPostCode.Text = currentEntity.CorespondationPostCode; currentEntity.idMaritalstatus = this.ddlMaritalStatus.SelectedValueINT; this.ownerPage.CallContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser; this.ownerPage.CallContext = this.ownerPage.AdminClientRef.PersonSave(currentEntity, this.ownerPage.CallContext); if (this.ownerPage.CallContext.ResultCode == ETEMEnums.ResultEnum.Success) { this.lbResultContext.Text = this.ownerPage.CallContext.Message; this.hdnRowMasterKey.Value = this.ownerPage.CallContext.EntityID; CheckIfResultIsSuccess(lbResultContext); this.PersonInfo = this.currentEntity.FullName; if (!string.IsNullOrEmpty(PersonUsedFor)) { if (PersonUsedFor == ETEMEnums.PersonTypeEnum.Employe.ToString()) { if (isNewEntity) { Employe newEmploye = new Employe(); newEmploye.idPerson = Convert.ToInt32(this.ownerPage.CallContext.EntityID); CallContext callContext = new CallContext(); callContext = this.ownerPage.EmployeClientRef.EmployeSave(newEmploye, callContext); if (callContext.ResultCode == ETEMEnums.ResultEnum.Success) { this.DetailsKeyID = callContext.EntityID; } else { this.DetailsKeyID = Constants.INVALID_ID_STRING; } } } } } this.pnlDivSearchStudent.Visible = false; if (string.IsNullOrWhiteSpace(this.PersonUsedFor)) { this.ownerPage.FormLoad(); } if (this.PersonUsedFor == ETEMEnums.PersonTypeEnum.Student.ToString() || this.PersonUsedFor == ETEMEnums.PersonTypeEnum.PhD.ToString()) { if (string.IsNullOrEmpty(this.tbxIDN.Text)) { this.divIDN.Visible = true; } else { this.divIDN.Visible = false; } } else { this.divIDN.Visible = false; } return(new Tuple <CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("Personal_Data"))); }