Ejemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string langDictPath = "";

            switch ((sender as MenuItem).Name)
            {
            case "sh1":
                langDictPath = "Shemes/BureauBlack.xaml";
                break;

            case "sh2":
                langDictPath = "Shemes/BureauBlue.xaml";
                break;

            case "sh3":
                langDictPath = "Shemes/ExpressionDark.xaml";
                break;

            case "sh4":
                langDictPath = "Shemes/ExpressionLight.xaml";
                break;

            case "sh5":
                langDictPath = "Shemes/ShinyBlue.xaml";
                break;

            case "sh6":
                langDictPath = "Shemes/ShinyRed.xaml";
                break;

            case "sh7":
                langDictPath = "Shemes/WhistlerBlue.xaml";
                break;

            case "sh8":
                langDictPath = "Shemes/MainShema.xaml";
                break;
            }
            ConfigTempoSinglenton currentconfig = ConfigTempoSinglenton.GetInstance();

            currentconfig.Shema = (sender as MenuItem).Name;
            currentconfig.SaveConfiguration();
            Application.Current.Resources.MergedDictionaries.Clear();
            if (!String.IsNullOrEmpty(langDictPath))
            {
                Uri langDictUri             = new Uri(langDictPath, UriKind.Relative);
                ResourceDictionary langDict = Application.LoadComponent(langDictUri) as ResourceDictionary;
                Application.Current.Resources.MergedDictionaries.Add(langDict);
            }
        }
Ejemplo n.º 2
0
        private void Button_ClickChange(object sender, RoutedEventArgs e)
        {
            ConfigTempoSinglenton currentconfig = ConfigTempoSinglenton.GetInstance();

            switch ((sender as Button).Tag.ToString())
            {
            case "firm":
                SelectFirm sf = new SelectFirm();
                sf.ShowDialog();
                if (sf.DialogResult.HasValue && sf.DialogResult.Value)
                {
                    vm.ChangeConfigValue(0, sf.CurrentFirma.Name, sf.CurrentFirma.Bulstad);
                    currentconfig.CurrentFirma = sf.CurrentFirma.Clone();
                    currentconfig.SaveConfiguration();
                    //confi.DataContext = vm.ConfigParams;
                    //AccountsViewModel avm = new AccountsViewModel();
                    //AccountView.DataContext = avm;
                }
                break;

            case "data":
                DataSelector ds = new DataSelector(currentconfig.WorkDate);
                ds.ShowDialog();
                if (ds.DialogResult.HasValue && ds.DialogResult.Value)
                {
                    currentconfig.WorkDate = ds.SelectedDate;
                    vm.ChangeConfigValue(1, ds.SelectedDate.ToShortDateString(), "Днес " + DateTime.Now.ToShortDateString());
                    currentconfig.SaveConfiguration();
                    //confi.DataContext = vm.ConfigParams;
                }
                break;

            case "user":
                //select user
                break;
            }
        }
Ejemplo n.º 3
0
        public MainViewModel()
        {
            ConfigTempoSinglenton currentconfig = ConfigTempoSinglenton.GetInstance();

            ConfigParams = new ObservableCollection <ConfigParamModel>();
            _firmaname   = currentconfig.CurrentFirma.Name;
            _dn          = currentconfig.CurrentFirma.DDSnum;
            _bulstad     = currentconfig.CurrentFirma.Bulstad;
            _regdds      = currentconfig.CurrentFirma.RegisterDds ? "Регистрирана по ДДС" : "Нерегистрирана по ДДС";
            ConfigParams.Add(new ConfigParamModel {
                Changer = "firm", Description = currentconfig.CurrentFirma.Bulstad, Name = "Фирма", Value = currentconfig.CurrentFirma.Name
            });
            _workdate = currentconfig.WorkDate.ToLongDateString();
            if (currentconfig.Holdings != null)
            {
                if (currentconfig.Holdings.Count > currentconfig.ActiveHolding - 1)
                {
                    _holding = currentconfig.Holdings[currentconfig.ActiveHolding - 1].Name;
                }
            }
            ConfigParams.Add(new ConfigParamModel {
                Changer = "data", Description = "Днес " + DateTime.Now.ToShortDateString(), Name = "Работна дата", Value = currentconfig.WorkDate.ToShortDateString()
            });
            if (currentconfig.Periods.FirstOrDefault(e1 => e1.Fr <= currentconfig.WorkDate && e1.To >= currentconfig.WorkDate && e1.Firma == currentconfig.ActiveFirma && e1.Holding == currentconfig.ActiveHolding) != null)
            {
                DataSelector ds = new DataSelector(currentconfig.WorkDate, "Избери работна дата");
                ds.ShowDialog();
                if (ds.DialogResult.HasValue && ds.DialogResult.Value)
                {
                    currentconfig.WorkDate = ds.SelectedDate;
                    WorkDate = ds.SelectedDate.ToLongDateString();
                    currentconfig.SaveConfiguration();
                    //confi.DataContext = vm.ConfigParams;
                }
            }
        }
Ejemplo n.º 4
0
 protected override void  Save()
 {
     if (this.CanSave())
     {
         //FirmModel transport = CurrentFirma.Clone();
         CurrentFirma.City  = CityItem.LiD;
         CurrentFirma.City1 = CityItem1.LiD;
         if (Mode == EditMode.Add)
         {
             if (Context.Save <FirmModel>(CurrentFirma, true))
             {
                 _AllFirms.Add(new FirmModelWraper(CurrentFirma));
                 ConfigTempoSinglenton currentconfig = ConfigTempoSinglenton.GetInstance();
                 foreach (var item in currentconfig.ConfigNames)
                 {
                     var spliter = item.Split('|');
                     FirmSettingModel newsett = new FirmSettingModel();
                     newsett.Key = spliter[0];
                     if (spliter.Length > 0)
                     {
                         newsett.Name = spliter[1];
                     }
                     if (spliter.Length > 1)
                     {
                         newsett.Value = spliter[2];
                     }
                     newsett.FirmaId   = CurrentFirma.Id;
                     newsett.HoldingId = currentconfig.ActiveHolding;
                     currentconfig.FirmSettings.Add(newsett);
                 }
                 if (CurrentFirma.Id == currentconfig.CurrentFirma.Id)
                 {
                     currentconfig.CurrentFirma = CurrentFirma.Clone();
                 }
                 currentconfig.SaveConfiguration();
                 base.Save();
             }
             else
             {
                 MessageBoxWrapper.Show("Грешка при запис");
             }
         }
         else
         {
             if (!Context.Save <FirmModel>(CurrentFirma, false))
             {
                 MessageBoxWrapper.Show("Грешка при запис");
             }
             else
             {
                 if (CurrentFirmaWraper != null)
                 {
                     CurrentFirmaWraper.CurrentFirma = CurrentFirma;
                 }
                 ConfigTempoSinglenton currentconfig = ConfigTempoSinglenton.GetInstance();
                 if (CurrentFirma.Id == currentconfig.CurrentFirma.Id)
                 {
                     currentconfig.CurrentFirma = CurrentFirma.Clone();
                     currentconfig.SaveConfiguration();
                 }
                 OnPropertyChanged("CurrentFirmaWraper");
                 base.Save();
             }
         }
     }
     else
     {
         MessageBoxWrapper.Show("Невалидни данни! Моля проверете данните маркирани с червено!");
     }
 }