private void edit_Click(object sender, RoutedEventArgs e) { MyMenuItem SelectedItem; AccountingTafsilStructureDefine ChangableItem; AccountingTafsilStructureDefine Child; GetSelected(sender, out SelectedItem, out ChangableItem, out Child); Tarife_hesabe_tafsili structure = new Tarife_hesabe_tafsili(ChangableItem); try { if (SelectedItem == null) { throw new Exception(Localize.ex_no_record_selected); } if (ChangableItem.Type == FristLevel) { setDisableSecenderyItem(structure); structure.txtPrimeryGroupCode.Text = ChangableItem.Code; structure.txtPrimeryGroupName.Text = ChangableItem.Name; if (Child != null) { structure.txtPrimeryGroupCode.IsEnabled = false; } } else if (ChangableItem.Type == SecondLevel) { setDisablePrimeryItem(structure); structure.txtSecenderyGroupCode.Text = ChangableItem.Code.Substring(structure.codeTitleLen); structure.txtSecenderyGroupName.Text = ChangableItem.Name; var parent = Business.GetTafsilStructureDefineBusiness().GetParent(ChangableItem); structure.txtPrimeryGroupCode.Text = parent.Code; structure.txtPrimeryGroupName.Text = parent.Name; if (Child != null) { structure.txtSecenderyGroupCode.IsEnabled = false; } } structure.DisableEvent(); structure.ShowDialog(); SelectedItem.ID = structure.EditedItem.ID; SelectedItem.Name = structure.EditedItem.Name; SelectedItem.Code = structure.EditedItem.Code; } catch (Exception ex) { AccountingKernel.Forms.Base.BaseWindow.ShowError(ex); } trvMenu.Items.Refresh(); }
private void btn_tarife_hesabe_tafsili_Click_1(object sender, RoutedEventArgs e) { /* string ID = Class.Variable.Variables.ID_for_tarife_hesabe_tafsili; * string getID = ID; * AccountingKernel.Forms.SotoheTafsili.frm_taien_sotohe_tafsili frm_sathe_tafsili = new * Forms.SotoheTafsili.frm_taien_sotohe_tafsili(); * * if (ID != "") * { * AccountingKernel.Forms.SotoheTafsili.get_set_moien_id_tafsili.moien_id_ = ID; * AccountingKernel.Class.Variable.Variables.idAccountingMoien = ID; * frm_sathe_tafsili.ShowDialog(); * this.InvalidateVisual(); * * } * else * { * MessageBox.Show("معینی انتخاب نشده است", "خطا", MessageBoxButton.OK, MessageBoxImage.Warning); * } */ Forms.SotoheTafsili.Tarife_hesabe_tafsili tst = new Forms.SotoheTafsili.Tarife_hesabe_tafsili(); tst.ShowDialog(); }
private void new_Click(object sender, RoutedEventArgs e) { MyMenuItem SelectedItem; AccountingTafsilStructureDefine ChangableItem; AccountingTafsilStructureDefine Child; Tarife_hesabe_tafsili structure = new Tarife_hesabe_tafsili(); GetSelected(sender, out SelectedItem, out ChangableItem, out Child); if (SelectedItem == null) { Tarife_hesabe_tafsili tafsil = new Tarife_hesabe_tafsili(); tafsil.ShowDialog(); if (tafsil.EntityPrimery != null) { menuItems.Add(new MyMenuItem() { ID = tafsil.EntityPrimery.ID, Code = tafsil.EntityPrimery.Code, Name = tafsil.EntityPrimery.Name, Type = Constants.CodeTitle.TafsilGroup }); } if (tafsil.EntitySecondery != null) { menuItems.Find(r => r.ID == tafsil.EntityPrimery.ID). Items.Add(new MyMenuItem() { ID = tafsil.EntitySecondery.ID, Code = tafsil.EntitySecondery.Code, Name = tafsil.EntitySecondery.Name, Type = Constants.CodeTitle.AccountGroup }); } trvMenu.Items.Refresh(); return; } if (ChangableItem.Type == SecondLevel) { var ChangableItemParent = Business.GetTafsilStructureDefineBusiness().GetParent(ChangableItem); setDisablePrimeryItem(structure); structure.txtPrimeryGroupCode.Text = ChangableItemParent.Code; structure.txtPrimeryGroupName.Text = ChangableItemParent.Name; structure.CallPrimeryLostFocus(); } structure.ShowDialog(); if (SelectedItem.Type == Constants.CodeTitle.TafsilGroup && structure.EntityPrimery != null) { SelectedItem = new MyMenuItem() { Code = structure.EntityPrimery.Code, ID = structure.EntityPrimery.ID, Name = structure.EntityPrimery.Name, Type = Constants.CodeTitle.TafsilGroup }; menuItems.Add(SelectedItem); } if (SelectedItem.Type == Constants.CodeTitle.TafsilGroup && structure.EntitySecondery != null) { AccountingTafsilStructureDefine ChangableItemParent = Business.GetTafsilStructureDefineBusiness().GetParent(structure.EntitySecondery); MyMenuItem item = menuItems.Find(r => r.ID == ChangableItemParent.ID); item.Items.Add(new MyMenuItem() { Code = structure.EntitySecondery.Code, ID = structure.EntitySecondery.ID, Name = structure.EntitySecondery.Name, Type = Constants.CodeTitle.AccountGroup }); } if (SelectedItem.Type == Common.Constants.CodeTitle.AccountGroup && structure.EntitySecondery != null) { AccountingTafsilStructureDefine ChangableItemParent = Business.GetTafsilStructureDefineBusiness().GetParent(ChangableItem); MyMenuItem item = menuItems.Find(r => r.ID == ChangableItemParent.ID); item.Items.Add(new MyMenuItem() { Code = structure.EntitySecondery.Code, ID = structure.EntitySecondery.ID, Name = structure.EntitySecondery.Name, Type = Constants.CodeTitle.AccountGroup }); } trvMenu.Items.Refresh(); }
private static void setDisablePrimeryItem(Tarife_hesabe_tafsili structure) { structure.txtPrimeryGroupCode.IsEnabled = false; structure.txtPrimeryGroupName.IsEnabled = false; }