Ejemplo n.º 1
0
        public override global::System.Data.DataSet Clone()
        {
            dsInstance cln = ((dsInstance)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Ejemplo n.º 2
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            dsInstance ds = new dsInstance();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Ejemplo n.º 3
0
        private void frmGetOrder_Load(object sender, EventArgs e)
        {
            cboAs400Connections.Items.AddRange(new string[] { Properties.Settings.Default.ConnectionPeover, Properties.Settings.Default.ConnectionLonda });
            cboAs400Connections.SelectedIndex = 1;

            cboSqlServer.Items.AddRange(new string[] { Properties.Settings.Default.FcukIntegrationConnectionStringLIFE_user, Properties.Settings.Default.FcukIntegrationConnectionStringFCUK_user });

            // load combo of old instances
            if (this.dsI == null)
            {
                this.dsI = new dsInstance();
            }
            vInstanceHeaderByDate_descTableAdapter taHcombo = new vInstanceHeaderByDate_descTableAdapter()
            {
                Connection = new SqlConnection(cboSqlServer.Text)
            };

            taHcombo.Fill(this.dsI._vInstanceHeaderByDate_desc);
            cboOrderToRetrieveSql.DataSource    = this.dsI._vInstanceHeaderByDate_desc;
            cboOrderToRetrieveSql.DisplayMember = "NameStatus";
            cboOrderToRetrieveSql.ValueMember   = "Id";
        }
Ejemplo n.º 4
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                dsInstance ds = new dsInstance();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "Security_InstanceDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }
Ejemplo n.º 5
0
        private void btnXmlCreate_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            if (!chkXmlFromSql.Checked)
            {
                if (tOrd != null)
                {
                    try
                    {
                        string       savedStyle = "";
                        var          ords       = from myRows in tOrd.AsEnumerable() select myRows;
                        FcukProducts sty        = new FcukProducts();
                        foreach (var o in ords)
                        {
                            string[] images = null;
                            if (savedStyle != (string)o["STYLE"])
                            {
                                // write a Style parent
                                ColorSize parent = new ColorSize();
                                parent.SkuNumber   = (string)o["STYLE"];
                                parent.Category    = (string)o["RANGENAME"] + "," + (string)o["CATEGORY"];
                                parent.ParentSku   = "Parent";
                                parent.Description = (string)o["STYLEDESCRIPTION"];

                                try
                                {
                                    images = getImages((string)o["STYLE"]);
                                    FileInfo fi = new FileInfo(images[0]);
                                    parent.Images.Add(new Image()
                                    {
                                        ImageFileName = fi.Name.Replace(" ", "")
                                    });
                                }
                                catch (Exception)
                                {
                                }
                                sty.ColorSizeVariations.Add(parent);
                                savedStyle = (string)o["STYLE"];
                            }

                            ColorSize colsz = new ColorSize();
                            colsz.SkuNumber                    = (string)o["STYLE"];
                            colsz.Category                     = (string)o["RANGENAME"] + "," + (string)o["CATEGORY"];
                            colsz.Ean                          = (string)o["UPCCODE"];
                            colsz.Condition                    = "NEW";
                            colsz.StockStatus                  = "0";
                            colsz.Price                        = ((decimal)o["WHOLESALEPRICE"]).ToString();
                            colsz.PriceCurrency                = (string)o["CURRENCY"];
                            colsz.Description                  = (string)o["STYLEDESCRIPTION"];
                            colsz.SellerCost                   = ((decimal)o["WHOLESALEPRICE"]).ToString();
                            colsz.SellerCostCurrency           = (string)o["CURRENCY"];
                            colsz.ManufSuggRetailPrice         = ((decimal)o["SALESPRICEFROMLIST"]).ToString();
                            colsz.ManufSuggRetailPriceCurrency = (string)o["CURRENCY"];
                            colsz.ParentSku                    = (string)o["STYLE"];
                            colsz.RelationshipName             = "STYLE_COLORSIZE";
                            colsz.ResellerSilhouette           = "";
                            colsz.AgeGroups                    = "";
                            colsz.Brand                        = "FCUK";
                            colsz.Gender                       = (string)o["RANGENAME"];
                            colsz.ColorCode                    = (string)o["COLOR"];
                            colsz.ColorDescription             = (string)o["COLOURDESC"];
                            colsz.Season                       = (string)o["SEASON"];
                            switch ((string)o["SIZE"])
                            {
                            case "10":
                                colsz.Size = (string)o["SZ1"];
                                break;

                            case "20":
                                colsz.Size = (string)o["SZ2"];
                                break;

                            case "30":
                                colsz.Size = (string)o["SZ3"];
                                break;

                            case "40":
                                colsz.Size = (string)o["SZ4"];
                                break;

                            case "50":
                                colsz.Size = (string)o["SZ5"];
                                break;

                            case "60":
                                colsz.Size = (string)o["SZ6"];
                                break;

                            default:
                                colsz.Size = "UNKNOWN";
                                break;
                            }


                            colsz.SizeRegister = (string)o["SIZE"];
                            //colsz.SpecialDescription = "SPECIAL DESCRIPTION FROM SOPHIA XLSX";
                            colsz.SpecialDescription  = getDescription((string)o["STYLE"]);
                            colsz.SupplierColor       = (string)o["COLOURDESC"];
                            colsz.VatType             = "100";
                            colsz.OuterFabricMaterial = (string)o["FABRIC"];
                            colsz.WashInstructions    = getCareInstructions((string)o["STYLE"]);
                            colsz.Lining  = getLining((string)o["STYLE"]);  // "LINING";
                            colsz.Filling = getFilling((string)o["STYLE"]); //"FILLING";
                            //colsz.GarmentLength = "dummy length";
                            //colsz.Collar = "dummy collar";
                            //colsz.Fastening = "dummy fastening";
                            //colsz.SleeveLength = "dummy sleeve";
                            //colsz.InsideLeg = "dummy leg";
                            if (images != null && images.Length > 0)
                            {
                                foreach (string i in images)
                                {
                                    FileInfo fi = new FileInfo(i);

                                    colsz.Images.Add(new Image()
                                    {
                                        ImageFileName = fi.Name
                                    });
                                }
                            }
                            sty.ColorSizeVariations.Add(colsz);
                        }

                        // save XML
                        XmlSerializer mySerializer = new XmlSerializer(typeof(FcukProducts));
                        // To write to a file, create a StreamWriter object.
                        // desired format is: FCUK_Zalando_Products_20200220115345.MAIN.xml
                        StreamWriter myWriter = new StreamWriter(string.Format("c:\\temp\\FCUK_Zalando_Products_{0}.MAIN.xml", DateTime.Now.ToString("yyyyMMddHHmmss")));
                        mySerializer.Serialize(myWriter, sty);
                        using (var stringwriter = new System.IO.StringWriter())
                        {
                            var serializer = new XmlSerializer(sty.GetType());
                            serializer.Serialize(stringwriter, sty);
                            string myString = stringwriter.ToString();
                            //XmlTreeDisplay(myString);
                        }

                        myWriter.Close();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(string.Format("Message: <{0}>, line: <{1}>", ex.Message, ex.StackTrace), "Making XML from IBM data");
                    }
                }
            }
            else // use SQL data source
            {
                if (dsI == null)
                {
                    dsI = new dsInstance();
                }
                if (taD == null)
                {
                    taD = new tInstanceDetailTableAdapter()
                    {
                        Connection = new SqlConnection(cboSqlServer.Text), ClearBeforeFill = true
                    };
                }
                if (taH == null)
                {
                    taH = new tInstanceHeaderTableAdapter()
                    {
                        Connection = new SqlConnection(cboSqlServer.Text), ClearBeforeFill = true
                    };
                }
                taH.Fill(dsI.tInstanceHeader);
                taD.FillByHeaderId(dsI.tInstanceDetail, headerId);

                try
                {
                    string       savedStyle = "";
                    var          ords       = from myRows in tOrd.AsEnumerable() select myRows;
                    FcukProducts sty        = new FcukProducts();
                    foreach (dsInstance.tInstanceDetailRow r in dsI.tInstanceDetail.Rows)
                    {
                        string[] images = null;
                        if (savedStyle != r.SkuNumber)
                        {
                            // write a Style parent
                            ColorSize parent = new ColorSize();
                            parent.SkuNumber   = r.SkuNumber;
                            parent.Category    = r.Category;
                            parent.ParentSku   = "Parent";
                            parent.Description = r.ProductDescription;

                            try
                            {
                                images = getImages(r.SkuNumber);
                                FileInfo fi = new FileInfo(images[0]);
                                parent.Images.Add(new Image()
                                {
                                    ImageFileName = fi.Name.Replace(" ", "")
                                });
                            }
                            catch (Exception)
                            {
                            }
                            sty.ColorSizeVariations.Add(parent);
                            savedStyle = r.SkuNumber;
                        }

                        ColorSize colsz = new ColorSize();
                        colsz.SkuNumber                    = r.SkuNumber;
                        colsz.Category                     = r.Category;
                        colsz.Ean                          = r.EAN;
                        colsz.Condition                    = r.Condition;
                        colsz.StockStatus                  = r.StockStatus.ToString();
                        colsz.Price                        = r.Price.ToString();
                        colsz.PriceCurrency                = r.PriceCurrency;
                        colsz.Description                  = r.ProductDescription;
                        colsz.SellerCost                   = r.Price.ToString();
                        colsz.SellerCostCurrency           = r.PriceCurrency;
                        colsz.ManufSuggRetailPrice         = r.ManufSuggRetailPrice.ToString(); // ((decimal)o["SALESPRICEFROMLIST"]).ToString();
                        colsz.ManufSuggRetailPriceCurrency = r.ManufSuggRetailPriceCurrency;    // (string)o["CURRENCY"];
                        colsz.ParentSku                    = r.SkuNumber;
                        colsz.RelationshipName             = "STYLE_COLORSIZE";
                        colsz.ResellerSilhouette           = r.ResellerSilhouette;
                        colsz.AgeGroups                    = r.AgeGroups;
                        colsz.Brand                        = r.Brand;
                        colsz.Gender                       = r.Gender;
                        colsz.ColorDescription             = r.MainColor;
                        colsz.Season                       = r.Season;
                        colsz.Size                         = r.Size;
                        colsz.SizeRegister                 = r.SizeRegister;
                        //switch (r.Size)
                        //{
                        //    case "10":
                        //        colsz.Size = (string)o["SZ1"];
                        //        break;
                        //    case "20":
                        //        colsz.Size = (string)o["SZ2"];
                        //        break;
                        //    case "30":
                        //        colsz.Size = (string)o["SZ3"];
                        //        break;
                        //    case "40":
                        //        colsz.Size = (string)o["SZ4"];
                        //        break;
                        //    case "50":
                        //        colsz.Size = (string)o["SZ5"];
                        //        break;
                        //    case "60":
                        //        colsz.Size = (string)o["SZ6"];
                        //        break;
                        //    default:
                        //        colsz.Size = "UNKNOWN";
                        //        break;
                        //}


                        colsz.SizeRegister = r.SizeRegister;
                        //colsz.SpecialDescription = "SPECIAL DESCRIPTION FROM SOPHIA XLSX";
                        colsz.SpecialDescription  = r.SpecialDescription; // getDescription((string)o["STYLE"]);
                        colsz.SupplierColor       = r.SupplierColor;
                        colsz.VatType             = r.VatType;
                        colsz.OuterFabricMaterial = r.OuterFabricMaterial;
                        colsz.WashInstructions    = r.WashInstructions;
                        colsz.Lining  = r.Lining;
                        colsz.Filling = r.Filling;
                        //colsz.GarmentLength = "dummy length";
                        //colsz.Collar = "dummy collar";
                        //colsz.Fastening = "dummy fastening";
                        //colsz.SleeveLength = "dummy sleeve";
                        //colsz.InsideLeg = "dummy leg";
                        if (images != null && images.Length > 0)
                        {
                            foreach (string i in images)
                            {
                                FileInfo fi = new FileInfo(i);

                                colsz.Images.Add(new Image()
                                {
                                    ImageFileName = fi.Name
                                });
                            }
                        }
                        sty.ColorSizeVariations.Add(colsz);
                    }

                    // save XML
                    XmlSerializer mySerializer = new XmlSerializer(typeof(FcukProducts));
                    // To write to a file, create a StreamWriter object.
                    StreamWriter myWriter = new StreamWriter(string.Format("c:\\temp\\FCUK_Zalando_Products_{0}.xml", DateTime.Now.ToString("yyyyMMddHHmmss")));
                    mySerializer.Serialize(myWriter, sty);
                    using (var stringwriter = new System.IO.StringWriter())
                    {
                        var serializer = new XmlSerializer(sty.GetType());
                        serializer.Serialize(stringwriter, sty);
                        string myString = stringwriter.ToString();
                        //XmlTreeDisplay(myString);
                    }

                    myWriter.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("Message: <{0}>, line: <{1}>", ex.Message, ex.StackTrace), "Making XML from IBM data");
                }
            }
            Cursor.Current = Cursors.Default;
        }