Example #1
0
        public void Update(IInstallInfo info)
        {
            IPersistenceFacade svc = DataAccessServices.Instance().PersistenceFacade;
            LicInfo            i   = new LicInfo(info as InstallationInfo);

            svc.UpdateObject("LicInfo", i);
        }
Example #2
0
        public IList GetCheckins(DateTime date)
        {
            IList result           = null;
            IPersistenceFacade _ps = DataAccessServices.Instance().PersistenceFacade;

            Query q = _ps.CreateNewQuery("MapperCheckin");

            AbstractBoolCriteria c = new CompositeCriteria(AbstractBoolCriteria.Operatore.AndOp);

            c.AddCriteria(Criteria.DateTimeContained("Checkin", date.Date, date.AddDays(1).Date.AddSeconds(-1), _ps.DBType));


            q.AddWhereClause(c);

            string p = q.CreateQuery(_ps);

            result = q.Execute(_ps);

            IList result1 = new ArrayList();

            foreach (Checkin item in result)
            {
                result1.Add(new ArrivedPerson(item));
            }

            return(result1);
        }
Example #3
0
        public WIN.SCHEDULING_APPLICATION.HANDLERS.SearchDTOs.IsearchDTO CreateDTO()
        {
            DateTime a = DateTime.MinValue;

            if (dtpAlla.EditValue != null)
            {
                a = dtpAlla.DateTime;
            }

            string subject = txtSub.Text;

            if (!string.IsNullOrEmpty(subject))
            {
                if (Properties.Settings.Default.Main_InsertJolly)
                {
                    //seleziono il carattere jolly in dipendenza dal tipo di DB
                    if (DataAccessServices.Instance().PersistenceFacade.DBType == DB.DBType.Access)
                    {
                        subject = "%" + subject;
                    }
                    else
                    {
                        subject = "%" + subject;
                    }
                }
            }
            return(new SimpleTaskSearch(subject, cboPriority.Text, CalculateDataRange(), chk0.Checked, chk1.Checked, chk2.Checked, chk3.Checked, chk4.Checked, chkDeadTasks.Checked, a));
        }
Example #4
0
        public int GetLastProtocolNumber(int year)
        {
            int result = 0;

            //verifico la presenza del protocollo nell'anno
            object o = _service.ExecuteScalar(string.Format("Select Protocol from App_LastProtocols where Year = {0}", year.ToString()));

            //se non esiste inserisco l'anno con protocollo 1 e lo restituisco
            if (o == null)
            {
                if (DataAccessServices.Instance().PersistenceFacade.DBType == DB.DBType.Access)
                {
                    _service.ExecuteNonQuery(string.Format("Insert into App_LastProtocols ([Year], [Protocol]) values ({0}, {1})", year.ToString(), "1"));
                }
                else
                {
                    _service.ExecuteNonQuery(string.Format("Insert into App_LastProtocols (Year, Protocol) values ({0}, {1})", year.ToString(), "1"));
                }
                return(1);
            }
            if (DataAccessServices.Instance().PersistenceFacade.DBType == DB.DBType.Access)
            {
                _service.ExecuteNonQuery("Update App_LastProtocols set Protocol = Protocol + 1");
                o = _service.ExecuteScalar(string.Format("Select Protocol from App_LastProtocols where Year = {0}", year.ToString()));
            }
            else
            {
                o = _service.ExecuteScalar(string.Format("Update App_LastProtocols set Protocol = Protocol + 1; Select Protocol from App_LastProtocols where Year = {0}", year.ToString()));
            }

            result = Convert.ToInt32(o);

            return(result);
        }
