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")); }
/// <summary> /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToEmployees(Employe employe) { base.AddObject("Employees", employe); }
/// <summary> /// Create a new Employe object. /// </summary> /// <param name="idEmploye">Initial value of the idEmploye property.</param> /// <param name="idPerson">Initial value of the idPerson property.</param> public static Employe CreateEmploye(global::System.Int32 idEmploye, global::System.Int32 idPerson) { Employe employe = new Employe(); employe.idEmploye = idEmploye; employe.idPerson = idPerson; return employe; }
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")); }