private void LoadGrid() { try { var parents = Business.GetPersonStructureDefineChildBusiness().GetAll().Where(r => r.Type == Common.Constants.CodeTitle.PersonPrimeryGroup); var children = Business.GetPersonStructureDefineChildBusiness().GetAll().Where(r => r.Type == Common.Constants.CodeTitle.PersonSecendryGroup); var jresult = parents.GroupJoin(children, Parent => Parent.ID, Child => Child.Parent_ID, (Parent, Children) => new { Id = Parent.ID, ParentName = Parent.Name, Children = Children.DefaultIfEmpty() }) .SelectMany( x => x.Children.Select( Child => new { Id = Child.ID == null ? Guid.Empty : Child.ID, ParentName = x.ParentName, ChildName = Child == null ? "" : Child.Name, ChildCode = Child == null ? "" : Child.Code })).ToList(); ListCollectionView data = new ListCollectionView(jresult); data.GroupDescriptions.Add(new PropertyGroupDescription("ParentName")); grdLoanInsurance.ItemsSource = data; } catch { throw; } }
private void GridLoadDetail_Click(object sender, RoutedEventArgs e) { if (grdLoanInsurance.SelectedValue == null) { //throw new Exception(Localize.ex_no_record_selected); throw new Exception(); } Guid ID = (grdLoanInsurance.SelectedValue as dynamic).Id; var EditedItem = Business.GetPersonStructureDefineChildBusiness().GetByID(ID).FirstOrDefault(); new PersonStructureDefineChild(EditedItem).ShowDialog(); LoadGrid(); }
private void FormClose() { if (LabelList.Count < 2) { return; } var first = LabelList.AsQueryable().First(); var last = LabelList.AsQueryable().Last(); if (first.name.Equals(last.name)) { MessageBox.Show("گروه فرعی را انتخاب کنید"); return; } Name = string.Format("{0}/{1}", first.name, last.name); ID = last.ID; Code = Business.GetPersonStructureDefineChildBusiness().GetCode(Constants.CodeTitle.PersonIDGroup, last.code); this.Close(); }
public void SaveWithID(Data.PersonStructureDefine _personStructureDefine) { try { Guid i = Business.GetPersonStructureDefineChildBusiness().GetAll().Where(r => r.ID == _personStructureDefine.ID).Select(r => r.ID).FirstOrDefault(); if (i == Guid.Empty) { this.Insert(_personStructureDefine); } else { this.SubmitChanges(); } } catch { throw; } }
private void GridDelete_Click(object sender, RoutedEventArgs e) { if (grdLoanInsurance.SelectedValue == null) { //throw new Exception(Localize.ex_no_record_selected); throw new Exception(); } //var msgResult = MessageBox.Show(Localize.DeleteRecordMessage, Localize.DeleteRecordCaption, MessageBoxButton.YesNo, MessageBoxImage.Question); var msgResult = MessageBox.Show("error", "delete", MessageBoxButton.YesNoCancel); if (msgResult != MessageBoxResult.Yes) { return; } Guid ID = (grdLoanInsurance.SelectedValue as dynamic).Id; var DeletedItem = Business.GetPersonStructureDefineChildBusiness().GetByID(ID).FirstOrDefault(); Business.GetPersonStructureDefineChildBusiness().Delete(DeletedItem); LoadGrid(); }
private void commitchange(PayrollPerson payrollPerson) { payrollPerson.PFristName = txtFirstName.Text; payrollPerson.PLastName = txtLastName.Text; payrollPerson.PFather = txtFather.Text; payrollPerson.PSex = cmbGender.SelectedValue.ToGUID(); payrollPerson.PIdNational = txtNationalCode.Text; payrollPerson.PSHSH = txtSHSH.Text; payrollPerson.PMarriage = cmbMarriageState.SelectedValue.ToGUID(); payrollPerson.PNumberChild = txtQTY.Text.ToInt(); payrollPerson.PPhoneWork = txtTelWork.Text; payrollPerson.PPhoneHome = txtTelHome.Text; payrollPerson.PMobile = txtMobile.Text; payrollPerson.PIdPostal = txtPostalCode.Text; payrollPerson.PBrithDate = pdcBirthDay.Text; payrollPerson.PAddress = txtAddress.Text; payrollPerson.PDescription = txtDesc.Text; payrollPerson.Tax_madrak = (int)cmbProofTax.SelectedValue; payrollPerson.Tax_onvanShoghl = (int)cmbJobTax.SelectedValue; payrollPerson.Tax_serishenasnameh = (int)cmbSeriesTax.SelectedValue; payrollPerson.Tax_vazmaskan = (int)cmbHouseStateTax.SelectedValue; payrollPerson.Tax_meliat = (int)cmbNationalityTax.SelectedValue; payrollPerson.Tax_namekeshvar = (int)cmbCountryTax.SelectedValue; payrollPerson.Tax_nezamvazifeh = cmbMilitaryTax.SelectedValue.ToGUID(); payrollPerson.Tax_rasteshoghli = (int)cmbJobCategoriesTax.SelectedValue; payrollPerson.Tax_vazmashin = (int)cmbCarStateTax.SelectedValue; payrollPerson.code_moafiat_maliat = (int)cmbLoanInsurance.SelectedValue; payrollPerson.Insurance_keshvar = (int)cmbCountryInsurance.SelectedValue; payrollPerson.Insurance_shahr = (int)cmbPlaceOfIssue.SelectedValue; payrollPerson.Insurance_mashagel = cmbJobsInsurance.SelectedValue.ToString(); payrollPerson.Insurance_tahsilat = (int)cmbEducationInsurance.SelectedValue; payrollPerson.Insurance_reshteh = (int)cmbFieldOfStudyInsurance.SelectedValue; payrollPerson.Insurance_meliat = cmbNationalityInsurance.SelectedValue.ToString(); payrollPerson.code_moafiat_bimeh = (int)cmbExemptionTax.SelectedValue; payrollPerson.PPerson_Code = string.Format("{0}{1}", txtCodeF.Text, txtCodeS.Text); string pname = string.Format("{0} {1}", txtFirstName.Text, txtLastName.Text); Data.PersonStructureDefine _personDefine = Business.GetPersonStructureDefineChildBusiness().GetStructure(Constants.CodeTitle.PersonIDGroup, pname, PersonParentID, payrollPerson.PPerson_Code); payrollPerson.PPerson_Code = _personDefine.Code; int Primerycodelen = (int)Business.GetCodeTitleBusiness().GetById(Constants.CodeTitle.PersonPrimeryGroup).CodeLen; int Secendarycodelen = (int)Business.GetCodeTitleBusiness().GetById(Constants.CodeTitle.PersonPrimeryGroup).CodeLen; string s = Business.GetPersonStructureDefineBusiness().GetMaxCode(PersonCode).Select(r => r.Code).FirstOrDefault(); _personDefine.Type = Constants.CodeTitle.PersonIDGroup; using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted, Timeout = new TimeSpan(2, 0, 0) })) { Business.GetPersonStructureDefineChildBusiness().SaveWithID(_personDefine); payrollPerson.PersonStructerID = _personDefine.ID; Business.GetPayrollPersonBusiness().Save(payrollPerson); Business.GetPayrollPersonWorkDoneBusiness().Save(new PayrollPersonWorkDone() { IDPayrollPerson = payrollPerson.id }); scope.Complete(); } this.Close(); }