Exemplo n.º 1
0
        public static List <RemoconDetail> Get(string constructionCode)
        {
            constructionCode = constructionCode.Replace("'", "''");

            var sql = @"SELECT * FROM RemoconDetails WHERE ConstructionCode = '" + constructionCode + "'";
            var db  = RemoconDetail.GetDatabase();

            return(db.ExecuteQuery <RemoconDetail>(sql));
        }
Exemplo n.º 2
0
        public static void Update(List <RemoconDetail> remocons)
        {
            if (remocons.Count == 0)
            {
                return;
            }

            var constructionCode = remocons[0].ConstructionCode;
            var deleteSql        = @"DELETE FROM RemoconDetails WHERE ConstructionCode = '" + constructionCode + "'";

            var db = RemoconDetail.GetDatabase();

            db.ExecuteNonQuery(deleteSql);

            var now = DateTime.Now;

            foreach (var remocon in remocons)
            {
                remocon.UpdatedDateTime = now;
                db.Insert <RemoconDetail>(remocon);
            }
        }