예제 #1
0
        public static List <CtBox> Get(List <ShipmentRequest> requests)
        {
            if (requests.Count == 0)
            {
                return(new List <CtBox>());
            }

            string constructionCodes = "";

            foreach (var request in requests)
            {
                constructionCodes += "'" + request.ConstructionCode + "',";
            }
            constructionCodes = constructionCodes.TrimEnd(',');

            var sql = @"
SELECT * FROM CtBoxes
WHERE
    ConstructionCode IN (" + constructionCodes + ")";

            var db      = CtBox.GetDatabase();
            var ctBoxes = db.ExecuteQuery <CtBox>(sql);

            return(ctBoxes);
        }
예제 #2
0
        public static List <CtBox> Get(string constructionCode)
        {
            var code = constructionCode.Replace("'", "''");

            var sql = @"SELECT * FROM CtBoxes WHERE ConstructionCode = '" + code + "'";
            var db  = CtBox.GetDatabase();

            return(db.ExecuteQuery <CtBox>(sql));
        }
예제 #3
0
        public static void Delete(string constructionCode)
        {
            string sql = @"
                DELETE FROM CtBoxes
                WHERE
                    ConstructionCode = '" + constructionCode + @"'";

            var db = CtBox.GetDatabase();

            db.ExecuteNonQuery(sql);
        }