private void btnSubmit_Click(object sender, RoutedEventArgs e) { var _payrollPerson = new Data.PayrollPerson(); if (entityId != Guid.Empty) { _payrollPerson = Business.GetPayrollPersonBusiness().GetById(entityId); } if (FormIsValid() && PersonCode != null) { commitchange(_payrollPerson); } }
public void Delete(Data.PayrollPerson entity) { try { if (entity == null) { return; } this.Table.Remove(entity); this.SubmitChanges(); } catch { throw; } }
private void FormLoad(Data.PayrollPerson myData) { try { PrimeryLen = (int)Business.GetCodeTitleBusiness().GetById(Constants.CodeTitle.PersonPrimeryGroup).CodeLen; SecenderyLen = (int)Business.GetCodeTitleBusiness().GetById(Constants.CodeTitle.PersonSecendryGroup).CodeLen; PersonLen = (int)Business.GetCodeTitleBusiness().GetById(Constants.CodeTitle.PersonIDGroup).CodeLen; txtCodeS.MaxLength = PersonLen; var baseInfos = Business.GetBaseInfoBusiness().GetAll().Select(r => new { Id = r.Id, Name = r.AssignName, PId = r.PID }).ToList(); var payrolltaxCodeenum = Business.GetPayrollTaxCodeBusiness().GetAll().Select(r => new { MId = r.MCode, Id = r.SCode, Name = r.SDesc }).OrderBy(r => r.MId).ToList(); var payrollInsuranceCodeenum = Business.GetPayrollInsuranceCodeBusiness().GetAll().Select(r => new { MId = r.MCode, Id = r.SCode, Name = r.SDesc }).OrderBy(r => r.MId).ToList(); cmbGender.ItemsSource = baseInfos.FindAll(r => r.PId == Constants.BaseInfoType.Gender); cmbMarriageState.ItemsSource = baseInfos.FindAll(r => r.PId == Constants.BaseInfoType.MarriageState); cmbProofTax.ItemsSource = payrolltaxCodeenum.FindAll(r => r.MId == (int)PayrollTaxCodeEnum.Education); cmbJobTax.ItemsSource = payrolltaxCodeenum.FindAll(r => r.MId == (int)PayrollTaxCodeEnum.Job); cmbSeriesTax.ItemsSource = payrolltaxCodeenum.FindAll(r => r.MId == (int)PayrollTaxCodeEnum.SHSHSeries); cmbHouseStateTax.ItemsSource = payrolltaxCodeenum.FindAll(r => r.MId == (int)PayrollTaxCodeEnum.HouseState); cmbNationalityTax.ItemsSource = payrolltaxCodeenum.FindAll(r => r.MId == (int)PayrollTaxCodeEnum.Nationality); cmbCountryTax.ItemsSource = payrolltaxCodeenum.FindAll(r => r.MId == (int)PayrollTaxCodeEnum.Country); cmbMilitaryTax.ItemsSource = baseInfos.FindAll(r => r.PId == Constants.BaseInfoType.MilitaryStatus); cmbJobCategoriesTax.ItemsSource = payrolltaxCodeenum.FindAll(r => r.MId == (int)PayrollTaxCodeEnum.JobCategories); cmbCarStateTax.ItemsSource = payrolltaxCodeenum.FindAll(r => r.MId == (int)PayrollTaxCodeEnum.CarState); cmbFieldOfStudyInsurance.ItemsSource = payrollInsuranceCodeenum.FindAll(r => r.MId == (int)PayrollInsuranceCodeEnum.FieldOfStudy); cmbNationalityInsurance.ItemsSource = payrollInsuranceCodeenum.FindAll(r => r.MId == (int)PayrollInsuranceCodeEnum.Nationality); cmbEducationInsurance.ItemsSource = payrollInsuranceCodeenum.FindAll(r => r.MId == (int)PayrollInsuranceCodeEnum.Education); cmbJobsInsurance.ItemsSource = payrollInsuranceCodeenum.FindAll(r => r.MId == (int)PayrollInsuranceCodeEnum.Jobs); cmbPlaceOfIssue.ItemsSource = payrollInsuranceCodeenum.FindAll(r => r.MId == (int)PayrollInsuranceCodeEnum.PlaceOfIssue); cmbCountryInsurance.ItemsSource = payrollInsuranceCodeenum.FindAll(r => r.MId == (int)PayrollInsuranceCodeEnum.Country); cmbExemptionTax.ItemsSource = Business.GetLoanTaxBusiness().GetAll().Select(r => new { Name = r.name_moafiat, Id = r.kod_moafiat }).ToList(); cmbLoanInsurance.ItemsSource = Business.GetLoanInsuranceBusiness().GetAll().Select(r => new { Name = r.name_moafiat, Id = r.kod_moafiat }).ToList(); if (myData == null) { return; } entityId = myData.id; txtCodeF.Text = myData.PPerson_Code.Substring(0, 6); txtFirstName.Text = myData.PFristName; txtLastName.Text = myData.PLastName; txtFather.Text = myData.PFather; cmbGender.SelectedValue = myData.PSex; txtNationalCode.Text = myData.PIdNational; txtSHSH.Text = myData.PSHSH; cmbMarriageState.SelectedValue = myData.PMarriage; txtQTY.Text = myData.PNumberChild.ToString(); txtTelWork.Text = myData.PPhoneWork; txtTelHome.Text = myData.PPhoneHome; txtMobile.Text = myData.PMobile; txtPostalCode.Text = myData.PIdPostal; pdcBirthDay.Text = myData.PBrithDate; txtAddress.Text = myData.PAddress; txtTelWork.Text = myData.PDescription; //imgPerson.StreamSource =myData.PImage; ////imgPerson.Source = myData.PImage ////pic //FileStream fs = new FileStream(myData.PImage); ////byte[] data = new byte[fs.Length]; ////fs.Read(data, 0, System.Convert.ToInt32(fs.Length)); ////fs.Close(); cmbProofTax.SelectedValue = myData.Tax_madrak; txtProofTax.Text = myData.Tax_madrak == null ? string.Empty : myData.Tax_madrak.Value.ToString(); cmbJobTax.SelectedValue = myData.Tax_onvanShoghl; txtJobTax.Text = myData.Tax_onvanShoghl == null ? string.Empty : myData.Tax_onvanShoghl.Value.ToString(); cmbSeriesTax.SelectedValue = myData.Tax_serishenasnameh; txtSeriesTax.Text = myData.Tax_serishenasnameh == null ? string.Empty : myData.Tax_serishenasnameh.Value.ToString(); cmbHouseStateTax.SelectedValue = myData.Tax_vazmaskan; txtHouseStateTax.Text = myData.Tax_vazmaskan == null ? string.Empty : myData.Tax_vazmaskan.Value.ToString(); cmbNationalityTax.SelectedValue = myData.Tax_meliat; txtNationalityTax.Text = myData.Tax_meliat == null ? string.Empty : myData.Tax_meliat.Value.ToString(); cmbCountryTax.SelectedValue = myData.Tax_namekeshvar; txtCountryTax.Text = myData.Tax_namekeshvar == null ? string.Empty : myData.Tax_namekeshvar.Value.ToString(); cmbMilitaryTax.SelectedValue = myData.Tax_nezamvazifeh; cmbJobCategoriesTax.SelectedValue = myData.Tax_rasteshoghli; txtJobCategoriesTax.Text = myData.Tax_rasteshoghli == null ? string.Empty : myData.Tax_rasteshoghli.Value.ToString(); cmbExemptionTax.SelectedValue = myData.code_moafiat_maliat; txtExemptionTax.Text = myData.code_moafiat_maliat == null ? string.Empty : myData.code_moafiat_maliat.Value.ToString(); cmbCarStateTax.SelectedValue = myData.Tax_vazmashin; txtCarStateTax.Text = myData.Tax_vazmashin == null ? string.Empty : myData.Tax_vazmashin.Value.ToString(); cmbLoanInsurance.SelectedValue = myData.code_moafiat_bimeh; txtLoanInsurance.Text = myData.code_moafiat_bimeh == null ? string.Empty : myData.code_moafiat_bimeh.ToString(); cmbCountryInsurance.SelectedValue = myData.Insurance_keshvar; txtCountryInsurance.Text = myData.Insurance_keshvar == null ? string.Empty : myData.Insurance_keshvar.Value.ToString(); cmbPlaceOfIssue.SelectedValue = myData.Insurance_shahr; txtPlaceOfIssue.Text = myData.Insurance_shahr == null ? string.Empty : myData.Insurance_shahr.Value.ToString(); cmbJobsInsurance.SelectedValue = myData.Insurance_mashagel; txtJobsInsurance.Text = myData.Insurance_mashagel == null ? string.Empty : myData.Insurance_mashagel; cmbEducationInsurance.SelectedValue = myData.Insurance_tahsilat; txtEducationInsurance.Text = myData.Insurance_tahsilat == null ? string.Empty : myData.Insurance_tahsilat.ToString(); cmbFieldOfStudyInsurance.SelectedValue = myData.Insurance_reshteh; txtFieldOfStudyInsurance.Text = myData.Insurance_reshteh == null ? string.Empty : myData.Insurance_reshteh.ToString(); cmbNationalityInsurance.SelectedValue = myData.Insurance_meliat; txtNationalityInsurance.Text = myData.Insurance_meliat == null ? string.Empty : myData.Insurance_meliat.ToString(); } catch { throw; } }
public PersonInfoSubmitChild(Data.PayrollPerson MyData) { InitializeComponent(); FormLoad(MyData); }