Пример #1
0
 public void Insert(SendMail.Model.RubricaMapping.RubricaEntita entity)
 {
     using (var dbcontext = new FAXPECContext())
     {
         try
         {
             var rubr = DaoSQLServerDBHelper.MapToRubrEntita(entity, true);
             dbcontext.RUBR_ENTITA.Add(rubr);
             int r = dbcontext.SaveChanges();
             if (r == 1)
             {
                 entity.IdReferral = (long)rubr.ID_REFERRAL;
             }
             else
             {
                 //Allineamento log - Ciro
                 ManagedException mEx = new ManagedException("Errore inserimento ",
                                                             "RUB_ORA003",
                                                             string.Empty,
                                                             string.Empty,
                                                             null);
                 ErrorLogInfo er = new ErrorLogInfo(mEx);
                 log.Error(er);
                 throw mEx;
             }
         }
         catch
         {
             throw;
         }
     }
 }
Пример #2
0
        public RubricaContatti Clone(RubricaEntita e)
        {
            RubricaContatti c = new RubricaContatti(this);

            c.Entita = e;
            return(c);
        }
Пример #3
0
 public void Update(SendMail.Model.RubricaMapping.RubricaEntita entity)
 {
     using (var dbcontext = new FAXPECContext())
     {
         var rubr = dbcontext.RUBR_ENTITA.Where(x => x.ID_REFERRAL == entity.IdReferral).First();
         if (rubr != null)
         {
             rubr.UFFICIO  = entity.Ufficio;
             rubr.SITO_WEB = entity.SitoWeb;
             rubr.COGNOME  = entity.Cognome;
             rubr.NOME     = entity.Nome;
             rubr.NOTE     = entity.Note;
             rubr.COD_FIS  = entity.CodiceFiscale;
             rubr.P_IVA    = entity.PartitaIVA;
             try
             {
                 int ret = dbcontext.SaveChanges();
             }
             catch
             {
                 throw;
             }
         }
     }
 }
Пример #4
0
        public RubricaEntita Clone()
        {
            RubricaEntita          e = new RubricaEntita(this);
            List <RubricaContatti> l = new List <RubricaContatti>();

            if (this.Contatti != null)
            {
                foreach (RubricaContatti c in this.Contatti)
                {
                    l.Add(c.Clone(e));
                }
            }
            e.Contatti = l;
            if (this.Address != null)
            {
                e.Address = this.Address.Clone();
            }

            using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
            {
                System.Runtime.Serialization.IFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                bf.Serialize(ms, e);
                ms.Seek(0, System.IO.SeekOrigin.Begin);
                e = (RubricaEntita)bf.Deserialize(ms);
            }

            return(e);
        }
Пример #5
0
        public void Insert(SendMail.Model.RubricaMapping.RubricaEntita entity)
        {
            using (OracleCommand ocmd = base.CurrentConnection.CreateCommand())
            {
                ocmd.CommandText = insertEntitaStatement;
                ocmd.BindByName  = true;
                ocmd.Parameters.AddRange(MapEntityToParams(entity, true));

                try
                {
                    int r = ocmd.ExecuteNonQuery();
                    if (r == 1)
                    {
                        entity.IdReferral = Convert.ToInt64(ocmd.Parameters["p_ID"].Value.ToString());
                    }
                    else
                    {
                        //Allineamento log - Ciro
                        ManagedException mEx = new ManagedException("Errore inserimento ",
                                                                    "RUB_ORA003",
                                                                    string.Empty,
                                                                    string.Empty,
                                                                    null);
                        ErrorLogInfo er = new ErrorLogInfo(mEx);
                        log.Error(er);
                        throw mEx;
                    }
                }
                catch
                {
                    throw;
                }
            }
        }
Пример #6
0
        public RubricaEntita(RubricaEntita ent)
        {
            if (ent == null)
            {
                return;
            }

            Type t = this.GetType();

            foreach (System.Reflection.PropertyInfo p in t.GetProperties())
            {
                if (p.CanWrite)
                {
                    p.SetValue(this, p.GetValue(ent, null), null);
                }
            }
        }
Пример #7
0
 public void Update(SendMail.Model.RubricaMapping.RubricaEntita entity)
 {
     using (OracleCommand ocmd = base.CurrentConnection.CreateCommand())
     {
         ocmd.CommandText = updateEntitaStatement;
         ocmd.Parameters.AddRange(MapEntityToParams(entity, false));
         ocmd.BindByName = true;
         try
         {
             int ret = ocmd.ExecuteNonQuery();
         }
         catch
         {
             throw;
         }
     }
 }
Пример #8
0
        public RubricaContatti Clone()
        {
            RubricaEntita e = this.Entita.Clone();

            return(e.Contatti.SingleOrDefault(x => x.IdContact == this.IdContact));
        }
Пример #9
0
 public RubricaEntita save(RubricaEntita e)
 {
     return(e);
 }