Exemplo n.º 1
0
 /// <summary>
 /// Inizializza le properties.
 /// </summary>
 private void Init()
 {
     Pratica         = new Pratica();
     Risposta        = new Risposta();
     DataLavorazione = default(DateTime);
     this.Id         = Guid.NewGuid().ToString();
     //Random r = new Random(System.DateTime.Now.Millisecond + System.DateTime.Now.Second);
     //this.Id = r.Next();
     _IsPersistent = false;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Inserisce una pratica in collezione gestendone l'indice.
 /// </summary>
 /// <param name="pList">collezione di pratiche</param>
 /// <param name="p">pratica da inserire</param>
 public static void InsertPratica(this IList <Pratica> pList, Pratica p)
 {
     if (p.Indice == -1)
     {
         pList.Add(p);
     }
     else if (pList.ElementAtOrDefault(p.Indice) != null)
     {
         pList.RemoveAt(p.Indice);
         pList.Insert(p.Indice, p);
     }
     //todo.. exception?
 }
Exemplo n.º 3
0
        public Pratica(Pratica p)
        {
            Init();
            if (p == null)
            {
                return;
            }

            Type t = this.GetType();

            foreach (System.Reflection.PropertyInfo pi in t.GetProperties())
            {
                if (pi.CanWrite)
                {
                    pi.SetValue(this, pi.GetValue(p, null), null);
                }
            }
        }