Exemple #1
0
 public bool Update(IExttriple entity)
 {
     return(mapperHelper.Update(entity,
                                (cmd, exttriple) => UpdateParameters(cmd, exttriple),
                                "update Exttriple set value=@value where id=@id and datetime=@datetime"
                                ));
 }
Exemple #2
0
 public bool Delete(IExttriple entity)
 {
     return(mapperHelper.Delete(entity,
                                (cmd, exttriple) => DeleteParameters(cmd, exttriple),
                                "delete from Exttriple where id=@id and datetime=@datetime"
                                ));
 }
Exemple #3
0
        protected void DeleteParameters(IDbCommand cmd, IExttriple e)
        {
            SqlParameter id       = new SqlParameter("@id", e.id);
            SqlParameter datetime = new SqlParameter("@datetime", e.datetime);

            cmd.Parameters.Add(id);
            cmd.Parameters.Add(datetime);
        }
Exemple #4
0
 public IExttriple Create(IExttriple entity)
 {
     using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
     {
         mapperHelper.Create(entity,
                             (cmd, exttriple) => InsertParameters(cmd, exttriple),
                             "INSERT INTO EXttriple(id, datetime, value) values(@id, @datetime, @value); select @id=id, @datetime=datetime from Exttriple;"
                             );
         ts.Complete();
         return(entity);
     }
 }
Exemple #5
0
        protected void InsertParameters(IDbCommand cmd, IExttriple e)
        {
            SqlParameter id       = new SqlParameter("@id", e.id);
            SqlParameter datetime = new SqlParameter("@datetime", e.datetime);
            SqlParameter value    = new SqlParameter("value", e.value);

            id.Direction       = ParameterDirection.InputOutput;
            datetime.Direction = ParameterDirection.InputOutput;
            cmd.Parameters.Add(id);
            cmd.Parameters.Add(datetime);
            cmd.Parameters.Add(value);
        }
Exemple #6
0
        public bool Update(IExttriple value)
        {
            if (value == null)
            {
                return(false);
            }

            ctx.Entry((Exttriple)value).State = EntityState.Modified;
            IExttriple newExttriple = Find(value.id, value.datetime);

            newExttriple.value = value.value;

            return(true);
        }
Exemple #7
0
 protected void UpdateParameters(IDbCommand cmd, IExttriple e)
 {
     InsertParameters(cmd, e);
 }
Exemple #8
0
 public IExttriple Insert(IExttriple value)
 {
     return(db.Add((Exttriple)value));
 }
Exemple #9
0
 public bool Delete(IExttriple value)
 {
     return(db.Remove((Exttriple)value).Equals(value));
 }
 public bool Update(IExttriple value)
 {
     return(mapper.Update(value));
 }
 public IExttriple Insert(IExttriple value)
 {
     return(mapper.Create(value));
 }
 public bool Delete(IExttriple value)
 {
     return(mapper.Delete(value));
 }