private void LaunchCurrencyModif()
 {
     _currentActivity.CurrencyProject = CRE.GetCurrency(_tsm.Currencies.SelectedItem.Text);
     _currentActivity.Balance();
     RefreshPanel();
     SheetDisplayRequested?.Invoke(null);
 }
        private void LaunchNewProject()
        {
            Tsm.DisablePresentation();
            Tsm.EnableUserList();
            Tsm.EnableGOP();
            Tsm.EnableExpsList();
            Tsm.EnableReconciliation();

            _currentActivity             = new FinancialActivity(this.WORKING_DIRECTORY);
            _viewActivityDetail          = new ViewActivityDetail();
            _viewActivityDetail.Activity = _currentActivity;
            this.Activities.Add(_viewActivityDetail.Activity);
            this.CurrentActivity = _viewActivityDetail.Activity;
            _viewActivityDetail.ActivityDetailUpdated += _viewActivityDetail_ActivityDetailUpdated;

            _sheet.Controls.Clear();

            _viewActivityDetail.Top = TOP_OFFSET;
            _viewActivityDetail.RefreshData();
            _viewActivityDetail.Left = (_sheet.Width / 2) - (_viewActivityDetail.Width / 2);
            _viewActivityDetail.ChangeLanguage();

            _sheet.Controls.Add(_viewActivityDetail);

            //_tsm.UpdateProjectDetails(_currentActivity);
            //_tsm.EnableOptions();
            //RefreshPanel();
            SheetDisplayRequested?.Invoke(null);
        }
        private void LaunchAddDevise()
        {
            DeviseEdition de = new DeviseEdition(this);

            de.ShowDialog();
            Tsm.UpdateProjectDetails(_currentActivity);
            SheetDisplayRequested?.Invoke(null);
        }
 private void LaunchTakeBill()
 {
     using (CamGUI myCamGUi = new CamGUI())
     {
         if (myCamGUi.ShowDialog() == DialogResult.OK)
         {
             EditExps(myCamGUi.PicturePath);
         }
     }
     SheetDisplayRequested?.Invoke(null);
 }
        private void LaunchOpenProject()
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Financial files (*.fnc)|*.fnc|All files (*.*)|*.*";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                OpenProject(ofd.FileName);
            }
            LaunchViewWelcome();
            SheetDisplayRequested?.Invoke(null);
        }
 private void LaunchImport()
 {
     using (OpenFileDialog ofd = new OpenFileDialog())
     {
         if (ofd.ShowDialog() == DialogResult.OK)
         {
             CRE.ImportExps(ofd.FileName, this);
             _viewWelcome.RefreshData();
         }
     }
     SheetDisplayRequested?.Invoke(null);
 }
 private void LaunchExportPdf()
 {
     using (SaveFileDialog sfd = new SaveFileDialog())
     {
         sfd.FileName = "Export_" + _currentActivity.Name + ".pdf";
         sfd.Filter   = "PDF files (*.pdf)|*.pdf|All files (*.*)|*.*";
         if (sfd.ShowDialog() == DialogResult.OK)
         {
             _currentActivity.ExportPDF(sfd.FileName);
         }
     }
     SheetDisplayRequested?.Invoke(null);
 }
 private void LaunchChangeModif()
 {
     if (!string.IsNullOrEmpty(_tsm.Changes.SelectedItem.Text) && _tsm.Changes.SelectedItem.Text.Split(' ').Length > 2)
     {
         string cur1, cur2;
         cur1 = _tsm.Changes.SelectedItem.Text.Split(' ')[0];
         cur2 = _tsm.Changes.SelectedItem.Text.Split(' ')[2];
         foreach (Change chg in _currentActivity.Changes)
         {
             if (cur1.Equals(chg.Currency1) && cur2.Equals(chg.Currency2))
             {
                 _tsm.LoadChangeValue(chg.Rate);
                 break;
             }
         }
         SheetDisplayRequested?.Invoke(null);
     }
 }
        private void LaunchExportCsv()
        {
            string exportStr = _currentActivity.ExportCSV();

            using (SaveFileDialog sfd = new SaveFileDialog())
            {
                sfd.FileName = "Export_" + _currentActivity.Name + ".csv";
                sfd.Filter   = "CSV files (*.csv)|*.txt|All files (*.*)|*.*";
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    using (StreamWriter sw = new StreamWriter(sfd.FileName))
                    {
                        sw.Write(exportStr);
                        sw.Close();
                    }
                }
            }
            SheetDisplayRequested?.Invoke(null);
        }
        private void LaunchProjectUpdated()
        {
            DateTime dt = DateTime.MinValue;

            foreach (EntityFinancialDecorator user in _currentActivity.Entities)
            {
                foreach (var item in user.Calendars)
                {
                    if (item.Text.Equals(_currentActivity.Name))
                    {
                        item.Text = _tsm.ProjectName.TextBoxText;
                    }
                }
            }
            _currentActivity.Name = _tsm.ProjectName.TextBoxText;

            DateTime.TryParse(_tsm.ProjectStartDate.TextBoxText, out dt);
            if (dt != DateTime.MinValue)
            {
                _currentActivity.StartDate = dt;
            }
            else
            {
                _tsm.ProjectStartDate.TextBoxText = _currentActivity.StartDate.ToShortDateString();
            }
            dt = DateTime.MinValue;

            DateTime.TryParse(_tsm.ProjectEndDate.TextBoxText, out dt);
            if (dt != DateTime.MinValue)
            {
                _currentActivity.EndDate = dt;
            }
            else
            {
                _tsm.ProjectEndDate.TextBoxText = _currentActivity.EndDate.ToShortDateString();
            }
            dt = DateTime.MinValue;
            SheetDisplayRequested?.Invoke(null);
        }
 private void LaunchValueChangeModif()
 {
     if (_tsm.Changes.SelectedItem != null && !string.IsNullOrEmpty(_tsm.Changes.SelectedItem.Text) && _tsm.Changes.SelectedItem.Text.Split(' ').Length > 2)
     {
         string cur1, cur2;
         cur1 = _tsm.Changes.SelectedItem.Text.Split(' ')[0];
         cur2 = _tsm.Changes.SelectedItem.Text.Split(' ')[2];
         foreach (Change chg in _currentActivity.Changes)
         {
             if (cur1.Equals(chg.Currency1) && cur2.Equals(chg.Currency2))
             {
                 chg.Rate = double.Parse(_tsm.ChangeValue.TextBoxText);
             }
             else if (cur2.Equals(chg.Currency1) && cur1.Equals(chg.Currency2))
             {
                 chg.Rate = 1 / double.Parse(_tsm.ChangeValue.TextBoxText);
             }
         }
         _currentActivity.Balance();
         RefreshPanel();
         SheetDisplayRequested?.Invoke(null);
     }
 }
