Exemple #1
0
 public void Initialize()
 {
     c1 = new CalendarioImpegni("1001");
     i1 = new Impegno(new DateTime(2018, 06, 15, 9, 0, 0), new DateTime(2018, 06, 15, 11, 0, 0), "1001");  // 15/06 9-11
     i2 = new Impegno(new DateTime(2018, 06, 15, 12, 0, 0), new DateTime(2018, 06, 15, 13, 0, 0), "1001"); // 15/06 12-13
     i3 = new Impegno(new DateTime(2018, 06, 16, 9, 0, 0), new DateTime(2018, 06, 16, 11, 0, 0), "1001");  // 16/06 9-11
 }
Exemple #2
0
        public FormImpegno(Impegno impegno)
        {
            InitializeComponent();
            _impegno = impegno;

            LoadData();
        }
Exemple #3
0
        public void EqualsTest()
        {
            Impegno i1 = new Impegno(new DateTime(2018, 06, 15, 9, 0, 0), new DateTime(2018, 06, 15, 11, 0, 0), "1001");
            Impegno i2 = new Impegno(new DateTime(2018, 06, 15, 9, 0, 0), new DateTime(2018, 06, 15, 10, 0, 0), "1001");
            Impegno i3 = new Impegno(new DateTime(2018, 06, 15, 10, 0, 0), new DateTime(2018, 06, 15, 11, 0, 0), "1001");

            Assert.AreNotEqual(i1, i2);
            Assert.AreNotEqual(i1, i3);
            Assert.AreNotEqual(i3, i2);
        }
Exemple #4
0
        private void ShowDialogForm(Impegno label)
        {
            FormImpegno frm = new FormImpegno(label);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                gridView1.RefreshData();
                gridView1.UpdateSummary();
            }
            frm.Dispose();
        }
Exemple #5
0
        private void DoRowDoubleClick(GridView view, Point pt)
        {
            GridHitInfo info = view.CalcHitInfo(pt);

            if (info.InRowCell)
            {
                Impegno label = view.GetRow(view.FocusedRowHandle) as Impegno;
                if (label != null)
                {
                    ShowDialogForm(label);
                }
            }
        }
Exemple #6
0
        public void OverlapsWithTest()
        {
            Impegno i1       = new Impegno(new DateTime(2018, 06, 15, 9, 0, 0), new DateTime(2018, 06, 15, 11, 0, 0), "1001");
            Impegno i2       = new Impegno(new DateTime(2018, 06, 15, 11, 0, 0), new DateTime(2018, 06, 15, 12, 0, 0), "1001");
            bool    overlaps = i1.OverlapsWith(i2);

            Assert.AreEqual(false, overlaps);
            Impegno i3 = new Impegno(new DateTime(2018, 06, 15, 10, 0, 0), new DateTime(2018, 06, 15, 12, 0, 0), "1001");

            overlaps = i1.OverlapsWith(i3);
            Assert.AreEqual(true, overlaps);
            overlaps = i2.OverlapsWith(i3);
            Assert.AreEqual(true, overlaps);
        }
Exemple #7
0
        public void ImpegnoTest()
        {
            Impegno imp = new Impegno(new DateTime(2018, 06, 15, 9, 0, 0), new DateTime(2018, 06, 15, 11, 0, 0), "1001");

            Assert.IsNotNull(imp);
        }
Exemple #8
0
 public void ImpegnoTestFail4()
 {
     Impegno imp = new Impegno(new DateTime(2018, 06, 15, 10, 0, 0), new DateTime(2018, 06, 16, 11, 0, 0), "1001");
 }
Exemple #9
0
 private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
 {
     if (e.Column.Name == "colProvincia")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             if (app.Provincia == null)
             {
                 e.DisplayText = "";
             }
             else
             {
                 e.DisplayText = app.Provincia.Descrizione;
             }
         }
     }
     else if (e.Column.Name == "colRegione")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             if (app.Regione == null)
             {
                 e.DisplayText = "";
             }
             else
             {
                 e.DisplayText = app.Regione.Descrizione;
             }
         }
     }
     else if (e.Column.Name == "colImpegnoTotale")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             e.DisplayText = app.ImpegnoTotale.ToString("n2");
         }
     }
     else if (e.Column.Name == "colgen")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             e.DisplayText = app.gen.ToString("n2");
         }
     }
     else if (e.Column.Name == "colfeb")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             e.DisplayText = app.feb.ToString("n2");
         }
     }
     else if (e.Column.Name == "colmar")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             e.DisplayText = app.mar.ToString("n2");
         }
     }
     else if (e.Column.Name == "colapr")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             e.DisplayText = app.apr.ToString("n2");
         }
     }
     else if (e.Column.Name == "colmag")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             e.DisplayText = app.mag.ToString("n2");
         }
     }
     else if (e.Column.Name == "colgiu")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             e.DisplayText = app.giu.ToString("n2");
         }
     }
     else if (e.Column.Name == "collug")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             e.DisplayText = app.lug.ToString("n2");
         }
     }
     else if (e.Column.Name == "colago")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             e.DisplayText = app.ago.ToString("n2");
         }
     }
     else if (e.Column.Name == "colset")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             e.DisplayText = app.set.ToString("n2");
         }
     }
     else if (e.Column.Name == "colott")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             e.DisplayText = app.ott.ToString("n2");
         }
     }
     else if (e.Column.Name == "colnov")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             e.DisplayText = app.nov.ToString("n2");
         }
     }
     else if (e.Column.Name == "coldic")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             e.DisplayText = app.dic.ToString("n2");
         }
     }
     else if (e.Column.Name == "colalt")
     {
         Impegno app = gridView1.GetRow(e.RowHandle) as Impegno;
         if (app != null)
         {
             e.DisplayText = app.altreDate.ToString("n2");
         }
     }
 }
Exemple #10
0
 public void ImpegnoTestFail3()
 {
     Impegno imp = new Impegno(new DateTime(2018, 06, 15, 18, 0, 0), new DateTime(2018, 06, 15, 20, 0, 0));
 }