コード例 #1
0
        private void CreateBilancio()
        {
            RendicontoHeaderDTO dto;

            try
            {
                dto = CreaDTO();

                string pp = "";

                IOpenFileClass c = _view.GetFolderBrowserDialog();
                if (c.ShowAndContinue())
                {
                    pp = c.GetFileName();
                }
                else
                {
                    pp = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
                }

                dto.FolderPath = pp;

                _createdBilancio = _service.CreateNewRendiconto(dto);
            }
            catch (Exception)
            {
                try
                {
                    dto = CreaDTO();

                    IOpenFileClass h = _view.GetFolderBrowserDialog();

                    if (h.ShowAndContinue() == true)
                    {
                        dto.FolderPath = h.GetFileName();
                    }
                    else
                    {
                        throw new Exception("Impossibile salvare il nuovo rendiconto");
                    }


                    _createdBilancio = _service.CreateNewRendiconto(dto);
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
コード例 #2
0
        public void CreateTransferFile()
        {
            try
            {
                IOpenFileClass o = _view.GetFolderBrowserDialog();

                if (o.ShowAndContinue())
                {
                    string path = o.GetFileName();

                    path = path + "\\RendicontoDaTrasferire.xml";

                    _service.SaveDtoRendiconto(path);

                    _view.GetSimpleMessageNotificator().Show("File salvato in: " + path, "Info", MessageType.Information);
                }
            }
            catch (Exception ex)
            {
                _view.GetSimpleMessageNotificator().Show(ex.Message, "Errore", MessageType.Error);
            }
        }