Exemple #12
0
        protected void LaunchSheet(UserControlCustom control, bool fullSize = false, int offset = 150)
        {
            if (_sheet != null)
            {
                _sheet.Controls.Clear();
                if (control != null)
                {
                    control.Top = offset;
                    if (fullSize)
                    {
                        control.Top           -= 20;
                        control.Left           = 4;
                        control.Height         = _sheet.Height - offset + 16;
                        control.Width          = _sheet.Width - 8;
                        control.Anchor         = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right) | System.Windows.Forms.AnchorStyles.Bottom)));
                        control.Name           = "CurrentViewFull";
                        _sheet.BackColor       = System.Drawing.Color.Black;
                        _sheet.BackgroundImage = null;
                    }
                    else
                    {
                        control.Left                 = (_sheet.Width / 2) - (control.Width / 2);
                        control.Name                 = "CurrentView";
                        _sheet.BackColor             = System.Drawing.Color.Black;
                        _sheet.BackgroundImage       = Properties.Resources.ShieldTileBg;
                        _sheet.BackgroundImageLayout = ImageLayout.Tile;
                    }
                    control.ChangeLanguage();
                    control.RefreshData();
                    control.Refresh();

                    _sheet.Controls.Add(control);
                }
                SheetDisplayRequested?.Invoke(null);
            }
        }
 private void LaunchAddUser()
 {
     // TODO : manage it with the new dll Droid.people
     //EditUser(null);
     SheetDisplayRequested?.Invoke(null);
 }
 private void LaunchBalance()
 {
     _currentActivity.Balance();
     SheetDisplayRequested?.Invoke(null);
 }
 private void LaunchWinUpdate()
 {
     //_panfin.Refresh();
     SheetDisplayRequested?.Invoke(null);
 }
 private void LaunchSwitchGraph()
 {
     //if (_panfin.PanelGraphics.GraphMode == PanelGraph.GRAPHMODE.PIE) _panfin.SetGraphMode(PanelGraph.GRAPHMODE.BAR);
     //else _panfin.SetGraphMode(PanelGraph.GRAPHMODE.PIE);
     SheetDisplayRequested?.Invoke(null);
 }
 private void LaunchLoadProject()
 {
     OpenProject(_pathFile);
     SheetDisplayRequested?.Invoke(null);
 }
 private void LaunchSwitchView()
 {
     _viewTable = !_viewTable;
     RefreshPanel();
     SheetDisplayRequested?.Invoke(null);
 }