internal static itemSize getSize(string stockCode)
        {
            string sql = @"SELECT imposition.sizex As ""SizeX"",  imposition.sizey As ""SizeY"" FROM imposition " +
                         "LEFT JOIN productgroup " +
                         "ON imposition.id = productgroup.impid " +
                         "LEFT JOIN productgroupmembers " +
                         "ON productgroup.id = productgroupmembers.groupid " +
                         "WHERE stockcode = :item_code " +
                         "LIMIT 1; ";

            string[] parameterNames = { "item_code" };
            string[] parameterVals  = { stockCode };

            DataTable rtTable;

            try
            {
                rtTable = AWFPostgresDataLayer.GetDataTable(sql, parameterNames, parameterVals);
            }
            catch
            {
                throw;
            }

            if (rtTable.Rows.Count == 1)
            {
                return(new itemSize {
                    width = new Size(Convert.ToInt32((rtTable.Rows[0]["SizeX"]))), height = new Size(Convert.ToInt32((rtTable.Rows[0]["SizeY"])))
                });
            }
            else
            {
                throw new Exception(String.Format("No Sizes found for the item: {0}", stockCode));
            }
        }
Exemple #2
0
        private static asset getAsset(AWF myAWF, int itemSequence, RBA_Variables variables)
        {
            string sql      = string.Empty;
            string itemCode = string.Format("%{0}%", myAWF.Products.Item[itemSequence].ItemCode);
            string PDNumber = string.Format("{0}%", variables.VASSET_PREFIX + myAWF.Products.Item[itemSequence].SourcePDNumber);

            string[] parameterNames = new string[1];
            string[] parameterVals  = new string[1];
            switch (getProductType(myAWF, itemSequence, variables))
            {
            case productType.Static:
                sql = "SELECT id, name "
                      + "FROM asset "
                      + "WHERE name LIKE :stock_code "
                      + "LIMIT 1";
                parameterNames = new string[] { "stock_code" };
                parameterVals  = new string[] { itemCode };
                break;

            case productType.Variable:
                sql = "SELECT id, name "
                      + "FROM asset "
                      + "WHERE name LIKE :printdirect_number "
                      + "AND name LIKE :stock_code "
                      + "LIMIT 1";

                parameterNames = new string[] { "printdirect_number", "stock_code" };
                parameterVals  = new string[] { PDNumber, itemCode };
                break;
            }

            DataTable rtTable = AWFPostgresDataLayer.GetDataTable(sql, parameterNames, parameterVals);

            if (rtTable.Rows.Count == 1)
            {
                return(new asset {
                    Id = Convert.ToString(rtTable.Rows[0]["id"]), Name = Convert.ToString(rtTable.Rows[0]["name"])
                });
            }
            else
            {
                throw new Exception("Asset not found in Asset Table");
            }
        }