private void GetTaxpayer(string tin) { Session[DataObjectName] = context.ITaxpayers.Where(t => t.TIN == tin).Single(); TaxpayerForm.DataSource = Session[DataObjectName]; TaxpayerForm.DataBind(); taxpayer = (ITaxpayer)Session[DataObjectName]; BirthLgaCombo_Callback(new object(), new CallbackEventArgsBase(taxpayer.BirthStateId)); OriginLgaCombo_Callback(new object(), new CallbackEventArgsBase(taxpayer.OriginStateId)); }
private void SaveRecord() { try { string tin = (string)TaxpayerForm.GetNestedControlValueByFieldName("TIN"); taxpayer = context.ITaxpayers.Single(t => t.TIN == tin); taxpayer.BVN = (string)TaxpayerForm.GetNestedControlValueByFieldName("BVN"); taxpayer.JTBTIN = (string)TaxpayerForm.GetNestedControlValueByFieldName("JTBTIN"); taxpayer.FIRSTIN = (string)TaxpayerForm.GetNestedControlValueByFieldName("FIRSTIN"); taxpayer.NIN = (string)TaxpayerForm.GetNestedControlValueByFieldName("NIN"); taxpayer.StateTIN = (string)TaxpayerForm.GetNestedControlValueByFieldName("StateTIN"); taxpayer.LastName = (string)TaxpayerForm.GetNestedControlValueByFieldName("LastName"); taxpayer.FirstName = (string)TaxpayerForm.GetNestedControlValueByFieldName("FirstName"); taxpayer.MiddleName = (string)TaxpayerForm.GetNestedControlValueByFieldName("MiddleName"); taxpayer.MaidenName = (string)TaxpayerForm.GetNestedControlValueByFieldName("MaidenName"); taxpayer.PreviousFirstName = (string)TaxpayerForm.GetNestedControlValueByFieldName("PreviousFirstName"); taxpayer.PreviousLastName = (string)TaxpayerForm.GetNestedControlValueByFieldName("PreviousLastName"); taxpayer.PreviousMiddleName = (string)TaxpayerForm.GetNestedControlValueByFieldName("PreviousMiddleName"); taxpayer.Height = (decimal?)TaxpayerForm.GetNestedControlValueByFieldName("Height"); taxpayer.SpouseNIN = (String)TaxpayerForm.GetNestedControlValueByFieldName("SpouseNIN"); taxpayer.Gender = (string)TaxpayerForm.GetNestedControlValueByFieldName("Gender"); taxpayer.MaritalStatus = (string)TaxpayerForm.GetNestedControlValueByFieldName("MaritalStatus"); taxpayer.Religion = (string)TaxpayerForm.GetNestedControlValueByFieldName("Religion"); taxpayer.BirthDate = (DateTime)TaxpayerForm.GetNestedControlValueByFieldName("BirthDate"); taxpayer.BirthStateId = (String)TaxpayerForm.GetNestedControlValueByFieldName("BirthStateId"); taxpayer.BirthCity = (String)TaxpayerForm.GetNestedControlValueByFieldName("BirthCity"); taxpayer.BirthLgaId = (int?)TaxpayerForm.GetNestedControlValueByFieldName("BirthLgaId"); taxpayer.BirthCountryId = (int?)TaxpayerForm.GetNestedControlValueByFieldName("BirthCountryId"); taxpayer.NationalityId = (int?)TaxpayerForm.GetNestedControlValueByFieldName("NationalityId"); taxpayer.OriginStateId = (string)TaxpayerForm.GetNestedControlValueByFieldName("OriginStateId"); taxpayer.OriginLgaId = (int?)TaxpayerForm.GetNestedControlValueByFieldName("OriginLgaId"); taxpayer.Phone1 = (string)TaxpayerForm.GetNestedControlValueByFieldName("Phone1"); taxpayer.Phone2 = (string)TaxpayerForm.GetNestedControlValueByFieldName("Phone2"); taxpayer.Email = (string)TaxpayerForm.GetNestedControlValueByFieldName("Email"); taxpayer.Website = (string)TaxpayerForm.GetNestedControlValueByFieldName("Website"); taxpayer.Employer = (string)TaxpayerForm.GetNestedControlValueByFieldName("Employer"); taxpayer.Profession = (string)TaxpayerForm.GetNestedControlValueByFieldName("Profession"); taxpayer.EmploymentId = (string)TaxpayerForm.GetNestedControlValueByFieldName("EmploymentId"); taxpayer.EmploymentStatus = (string)TaxpayerForm.GetNestedControlValueByFieldName("EmploymentStatus"); taxpayer.HighestEducation = (string)TaxpayerForm.GetNestedControlValueByFieldName("HighestEducation"); taxpayer.IdentificationType = (string)TaxpayerForm.GetNestedControlValueByFieldName("IdentificationType"); taxpayer.IdentificationNumber = (string)TaxpayerForm.GetNestedControlValueByFieldName("IdentificationNumber"); taxpayer.EmploymentStatus = (string)TaxpayerForm.GetNestedControlValueByFieldName("EmploymentStatus"); taxpayer.TaxOfficeId = (string)TaxpayerForm.GetNestedControlValueByFieldName("TaxOfficeId"); ValidateRecord(taxpayer); context.SaveChanges(); DisplayAlert("Success", "Individual Taxpayer", "Taxpayer successfully saved"); } catch (Exception ex) { DisplayAlert("Danger", "Individual Taxpayer", ex.Message); } }