//View Mode private void GetLoadDataToControl(DTO.Person general) { //var attachFiles = this.AttachFiles; //var personAttachFiles = this.PersonAttachFiles; MasterPage.PersonId = general.ID; if (general.MEMBER_TYPE != ((int)DTO.MemberType.General).ToString()) { MasterPage.ModelError.ShowMessageError = SysMessage.UserMissMatchRegitrationData; MasterPage.ModelError.ShowModalError(); } txtIDNumber.Text = general.ID_CARD_NO; ddlTitle.SelectedValue = general.PRE_NAME_CODE; txtFirstName.Text = general.NAMES; txtLastName.Text = general.LASTNAME; txtIDNumber.Text = general.ID_CARD_NO; txtBirthDay.Text = (general.BIRTH_DATE == null) ? "" : ((DateTime)general.BIRTH_DATE).ToString("dd/MM/yyyy"); rblSex.SelectedValue = general.SEX; rblSex.Enabled = false; ddlNationality.SelectedValue = general.NATIONALITY; ddlEducation.SelectedValue = general.EDUCATION_CODE; txtEmail.Text = general.EMAIL; txtTel.Text = LocalTelephoneNumberHelper.GetPhoneNumber(general.LOCAL_TELEPHONE); txtTelExt.Text = LocalTelephoneNumberHelper.GetExtenNumber(general.LOCAL_TELEPHONE); txtMobilePhone.Text = general.TELEPHONE; ucAddressCurrent.Address = general.ADDRESS_1; // txtCurrentAddress.Text; ucAddressCurrent.SelectDropDownStep(general.PROVINCE_CODE, general.AREA_CODE, general.TUMBON_CODE); ucAddressCurrent.PostCode = general.ZIP_CODE; // txtPostcodeCurrentAddress.Text; ucAddressRegister.Address = general.LOCAL_ADDRESS1; // txtRegisterAddress.Text; ucAddressRegister.SelectDropDownStep(general.LOCAL_PROVINCE_CODE, general.LOCAL_AREA_CODE, general.LOCAL_TUMBON_CODE); ucAddressRegister.PostCode = general.LOCAL_ZIPCODE; // txtPostcodeRegisterAddress.Text; if (general.STATUS != null) { Session["Status"] = general.STATUS.ToString(); //Set status after approve } if (general.STATUS != Convert.ToString((int)DTO.PersonDataStatus.WaitForApprove)) { MasterPage.ResultRegister = general.APPROVE_RESULT; } //if ((general.AGENT_TYPE != "") && (general.AGENT_TYPE != null)) //{ // ddlAgentType.SelectedValue = general.AGENT_TYPE; //} //else if ((general.AGENT_TYPE == "") || (general.AGENT_TYPE == null)) //{ // ddlAgentType.Items.Clear(); // ddlAgentType.DataSource = null; // ddlAgentType.DataBind(); //} //general.CREATED_BY = "agdoi"; //general.CREATED_DATE = DateTime.Now; //general.UPDATED_BY = "agdoi"; //general.UPDATED_DATE = DateTime.Now; //general.REG_PASS = MasterPage.Password; }
public void Insert(string title, string phoneNumber, string mobile) { using (var context = new Model.DTO.PhonebookEntities()) { try { Model.DTO.Person ref_Person = new DTO.Person(); ref_Person.Title = title; ref_Person.PhoneNumber = phoneNumber; ref_Person.Mobile = mobile; context.Person.Add(ref_Person); context.SaveChanges(); } catch (Exception) { throw; } finally { if (context != null) { context.Dispose(); } } } }
/// <summary> /// Generates a <see cref="DTO.Thing"/> from the current <see cref="Person"/> /// </summary> public override DTO.Thing ToDto() { var dto = new DTO.Person(this.Iid, this.RevisionNumber); dto.DefaultDomain = this.DefaultDomain != null ? (Guid?)this.DefaultDomain.Iid : null; dto.DefaultEmailAddress = this.DefaultEmailAddress != null ? (Guid?)this.DefaultEmailAddress.Iid : null; dto.DefaultTelephoneNumber = this.DefaultTelephoneNumber != null ? (Guid?)this.DefaultTelephoneNumber.Iid : null; dto.EmailAddress.AddRange(this.EmailAddress.Select(x => x.Iid)); dto.ExcludedDomain.AddRange(this.ExcludedDomain.Select(x => x.Iid)); dto.ExcludedPerson.AddRange(this.ExcludedPerson.Select(x => x.Iid)); dto.GivenName = this.GivenName; dto.IsActive = this.IsActive; dto.IsDeprecated = this.IsDeprecated; dto.ModifiedOn = this.ModifiedOn; dto.Organization = this.Organization != null ? (Guid?)this.Organization.Iid : null; dto.OrganizationalUnit = this.OrganizationalUnit; dto.Password = this.Password; dto.RevisionNumber = this.RevisionNumber; dto.Role = this.Role != null ? (Guid?)this.Role.Iid : null; dto.ShortName = this.ShortName; dto.Surname = this.Surname; dto.TelephoneNumber.AddRange(this.TelephoneNumber.Select(x => x.Iid)); dto.ThingPreference = this.ThingPreference; dto.UserPreference.AddRange(this.UserPreference.Select(x => x.Iid)); dto.IterationContainerId = this.CacheKey.Iteration; dto.RegisterSourceThing(this); this.BuildDtoPartialRoutes(dto); return(dto); }
//View Mode private void GetLastPerson() { DTO.Person res = MasterPage.GetPersonal(); if (res != null) { GetLoadDataToControl(res); } }
private static Person MapToBusiness(DTO.Person person) { return(new Person { Id = person.Id, Name = person.Name, DateOfBirth = person.DateOfBirth, Address = person.Address, DepartmentId = person.DepartmentId }); }
public void DeletePerson(DTO.Person person) { try { var entity = this.mapper.Map <Person>(person); this.Delete(entity); } catch (Exception ex) { this.log.Error($"Failed to delete the {typeof(Person)} record with Id = {person.Id}", ex); } }
private string Chklength(DTO.Person person) { string name; name = person.NAMES + " " + person.LASTNAME; if (name.Length > 30) { name = name.Substring(0, 30); } return(name); }
public DTO.Person UpdatePerson(DTO.Person person) { try { var entity = this.mapper.Map <Person>(person); this.Update(entity); return(person); } catch (Exception ex) { this.log.Error($"Failed to update the {nameof(person)} record", ex); } return(null); }
public IActionResult Add(DTO.Person person) { using (var context = new PhoneBookContext()) { var modelPerson = _mapper.Map <Person>(person); if (modelPerson != null) { var newPerson = context.Add(modelPerson); context.SaveChanges(); return(Json(new { Success = true, newPerson.Entity.PersonId })); } } return(NotFound()); }
public IActionResult Update(DTO.Person person) { using (var context = new PhoneBookContext()) { var modelPerson = _mapper.Map <Person>(person); if (modelPerson != null) { context.Update(modelPerson); context.SaveChanges(); return(Ok()); } } return(NotFound()); }
public async Task <IActionResult> Phones(DTO.Person person) { using (var context = new PhoneBookContext()) { var phones = await context.Phones.Include(p => p.Person) .Where(p => p.Person.PersonId == person.PersonId).ToListAsync(); var phonesDto = new List <DTO.Phone>(); foreach (var phone in phones) { var phoneDto = _mapper.Map <DTO.Phone>(phone); phonesDto.Add(phoneDto); } return(View("_Phones", phonesDto)); } }
} // VARCHAR2 ( 100 ) #endregion #region ISerializable Members public void GetObjectData(SerializationInfo info, StreamingContext context) { DTO.Person ent = new DTO.Person(); ent.ID = (string)info.GetValue("IID", typeof(string)); ent.MEMBER_TYPE = (string)info.GetValue("IMEMBER_TYPE", typeof(string)); ent.ID_CARD_NO = (string)info.GetValue("IID_CARD_NO", typeof(string)); ent.EMPLOYEE_NO = (string)info.GetValue("IEMPLOYEE_NO", typeof(string)); ent.PRE_NAME_CODE = (string)info.GetValue("IPRE_NAME_CODE", typeof(string)); ent.NAMES = (string)info.GetValue("INAMES", typeof(string)); ent.LASTNAME = (string)info.GetValue("ILASTNAME", typeof(string)); ent.NATIONALITY = (string)info.GetValue("INATIONALITY", typeof(string)); ent.BIRTH_DATE = (DateTime?)info.GetValue("IBIRTH_DATE", typeof(DateTime?)); ent.SEX = (string)info.GetValue("ISEX", typeof(string)); ent.EDUCATION_CODE = (string)info.GetValue("IEDUCATION_CODE", typeof(string)); ent.ADDRESS_1 = (string)info.GetValue("IADDRESS_1", typeof(string)); ent.ADDRESS_2 = (string)info.GetValue("IADDRESS_2", typeof(string)); ent.AREA_CODE = (string)info.GetValue("IAREA_CODE", typeof(string)); ent.PROVINCE_CODE = (string)info.GetValue("IPROVINCE_CODE", typeof(string)); ent.ZIP_CODE = (string)info.GetValue("IZIP_CODE", typeof(string)); ent.TELEPHONE = (string)info.GetValue("ITELEPHONE", typeof(string)); ent.LOCAL_ADDRESS1 = (string)info.GetValue("ILOCAL_ADDRESS1", typeof(string)); ent.LOCAL_ADDRESS2 = (string)info.GetValue("ILOCAL_ADDRESS2", typeof(string)); ent.LOCAL_AREA_CODE = (string)info.GetValue("ILOCAL_AREA_CODE", typeof(string)); ent.LOCAL_PROVINCE_CODE = (string)info.GetValue("ILOCAL_PROVINCE_CODE", typeof(string)); ent.LOCAL_ZIPCODE = (string)info.GetValue("ILOCAL_ZIPCODE", typeof(string)); ent.LOCAL_TELEPHONE = (string)info.GetValue("ILOCAL_TELEPHONE", typeof(string)); ent.EMAIL = (string)info.GetValue("IEMAIL", typeof(string)); ent.STATUS = (string)info.GetValue("ISTATUS", typeof(string)); ent.TUMBON_CODE = (string)info.GetValue("ITUMBON_CODE", typeof(string)); ent.LOCAL_TUMBON_CODE = (string)info.GetValue("ILOCAL_TUMBON_CODE", typeof(string)); ent.COMP_CODE = (string)info.GetValue("ICOMP_CODE", typeof(string)); ent.CREATED_BY = (string)info.GetValue("ICREATED_BY", typeof(string)); ent.CREATED_DATE = (DateTime?)info.GetValue("ICREATED_DATE", typeof(DateTime?)); ent.UPDATED_BY = (string)info.GetValue("IUPDATED_BY", typeof(string)); ent.UPDATED_DATE = (DateTime?)info.GetValue("IUPDATED_DATE", typeof(DateTime?)); ent.APPROVE_RESULT = (string)info.GetValue("IAPPROVE_RESULT", typeof(string)); ent.APPROVED_BY = (string)info.GetValue("IAPPROVED_BY", typeof(string)); ent.AGENT_TYPE = (string)info.GetValue("IAGENT_TYPE", typeof(string)); ent.SIGNATUER_IMG = (string)info.GetValue("ISIGNATUER_IMG", typeof(string)); ent.IMG_SIGN = (Byte[])info.GetValue("IIMG_SIGN", typeof(Byte[])); per = ent; //ent.MappingToEntity<AG_IAS_PERSONAL_T>(per);// = ent; }
//View Mode protected void GetLoadDataToControl(DTO.Person insurance) { BLL.DataCenterBiz dcbiz = new BLL.DataCenterBiz(); MasterPage.PersonId = insurance.ID; if (!insurance.MEMBER_TYPE.Equals(DTO.MemberType.Association.GetEnumValue().ToString())) { MasterPage.ModelError.ShowMessageError = SysMessage.UserMissMatchRegitrationData; MasterPage.ModelError.ShowModalError(); } txtAssociationRegister.Text = insurance.COMP_CODE; ddlTitle.SelectedValue = insurance.PRE_NAME_CODE; txtFirstName.Text = insurance.NAMES; txtLastName.Text = insurance.LASTNAME; txtIDCard.Text = insurance.ID_CARD_NO; txtIDCard.Enabled = false; rblSex.SelectedValue = insurance.SEX; rblSex.Enabled = false; txtAssociationTel.Text = LocalTelephoneNumberHelper.GetPhoneNumber(insurance.LOCAL_TELEPHONE); txtAssociationTelExt.Text = LocalTelephoneNumberHelper.GetExtenNumber(insurance.LOCAL_TELEPHONE); txtTel.Text = LocalTelephoneNumberHelper.GetPhoneNumber(insurance.TELEPHONE); txtTelExt.Text = LocalTelephoneNumberHelper.GetExtenNumber(insurance.TELEPHONE); txtEmail.Text = insurance.EMAIL; txtEmail.Enabled = false; UcAddress.TextBoxAddress.Text = insurance.ADDRESS_1; UcAddress.SelectDropDownStep(insurance.PROVINCE_CODE, insurance.AREA_CODE, insurance.TUMBON_CODE); UcAddress.TextBoxPostCode.Text = insurance.ZIP_CODE; txtAssociation.Text = new BLL.DataCenterBiz().GetInsuranceAssociateNameByID(insurance.COMP_CODE).DataResponse.ASSOCIATION_NAME + " " + "[" + insurance.COMP_CODE + "]"; UcAddress.DropdownParish.SelectedValue = insurance.TUMBON_CODE; if (insurance.STATUS != null) { Session["Status"] = insurance.STATUS.ToString(); //Set status after approve } if (insurance.STATUS != Convert.ToString((int)DTO.PersonDataStatus.WaitForApprove)) { MasterPage.ResultRegister = insurance.APPROVE_RESULT; } }
//View Mode private void GetLoadDataToControl(DTO.Person company) { MasterPage.PersonId = company.ID; if (!company.MEMBER_TYPE.Equals(DTO.MemberType.Insurance.GetEnumValue().ToString())) { MasterPage.ModelError.ShowMessageError = SysMessage.UserMissMatchRegitrationData; MasterPage.ModelError.ShowModalError(); } txtCompanyRegister.Text = company.COMP_CODE; ddlTitle.SelectedValue = company.PRE_NAME_CODE; txtFirstName.Text = company.NAMES; txtLastName.Text = company.LASTNAME; txtIDCard.Text = company.ID_CARD_NO; txtIDCard.Enabled = false; rblSex.SelectedValue = company.SEX; rblSex.Enabled = false; txtCompanyTel.Text = LocalTelephoneNumberHelper.GetPhoneNumber(company.LOCAL_TELEPHONE); txtCompanyTelExt.Text = LocalTelephoneNumberHelper.GetExtenNumber(company.LOCAL_TELEPHONE); txtTel.Text = LocalTelephoneNumberHelper.GetPhoneNumber(company.TELEPHONE); txtTelExt.Text = LocalTelephoneNumberHelper.GetExtenNumber(company.TELEPHONE); txtEmail.Text = company.EMAIL; txtEmail.Enabled = false; UcAddress.TextBoxAddress.Text = company.ADDRESS_1; UcAddress.SelectDropDownStep(company.PROVINCE_CODE, company.AREA_CODE, company.TUMBON_CODE); UcAddress.TextBoxPostCode.Text = company.ZIP_CODE; txtCompany.Text = new BLL.DataCenterBiz().GetCompanyNameById(company.COMP_CODE); UcAddress.DropdownParish.SelectedValue = company.TUMBON_CODE; if (company.STATUS != null) { Session["Status"] = company.STATUS.ToString(); //Set status after approve } if (company.STATUS != Convert.ToString((int)DTO.PersonDataStatus.WaitForApprove)) { MasterPage.ResultRegister = company.APPROVE_RESULT; } }
/// <summary> /// Get&Set Old Persoanl Data from AG_PERSONAL_T by ID_CARD_NO /// NT@13/2/2557 & Last Edited /// </summary> /// <param name="general"></param> private void GetPersonalDataToControl(DTO.Person general) { //ddlAgentType.ClearSelection(); ddlNationality.ClearSelection(); ddlEducation.ClearSelection(); Func <string, string> NationConvert = delegate(string input) { if ((input != null) && (input != "")) { input = "001"; } else { input = ""; } return(input); }; txtIDNumber.Text = general.ID_CARD_NO; //ddlTitle.SelectedValue = general.PRE_NAME_CODE; ddlTitle.SelectedValue = (general.PRE_NAME_CODE == null) ? "" : Convert.ToString(Convert.ToInt32(general.PRE_NAME_CODE)); txtFirstName.Text = general.NAMES; txtLastName.Text = general.LASTNAME; txtIDNumber.Text = general.ID_CARD_NO; txtBirthDay.Text = (general.BIRTH_DATE == null) ? "" : ((DateTime)general.BIRTH_DATE).ToString("dd/MM/yyyy"); rblSex.SelectedValue = general.SEX; ddlNationality.SelectedValue = NationConvert(general.NATIONALITY); ddlEducation.SelectedValue = general.EDUCATION_CODE; txtEmail.Text = general.EMAIL; txtTel.Text = LocalTelephoneNumberHelper.GetPhoneNumber(general.LOCAL_TELEPHONE); txtTelExt.Text = LocalTelephoneNumberHelper.GetExtenNumber(general.LOCAL_TELEPHONE); txtMobilePhone.Text = general.TELEPHONE; ucAddressCurrent.Address = general.ADDRESS_1; // txtCurrentAddress.Text; //AG_PERSONAL_T.AREA_CODE = PROVINCECODE(2)+AMPURCODE(2)+TUMBON(4) if ((general.AREA_CODE != null) && (general.AREA_CODE != "")) { if (general.AREA_CODE.Length > 2) { string province = general.AREA_CODE.Substring(0, 2); string district = general.AREA_CODE.Substring(2, 2); string tumbon = general.AREA_CODE.Substring(4); ucAddressCurrent.SelectDropDownStep(province, district, tumbon); } else { string province = this.MasterPage.NullableString(general.PROVINCE_CODE); string district = this.MasterPage.NullableString(general.AREA_CODE); string tumbon = this.MasterPage.NullableString(general.TUMBON_CODE); ucAddressCurrent.SelectDropDownStep(province, district, tumbon); } } ucAddressCurrent.PostCode = general.ZIP_CODE; // txtPostcodeCurrentAddress.Text; ucAddressRegister.Address = general.LOCAL_ADDRESS1; // txtRegisterAddress.Text; //AG_PERSONAL_T.AREA_CODE = PROVINCECODE(2)+AMPURCODE(2)+TUMBON(4) if ((general.LOCAL_AREA_CODE != null) && (general.LOCAL_AREA_CODE != "")) { if (general.LOCAL_AREA_CODE.Length > 2) { string local_province = general.LOCAL_AREA_CODE.Substring(0, 2); string local_district = general.LOCAL_AREA_CODE.Substring(2, 2); string local_tumbon = general.LOCAL_AREA_CODE.Substring(4); ucAddressRegister.SelectDropDownStep(local_province, local_district, local_tumbon); } else { string local_province = this.MasterPage.NullableString(general.LOCAL_PROVINCE_CODE); string local_district = this.MasterPage.NullableString(general.LOCAL_AREA_CODE); string local_tumbon = this.MasterPage.NullableString(general.LOCAL_TUMBON_CODE); ucAddressRegister.SelectDropDownStep(local_province, local_district, local_tumbon); } } //ucAddressRegister.SelectDropDownStep(general.LOCAL_PROVINCE_CODE, general.LOCAL_AREA_CODE, general.LOCAL_TUMBON_CODE); ucAddressRegister.PostCode = general.LOCAL_ZIPCODE; // txtPostcodeRegisterAddress.Text; //if ((general.AGENT_TYPE != "") && (general.AGENT_TYPE != null)) //{ // ddlAgentType.SelectedValue = general.AGENT_TYPE; //} }
public int AddPerson(DTO.Person person) { var entity = this.mapper.Map <Person>(person); return(this.Add(entity).Id); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GetTitleName(); // แก้ไขข้อมูล (เจ้าหน้าที่ คปภ.) lblRegisterOfficer.Text = "แก้ไขข้อมูลผู้ใช้ระบบ (" + GetMemberTypeOIC(UserProfile.MemberType.ToString()).Name + ")"; using (BLL.PersonBiz biz = new BLL.PersonBiz()) { var res = biz.GetById(UserProfile.Id); if (res.DataResponse != null) { DTO.Person person = res.DataResponse; txtOICUserName.Text = UserProfile.OIC_User_Id; txtIDNumber.Text = UserProfile.OIC_EMP_NO; txtMemberType.Text = GetMemberTypeOIC(UserProfile.MemberType.ToString()).Name; ddlAntecedent.SelectedValue = person.PRE_NAME_CODE; txtFirstName.Text = person.NAMES; txtLastName.Text = person.LASTNAME; rblSex.SelectedValue = person.SEX; if (Request.QueryString["Mode"] != null) { String mode = Request.QueryString["Mode"].Trim(); if (mode == "V") { lblRegisterOfficer.Text = "ข้อมูลผู้ใช้ระบบ (" + GetMemberTypeOIC(UserProfile.MemberType.ToString()).Name + ")"; txtOICUserName.Enabled = false; txtIDNumber.Enabled = false; txtMemberType.Enabled = false; ddlAntecedent.Enabled = false; txtFirstName.Enabled = false; txtLastName.Enabled = false; rblSex.Enabled = false; btnSubmit.Visible = false; btnCancel.Visible = false; FileSign.Visible = false; lblDescription.Visible = false; if (person.MEMBER_TYPE == "5") { lblSign.Visible = true; //if (person.IMG_SIGN != null) //{ string base64String = biz.GetOicPersonSignImg(person.ID).DataResponse.Signture; // Convert.ToBase64String(person.IMG_SIGN, 0, person.IMG_SIGN.Length); if (!String.IsNullOrEmpty(base64String)) { ImgSign.ImageUrl = "data:image/png;base64," + base64String; } //} } else { lblSign.Visible = false; ImgSign.Visible = false; } } } else { if (person.MEMBER_TYPE == "5") { lblSign.Visible = true; ImgSign.Visible = false; FileSign.Visible = true; lblDescription.Visible = true; } else { ImgSign.Visible = false; FileSign.Visible = false; lblSign.Visible = false; lblDescription.Visible = false; } } } } } }
private DTO.Person[] MakeOrderDTOArray(IList persons) { if(persons == null) return null; DTO.Person[] dtos = new DTO.Person[persons.Count]; IEnumerator personsEnum = persons.GetEnumerator(); for(int i = 0; i < persons.Count; i++) { personsEnum.MoveNext(); dtos[i] = DTO.DTOAssembler.AssemblePerson((DomainModel.Person)personsEnum.Current); } return dtos; }