Example #5
0
        public FormInformazioni()
        {
            InitializeComponent();
            lblSwTitle.Text = Properties.Settings.Default.Main_AppName;
            lblVers.Text    = String.Format("Versione software: {0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            lblDB.Text      = String.Format("Versione database: {0}", InfoHandler.Instance.GetInfo().DBVersion.ToString());

            DBTypeLabel.Text       = "Tipo database: " + DataAccessServices.Instance().ServiceName;
            MaxCacheSizeLabel.Text = "Massima dimensione della cache: " + DataAccessServices.Instance().MaxCacheSize;
            CustomPersistenceAssemblyNameLabel.Text = "Assembly servizio di persistenza: " + DataAccessServices.Instance().CustomPersistentServiceAssembly;


            string[] arr = DataAccessServices.Instance().ConnectionString.Split(new char[] { ';' });
            txtConnextionStringparameters.Text += Environment.NewLine;

            if (arr.Length > 0)
            {
                for (int i = 0; i < arr.Length - 1; i++)
                {
                    string elem = arr[i];
                    elem = elem.Trim();
                    if (!elem.StartsWith("Password"))
                    {
                        txtConnextionStringparameters.Text += Environment.NewLine + elem;
                    }
                }
            }
        }
Example #6
0
        public IList GetPaymentStatistics(int year)
        {
            IPersistenceFacade _ps = DataAccessServices.Instance().PersistenceFacade;

            Query q = _ps.CreateNewQuery("MapperPaymentStatistics");

            q.SetTable(string.Format("dbo.GetCollectsByYear({0})", year.ToString()));

            return(q.Execute(_ps));
        }
Example #7
0
        private void cmdOk_Click(object sender, EventArgs e)
        {
            if (SecurityManager.Instance.CurrentUser.Password.ToLower() != textEdit1.Text.ToLower())
            {
                MessageBox.Show("La password di admin non è corretta!", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            if (String.IsNullOrEmpty(textEdit2.Text) || String.IsNullOrEmpty(textEdit3.Text))
            {
                MessageBox.Show("I campi della nuova password non possono essere nulli", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (textEdit2.Text.Length < 5 || textEdit3.Text.Length < 5)
            {
                MessageBox.Show("I campi della nuova password non possono contenere meno di cinque caratteri!", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            if (textEdit2.Text != textEdit3.Text)
            {
                MessageBox.Show("Ridigitare correttamente la nuova password", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                //se si tratta di applicazione Feneal
                if (Properties.Settings.Default.Main_OtherApp)
                {
                    DataAccessServices.Instance().PersistenceFacade.ExecuteNonQuery(String.Format("Update Users set Password='******' where id=1", textEdit2.Text.ToLower()));
                }
                else
                {
                    DataAccessServices.Instance().PersistenceFacade.ExecuteNonQuery(String.Format("Update Users set Passwordd='{0}' where id=1", textEdit2.Text.ToLower()));
                }


                MessageBox.Show("Password modificata con successo. Riavviare l'applicazione per rendere effettive le modifiche", "Messaggio", MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.Close();
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
            }
        }
Example #8
0
        public IInstallInfo GetInstallInfo()
        {
            IPersistenceFacade svc = DataAccessServices.Instance().PersistenceFacade;
            Query q = svc.CreateNewQuery("MapperLicInfo");

            q.AddWhereClause(Criteria.MatchesEqual("HardwareId", _hardwareId, svc.DBType));
            IList i = q.Execute(svc);

            if (i.Count == 0)
            {
                return(null);
            }
            return((IInstallInfo)((LicInfo)i[0]).InstallationInfo);
        }
Example #9
0
        public void Initialize()
        {
            try
            {
                IPersistenceFacade ps = DataAccessServices.Instance().PersistenceFacade;

                if (ps == null)
                {
                    throw new Exception("Servizio di persistenza non impostato");
                }
            }
            catch (Exception ex)
            {
                //Tracer.Instance.TraceIf(Tracer.Instance.TraceSwitch.TraceWarning, "Impossibile inizializzare i servizi di persistenza dell'applicazione", false);
                //Tracer.Instance.TraceIf(Tracer.Instance.TraceSwitch.TraceError, ex.Message, true);
                throw new Exception("Impossibile inizializzare i servizi di persistenza dell'applicazione", ex);
            }
        }
Example #10
0
        public static void CompactAccessDB()
        {
            string tempPath = Path.Combine(Path.GetTempPath(), "tempxxx.mdb");

            if (File.Exists(tempPath))
            {
                File.Delete(tempPath);
            }

            object[] oParams;

            //create an inctance of a Jet Replication Object
            object objJRO =
                Activator.CreateInstance(Type.GetTypeFromProgID("JRO.JetEngine"));

            //filling Parameters array
            //cnahge "Jet OLEDB:Engine Type=5" to an appropriate value
            // or leave it as is if you db is JET4X format (access 2000,2002)
            //(yes, jetengine5 is for JET4X, no misprint here)
            oParams = new object[] {
                DataAccessServices.Instance().ConnectionString,
                "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + tempPath +
                ";Jet OLEDB:Engine Type=5"
            };

            //invoke a CompactDatabase method of a JRO object
            //pass Parameters array
            objJRO.GetType().InvokeMember("CompactDatabase",
                                          System.Reflection.BindingFlags.InvokeMethod,
                                          null,
                                          objJRO,
                                          oParams);

            //database is compacted now
            //to a new file C:\\tempdb.mdw
            //let's copy it over an old one and delete it

            System.IO.File.Delete(DBName);
            System.IO.File.Move(tempPath, DBName);

            //clean up (just in case)
            System.Runtime.InteropServices.Marshal.ReleaseComObject(objJRO);
            objJRO = null;
        }
Example #11
0
        public WIN.TECHNICAL.PERSISTENCE.AbstractBoolCriteria GenerateSql()
        {
            bool modified       = false;
            CompositeCriteria c = new CompositeCriteria(AbstractBoolCriteria.Operatore.AndOp);


            if (!string.IsNullOrEmpty(_subject))
            {
                c.AddCriteria(Criteria.Matches("Subject", _subject, DataAccessServices.Instance().PersistenceFacade.DBType));
                modified = true;
            }

            if (!string.IsNullOrEmpty(_priority))
            {
                PriorityType t = (PriorityType)Enum.Parse(typeof(PriorityType), _priority);
                c.AddCriteria(Criteria.Equal("Priority", Convert.ToInt32(t).ToString()));
                modified = true;
            }

            if (!_range.IsEmpty())
            {
                DataRange r = AppointmentUtils.CreateRangeForQuery(_range);
                c.AddCriteria(Criteria.DateTimeContained("OutcomeDate", r.Start, r.Finish, DataAccessServices.Instance().PersistenceFacade.DBType));
                modified = true;
            }


            CompositeCriteria c1 = CreateStapeCriteria();

            if (c1 != null)
            {
                c.AddCriteria(c1);
                modified = true;
            }


            if (modified)
            {
                return(c);
            }
            return(null);
        }
Example #12
0
        public WIN.SCHEDULING_APPLICATION.HANDLERS.SearchDTOs.IsearchDTO CreateDTO()
        {
            string subject = txtSubject.Text;

            if (!string.IsNullOrEmpty(subject))
            {
                if (Properties.Settings.Default.Main_InsertJolly)
                {
                    //seleziono il carattere jolly in dipendenza dal tipo di DB
                    if (DataAccessServices.Instance().PersistenceFacade.DBType == DB.DBType.Access)
                    {
                        subject = "%" + subject;
                    }
                    else
                    {
                        subject = "%" + subject;
                    }
                }
            }
            return(new SimpleDocumentSearch(GetSelectedScopes(), GetSelectedTypes(), GetSelectedOperators(), subject, txtProtocol.Text, Convert.ToInt32(spYear.Value)));
        }
Example #13
0
        public WIN.SCHEDULING_APPLICATION.HANDLERS.SearchDTOs.IsearchDTO CreateDTO()
        {
            string subject = txtsubject.Text;

            if (!string.IsNullOrEmpty(subject))
            {
                if (Properties.Settings.Default.Main_InsertJolly)
                {
                    //seleziono il carattere jolly in dipendenza dal tipo di DB
                    if (DataAccessServices.Instance().PersistenceFacade.DBType == DB.DBType.Access)
                    {
                        subject = "%" + subject;
                    }
                    else
                    {
                        subject = "%" + subject;
                    }
                }
            }
            return(new SimpleAppointmentSearch(GetSelectedResources(), GetSelectedLabels(), GetSelectedOperators(), subject, txtLoc.Text));
        }
Example #14
0
        private void OpenImportImpegniprogram()
        {
            try
            {
                //WIN.FENEAL_NAZIONALE.IMPORT_IMPEGNI.exe
                string   asmPath = Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", "");
                FileInfo f       = new FileInfo(asmPath);

                string fold = f.DirectoryName;

                string progName = fold + @"\WIN.FENEAL_NAZIONALE.IMPORT_IMPEGNI.exe";


                Process p = new Process();
                p.StartInfo = new ProcessStartInfo(progName, "\"" + DataAccessServices.Instance().ConnectionString + "\"");
                p.StartInfo.UseShellExecute = false;
                p.Start();
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
            }
        }
Example #15
0
        public WIN.TECHNICAL.PERSISTENCE.AbstractBoolCriteria GenerateSql()
        {
            bool modified       = false;
            CompositeCriteria c = new CompositeCriteria(AbstractBoolCriteria.Operatore.AndOp);


            if (!string.IsNullOrEmpty(_subject))
            {
                c.AddCriteria(Criteria.Matches("Subject", _subject, DataAccessServices.Instance().PersistenceFacade.DBType));
                modified = true;
            }

            if (!string.IsNullOrEmpty(_location))
            {
                c.AddCriteria(Criteria.Matches("Location", _location, DataAccessServices.Instance().PersistenceFacade.DBType));
                modified = true;
            }



            if (_labels.Count > 0)
            {
                CompositeCriteria c1 = new CompositeCriteria(AbstractBoolCriteria.Operatore.OrOp);
                foreach (Label item in _labels)
                {
                    if (item != null)
                    {
                        c1.AddCriteria(Criteria.Equal("LabelID", item.Id.ToString()));
                    }
                }
                c.AddCriteria(c1);
                modified = true;
            }

            if (_resources.Count > 0)
            {
                CompositeCriteria c1 = new CompositeCriteria(AbstractBoolCriteria.Operatore.OrOp);
                foreach (Resource item in _resources)
                {
                    if (item != null)
                    {
                        c1.AddCriteria(Criteria.Equal("ResourceID", item.Id.ToString()));
                    }
                }
                c.AddCriteria(c1);
                modified = true;
            }

            if (_operators.Count > 0)
            {
                CompositeCriteria c1 = new CompositeCriteria(AbstractBoolCriteria.Operatore.OrOp);
                foreach (Operator item in _operators)
                {
                    if (item != null)
                    {
                        c1.AddCriteria(Criteria.Equal("OperatorID", item.Id.ToString()));
                    }
                }
                c.AddCriteria(c1);
                modified = true;
            }

            if (modified)
            {
                return(c);
            }
            return(null);
        }
Example #16
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);
        }
Example #17
0
 public SecureDataManager()
 {
     ps = DataAccessServices.Instance().PersistenceFacade;
 }
Example #18
0
        public BookingControl(MainForm form)
            : base(form)
        {
            try
            {
                DataAccessServices.Instance().PersistenceFacade.EmptyCacheAll();

                _initializing = true;

                InitializeComponent();



                schedulerStorage1.FetchAppointments += new FetchAppointmentsEventHandler(schedulerStorage1_FetchAppointments);

                CustomGUI_SetCommandBarVisibility(false);
                //non permetto nessuna operazione dalla toolbar
                base.m_ChangeStateEnabled        = false;
                schedulerControl1.Start          = DateTime.Now;
                schedulerControl1.ActiveViewType = SchedulerViewType.Timeline;


                BookingResourceHandler h = new BookingResourceHandler();
                schedulerStorage1.Resources.DataSource = h.GetAll();


                ////imposto il raggruppamento del calendario
                //if (Properties.Settings.Default.Main_CalendarGroupType == 0)
                //{
                //    schedulerControl1.GroupType = SchedulerGroupType.None;
                //    comboBoxEdit1.SelectedIndex = 0;
                //}
                //else if (Properties.Settings.Default.Main_CalendarGroupType == 1)
                //{
                //    schedulerControl1.GroupType = SchedulerGroupType.Date;
                //    comboBoxEdit1.SelectedIndex = 1;
                //}
                //else if (Properties.Settings.Default.Main_CalendarGroupType == 2)
                //{
                schedulerControl1.GroupType = SchedulerGroupType.Resource;
                // comboBoxEdit1.SelectedIndex = 2;
                //}
                //else
                //{
                //    schedulerControl1.GroupType = SchedulerGroupType.None;
                //    comboBoxEdit1.SelectedIndex = 0;
                //}

                if (Properties.Settings.Default.Main_ZoomTemporale != 0)
                {
                    schedulerControl1.TimelineView.GetBaseTimeScale().Width = Properties.Settings.Default.Main_ZoomTemporale;
                    trackBarControl1.Value = Properties.Settings.Default.Main_ZoomTemporale;
                }

                if (Properties.Settings.Default.Main_ZoomSpaziale != 0)
                {
                    schedulerControl1.TimelineView.AppointmentDisplayOptions.AppointmentHeight = Properties.Settings.Default.Main_ZoomSpaziale;
                    trackBarControl2.Value = Properties.Settings.Default.Main_ZoomSpaziale;
                }
            }
            finally
            {
                _initializing = false;
            }
        }
Example #19
0
        private CompositeCriteria CreateScadutiCriteria()
        {
            CompositeCriteria c = new CompositeCriteria(AbstractBoolCriteria.Operatore.OrOp);

            c.AddCriteria(Criteria.Equal("Status", "0"));

            c.AddCriteria(Criteria.Equal("Status", "1"));

            c.AddCriteria(Criteria.Equal("Status", "3"));

            c.AddCriteria(Criteria.Equal("Status", "4"));



            if (_allaData != DateTime.MinValue)
            {
                AndExp a = new AndExp(c, Criteria.DateTimeContained("EndDate", new DateTime(1900, 1, 1), _allaData.AddDays(1).Date, DataAccessServices.Instance().PersistenceFacade.DBType));
                return(a);
            }

            return(c);
        }
Example #20
0
        public WIN.TECHNICAL.PERSISTENCE.AbstractBoolCriteria GenerateSql()
        {
            if (_noPeriod)
            {
                return(null);
            }


            DataRange r;


            switch (_state)
            {
            case PeriodAppointmentDTOEnum.Prossimi_Sei_Mesi:
                r = AppointmentUtils.CreateRangeForQuery(new DataRange(DateTime.Now.AddDays(1), DateTime.Now.AddDays(1).AddMonths(6)));
                break;

            case PeriodAppointmentDTOEnum.Prossimi_Tre_Mesi:
                r = AppointmentUtils.CreateRangeForQuery(new DataRange(DateTime.Now.AddDays(1), DateTime.Now.AddDays(1).AddMonths(3)));
                break;

            case PeriodAppointmentDTOEnum.Prossimo_Mese:
                r = AppointmentUtils.CreateRangeForQuery(new DataRange(DateTime.Now.AddDays(1), DateTime.Now.AddDays(1).AddMonths(1)));
                break;

            case PeriodAppointmentDTOEnum.Prossime_Due_Settimane:
                r = AppointmentUtils.CreateRangeForQuery(new DataRange(DateTime.Now.AddDays(1), DateTime.Now.AddDays(15)));
                break;

            case PeriodAppointmentDTOEnum.Prossima_Settimana:
                r = AppointmentUtils.CreateRangeForQuery(new DataRange(DateTime.Now.AddDays(1), DateTime.Now.AddDays(8)));
                break;

            case PeriodAppointmentDTOEnum.Domani:
                r = AppointmentUtils.CreateRangeForQuery(new DataRange(DateTime.Now.AddDays(1), DateTime.Now.AddDays(1)));
                break;

            case PeriodAppointmentDTOEnum.Oggi:
                r = AppointmentUtils.CreateRangeForQuery(new DataRange(DateTime.Now, DateTime.Now));
                break;

            case PeriodAppointmentDTOEnum.Ultima_Settimana:
                r = AppointmentUtils.CreateRangeForQuery(new DataRange(DateTime.Now.AddDays(-8), DateTime.Now.AddDays(-1)));
                break;

            case PeriodAppointmentDTOEnum.Ultime_Due_Settimane:
                r = AppointmentUtils.CreateRangeForQuery(new DataRange(DateTime.Now.AddDays(-15), DateTime.Now.AddDays(-1)));
                break;

            case PeriodAppointmentDTOEnum.Ultimo_Mese:
                r = AppointmentUtils.CreateRangeForQuery(new DataRange(DateTime.Now.AddDays(-1).AddMonths(-1), DateTime.Now.AddDays(-1)));
                break;

            case PeriodAppointmentDTOEnum.Ultimi_Tre_Mesi:
                r = AppointmentUtils.CreateRangeForQuery(new DataRange(DateTime.Now.AddDays(-1).AddMonths(-3), DateTime.Now.AddDays(-1)));
                break;

            case PeriodAppointmentDTOEnum.Ultimi_Sei_Mesi:
                r = AppointmentUtils.CreateRangeForQuery(new DataRange(DateTime.Now.AddDays(-1).AddMonths(-6), DateTime.Now.AddDays(-1)));
                break;

            case PeriodAppointmentDTOEnum.Periodo:
                r = AppointmentUtils.CreateRangeForQuery(_range);
                break;

            default:
                r = AppointmentUtils.CreateRangeForQuery(new DataRange(DateTime.Now, DateTime.Now));
                break;
            }

            if (_findAlsoOverlappedAppointments)
            {
                CompositeCriteria c = new CompositeCriteria(AbstractBoolCriteria.Operatore.AndOp);
                c.AddCriteria(Criteria.DateRangeIntersects("StartDate", "EndDate", r.Start, r.Finish, DataAccessServices.Instance().PersistenceFacade.DBType));
                return(c);
            }
            else
            {
                CompositeCriteria c = new CompositeCriteria(AbstractBoolCriteria.Operatore.AndOp);
                c.AddCriteria(Criteria.DateTimeContained("StartDate", r.Start, r.Finish, DataAccessServices.Instance().PersistenceFacade.DBType));
                return(c);
            }
        }
Example #21
0
 public void Initialize()
 {
     GeoLocationFacade.InitializeInstance(new GeoHandler(DataAccessServices.Instance().PersistenceFacade));
 }
Example #22
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);
            }
        }
Example #23
0
        public FreeRoomCheck IsRoomFree(DateTime start, DateTime end, BookingResource room, int assignmentID)
        {
            if (end <= start)
            {
                throw new Exception("Intervallo date non corretto per la verifica di assegnazioni già presenti");
            }

            if (room == null)
            {
                throw new Exception("Stanza non specificata per la verifica di assegnazioni già presenti");
            }


            end   = end.Date;
            start = start.Date;

            //cerco tutte le assegnazioni per una data camera che intersecano strettamente il periodo considerato
            //cosi facendo ottengo tutte le assegnazioni che si sovrappongono ad una potenziale assegnazione nel periodo
            //considerato.

            //l'input assignmentId serve per il caso in cui sto aggiornando una assegnazione esistente e il check
            //va fatto non considerando la presenza dell'assegnazione in questione
            Query q = _ps.CreateNewQuery("MapperAssignment");

            CompositeCriteria c = new CompositeCriteria(AbstractBoolCriteria.Operatore.AndOp);

            //criterio per la verifica della sovrapposizioe delle assegnazioni
            c.AddCriteria(Criteria.DateRangeStrictlyIntersects("StartDate", "EndDate", start, end, DataAccessServices.Instance().PersistenceFacade.DBType));
            //criterio sulla camera
            c.AddCriteria(Criteria.Equal("Id_Resource", room.Id.ToString()));

            //in caso di modifica
            if (assignmentID > 0)
            {
                NotExp exp = new NotExp(Criteria.Equal("ID", assignmentID.ToString()));
                c.AddCriteria(exp);
            }

            q.AddWhereClause(c);


            string p       = q.CreateQuery(_ps);
            IList  results = q.Execute(_ps);

            FreeRoomCheck cc = new FreeRoomCheck();

            cc.IsFree = results.Count == 0;

            if (cc.IsFree)
            {
                return(cc);
            }

            return(ConstructObject(results, cc, start, end, room));
        }
Example #24
0
        public WIN.TECHNICAL.PERSISTENCE.AbstractBoolCriteria GenerateSql()
        {
            //bool modified = false;
            CompositeCriteria c = new CompositeCriteria(AbstractBoolCriteria.Operatore.AndOp);

            c.AddCriteria(Criteria.Equal("DocYear", _year.ToString()));

            if (!string.IsNullOrEmpty(_subject))
            {
                c.AddCriteria(Criteria.Matches("Subject", _subject, DataAccessServices.Instance().PersistenceFacade.DBType));
                //modified = true;
            }

            if (!string.IsNullOrEmpty(_protocol))
            {
                c.AddCriteria(Criteria.Matches("Protocol", _protocol, DataAccessServices.Instance().PersistenceFacade.DBType));
                //modified = true;
            }



            if (_labels.Count > 0)
            {
                CompositeCriteria c1 = new CompositeCriteria(AbstractBoolCriteria.Operatore.OrOp);
                foreach (DocumentType item in _labels)
                {
                    if (item != null)
                    {
                        c1.AddCriteria(Criteria.Equal("DocTypeID", item.Id.ToString()));
                    }
                }
                c.AddCriteria(c1);
                //modified = true;
            }

            if (_scopes.Count > 0)
            {
                CompositeCriteria c1 = new CompositeCriteria(AbstractBoolCriteria.Operatore.OrOp);
                foreach (DocumentScope item in _scopes)
                {
                    if (item != null)
                    {
                        c1.AddCriteria(Criteria.Equal("ScopeID", item.Id.ToString()));
                    }
                }
                c.AddCriteria(c1);
                //modified = true;
            }

            if (_operators.Count > 0)
            {
                CompositeCriteria c1 = new CompositeCriteria(AbstractBoolCriteria.Operatore.OrOp);
                foreach (Operator item in _operators)
                {
                    if (item != null)
                    {
                        c1.AddCriteria(Criteria.Equal("OperatorID", item.Id.ToString()));
                    }
                }
                c.AddCriteria(c1);
                //modified = true;
            }

            //if (modified)
            return(c);
            // return null;
        }
Example #25
0
        public SoftwareInfo GetInfo()
        {
            IPersistenceFacade ps = DataAccessServices.Instance().PersistenceFacade;

            return(ps.GetObject("SoftwareInfo", 1) as SoftwareInfo);
        }
Example #26
0
        public WIN.TECHNICAL.PERSISTENCE.AbstractBoolCriteria GenerateSql()
        {
            CompositeCriteria c = new CompositeCriteria(AbstractBoolCriteria.Operatore.AndOp);

            if (_forRimesse)
            {
                c.AddCriteria(Criteria.Equal("Anno", _year.ToString()));
            }
            else
            {
                c.AddCriteria(Criteria.DateTimeContained("Data", _range.Start, _range.Finish, DataAccessServices.Instance().PersistenceFacade.DBType));
            }

            if (_province != null)
            {
                foreach (Provincia item in _province)
                {
                    c.AddCriteria(Criteria.Equal("Id_Provincia", item.Id.ToString()));
                }
            }

            if (_regioni != null)
            {
                foreach (Regione item in _regioni)
                {
                    c.AddCriteria(Criteria.Equal("Id_Regione", item.Id.ToString()));
                }
            }

            if (_causali != null)
            {
                foreach (CausaleAmministrativa item in _causali)
                {
                    c.AddCriteria(Criteria.Equal("Id_CausaleAmministrazione", item.Id.ToString()));
                }
            }


            return(c);
        }
Example #27
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            NetworkCredentials.Instance().NetworkDomain   = Properties.Settings.Default.networkdomain;
            NetworkCredentials.Instance().NetworkUsername = Properties.Settings.Default.networkusername;
            NetworkCredentials.Instance().NetworkPassord  = Properties.Settings.Default.networkpassword;
            //NetworkFileSystemUtilsProxy p = new NetworkFileSystemUtilsProxy();
            //p.UncFileExist(@"\\DESKTOP-E9KNOCC\ciccio\ciccio.txt");

            //initialize skinning properties
            barManager.ForceInitialize();
            MyBarLocalizer.Active = new MyBarLocalizer();
            SkinHelper.InitSkinPopupMenu(mPaintStyle);


            //initialize navigator
            _navUtil = new NavigationUtils(splitContainerControl.Panel2, this);

            //renders startup controls
            if (_customerId == "")
            {
                _navUtil.NavigateToStartupControl(Properties.Settings.Default.Main_StartCommand);
            }
            else
            {
                try
                {
                    IOpenCommand cmd = new CustomerCommand(this);
                    Hashtable    h   = new Hashtable();
                    h.Add("Id", _customerId);
                    cmd.Execute(h);
                    HistoryOfCommands.Instance().AddCommandToHistory(cmd);
                    MemoryHelper.ReduceMemory();
                }
                catch (Exception ex)
                {
                    ErrorHandler.Show(ex);
                    _navUtil.NavigateToStartupControl(Properties.Settings.Default.Main_StartCommand);
                }
            }

            //sets the caption text
            this.Text = "Gestionale appuntamenti - " + Properties.Settings.Default.Main_AppName;

            //sets the name of the current logged user
            string nome = ((User)(SecurityManager.Instance.CurrentUser)).Username;

            sItem.Caption = string.Format("Benvenuto: {0}!", nome);

            if (DataAccessServices.Instance().PersistenceFacade.DBType == DB.DBType.Access)
            {
                // barRipristina.Visibility = BarItemVisibility.Always;ù
                barButtonbackup.Visibility = BarItemVisibility.Always;
                UpdateLastBackInfo();
                barBack.Visibility = BarItemVisibility.Always;
            }
            else
            {
                //barRipristina.Visibility = BarItemVisibility.Never;
                barButtonbackup.Visibility = BarItemVisibility.Never;
                barBack.Visibility         = BarItemVisibility.Never;
            }



            //sets initial view
            splitContainerControl.Collapsed = Properties.Settings.Default.Main_PanelCollapsed;
            administration.Visible          = !Properties.Settings.Default.Main_ShowOnlyAgendaFunctions;
        }
Example #28
0
 public SimpletHandler()
 {
     _ps = DataAccessServices.Instance().PersistenceFacade;
 }