Пример #1
0
        public static void CheckInBpm(Product product, IRange row, IWorksheet sheet)
        {
            Guid result = Guid.Empty;

            string sqlText = $@"SELECT TOP 1 [Id]
                                  FROM [Product]
                                 WHERE [Id] = '{product.Id}' ";

            if (product.CodeSap != null || product.CodeSap != String.Empty)
            {
                sqlText += $@" OR [TcmCodeSap] = N'{product.CodeSap}'";
            }

            if (product.CodeOld != null || product.CodeOld != String.Empty)
            {
                sqlText += $@" OR [TcmCodeOld] = N'{product.CodeOld}' ";
            }
            DataTable dt = ImportProduct.GetDataTable(sqlText);

            if (dt.Rows.Count > 0)
            {
                sheet.Range[row.Row, 1, row.Row, 18].CellStyle.Color = System.Drawing.Color.Red;
                sheet.Range[row.Row, 19].Text = @"Продукт уже существует";
            }
            else
            {
                //InsertProductInBPM(product, sheet);
            }
        }
Пример #2
0
        public static Guid GetLookupValue(string name, string lookupName)
        {
            Guid result = Guid.Empty;

            string sqlText = $@"SELECT TOP 1 [RecordId]
                                  FROM [{lookupName}]
                                 WHERE [Name] = N'{name}'";

            DataTable dt = ImportProduct.GetDataTable(sqlText);

            if (dt.Rows.Count > 0)
            {
                result = dt.Rows[0].Field <Guid>("RecordId");
            }
            return(result);
        }