示例#1
0
        private string CalculateProtocollo()
        {
            ILastProtocolNumberRetriever protocolRetriever = ProtocolRetrieverFactory.GetProtocolRetriever(DataAccessServices.Instance().PersistenceFacade, Properties.Settings.Default.Main_ProtocolStrategy);


            //_current.Responsable = txtresp.Text;
            //_current.Date = dtpdata.DateTime;

            //_current.Contacts = new ArrayList();
            //foreach (Customer item in lstcont.Items)
            //{
            //    _current.Contacts.Add(item);
            //}

            //_current.Priority = (PriorityType)Enum.Parse(typeof(PriorityType), cbopri.Text);
            //_current.Nature = (WIN.SCHEDULING_APPLICATION.DOMAIN.Document.DocumentNature)Enum.Parse(typeof(WIN.SCHEDULING_APPLICATION.DOMAIN.Document.DocumentNature), cbotip.Text);

            //_current.Operator = cboop.SelectedItem as Operator;
            //_current.Type = cbocau.SelectedItem as DocumentType;
            //_current.Scope = cbocar.SelectedItem as DocumentScope;

            DocumentType  _type     = cbocau.SelectedItem as DocumentType;
            DocumentScope _scope    = cbocar.SelectedItem as DocumentScope;
            Operator      _operator = cboop.SelectedItem as Operator;
            DateTime      _date     = dtpdata.DateTime;
            string        _protocol = "";

            if (_type != null)
            {
                if (!string.IsNullOrEmpty(_type.ProtocolCode))
                {
                    _protocol = _type.ProtocolCode;
                }
            }


            _protocol = _protocol + protocolRetriever.GetLastProtocolNumber(_date.Year).ToString() + "/";

            if (_scope != null)
            {
                _protocol += _scope.ProtocolCode + "/";
                _protocol += _scope.ResponsableProtocolCode;
            }
            if (_operator != null)
            {
                _protocol += "/" + _operator.ProtocolCode;
            }


            return(_protocol);
        }
示例#2
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            if (_current == null)
            {
                if (IsProtocolCalculable())
                {
                    txtprot.Text = CalculateProtocollo();
                    return;
                }
                else
                {
                    XtraMessageBox.Show("Attenzione per il calcolo del protocollo è necessario inserire una causale , un operatore e una cartellina!", "Messaggio", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }



                //
            }


            try
            {
                if (!string.IsNullOrEmpty(_current.Protocol))
                {
                    if (XtraMessageBox.Show("Attenzione! Il protocollo è già stato inserito. Il calcolo di un nuovo protocollo comporta la perdità del protocollo attuale. Procedere al ricalcolo del nuovo protocollo?", "Messaggio", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        _current.CalculateProtocol(ProtocolRetrieverFactory.GetProtocolRetriever(DataAccessServices.Instance().PersistenceFacade, Properties.Settings.Default.Main_ProtocolStrategy));
                        txtprot.Text = _current.Protocol;
                        StartChangeOperation();
                    }
                }
                else
                {
                    _current.CalculateProtocol(ProtocolRetrieverFactory.GetProtocolRetriever(DataAccessServices.Instance().PersistenceFacade, Properties.Settings.Default.Main_ProtocolStrategy));
                    txtprot.Text = _current.Protocol;
                    StartChangeOperation();
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
            }
        }