Beispiel #1
0
        public override global::System.Data.DataSet Clone()
        {
            DeliveryDataSet cln = ((DeliveryDataSet)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Beispiel #2
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            DeliveryDataSet ds = new DeliveryDataSet();

            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);
        }
Beispiel #3
0
        private void bwReport_DoWork(object sender, DoWorkEventArgs e)
        {
            DataTable     dt                  = new DeliveryDataSet().Tables["DeliveryTable"];
            List <String> productNoList       = rawMaterialList.Select(r => r.ProductNo).Distinct().ToList();
            var           materialUpperIdList = materialTypeList.Select(s => s.MaterialTypeId).Distinct().ToList();

            foreach (string productNo in productNoList)
            {
                OrdersModel order = orderList.Where(o => o.ProductNo == productNo).FirstOrDefault();
                //List<Int32> materialTypeIdList = rawMaterialList.Select(r => r.MaterialTypeId).Distinct().ToList();
                List <Int32> materialTypeIdList = rawMaterialList.Where(w => materialUpperIdList.Contains(w.MaterialTypeId)).Select(r => r.MaterialTypeId).Distinct().ToList();
                //Red!
                //materialTypeIdList.Remove(11);
                //materialTypeIdList.Remove(6);
                //materialTypeIdList.Remove(12);
                //materialTypeIdList.Remove(13);
                //materialTypeIdList.Remove(14);

                foreach (int materialTypeId in materialTypeIdList)
                {
                    RawMaterialModel rawMaterial = rawMaterialList.Where(r => r.ProductNo == productNo && r.MaterialTypeId == materialTypeId).FirstOrDefault();
                    if (rawMaterial != null && rawMaterial.ETD.Date != new DateTime(2000, 1, 1) && rawMaterial.ETD.Date == dateSearch.Date &&
                        rawMaterial.ActualDate.Date == new DateTime(2000, 1, 1))
                    {
                        DataRow dr = dt.NewRow();
                        dr["ProductNo"] = productNo;
                        if (order != null)
                        {
                            dr["ArticleNo"] = order.ArticleNo;
                            dr["ShoeName"]  = order.ShoeName;
                            dr["Quantity"]  = order.Quantity;
                            dr["ETD"]       = order.ETD;
                        }
                        dr["SupplierETD"] = rawMaterial.ETD;
                        dr["Remarks"]     = rawMaterial.Remarks;
                        MaterialTypeModel materialType = materialTypeList.Where(m => m.MaterialTypeId == rawMaterial.MaterialTypeId).FirstOrDefault();
                        if (materialType != null)
                        {
                            dr["Supplier"] = materialType.Name;
                        }
                        dt.Rows.Add(dr);
                    }
                }
            }
            e.Result = dt;
        }
Beispiel #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();
                DeliveryDataSet ds = new DeliveryDataSet();

                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 = "DeliveryTableDataTable";
                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);
            }
Beispiel #5
0
        public DeliveryDataSet GetListDataSet()
        {
            var myDataSet = new DeliveryDataSet();
            var brCode    = new BarcodeProcess();

            try
            {
                var company = new CompanyService(true).GetCompany();

                var lines = new DeliveryService().GetChilds(SelectedDelivery.Id, true)
                            .Where(d => d.DeliveryType == DeliveryLineRouteTypes.Delivering).ToList();

                foreach (var deliveryLineDTO in lines)
                {
                    var orderNum        = "" + SelectedDelivery.Number.Substring(1) + "_" + deliveryLineDTO.Number.Substring(1);
                    var linkno          = deliveryLineDTO.Id;
                    var deliverybarcode = ImageToByteArray(brCode.GetBarcode(orderNum, 320, 40, false), ImageFormat.Bmp);
                    myDataSet.ClientDetail.Rows.Add(
                        company.Header,
                        company.Footer,
                        company.Address.AddressDetail,
                        company.Address.SubCity,
                        company.Address.Kebele,
                        company.Address.HouseNumber,
                        company.Address.Telephone,
                        company.Address.Mobile,
                        company.Address.Fax,
                        company.Address.PrimaryEmail,
                        company.Address.AlternateEmail,
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        linkno.ToString(CultureInfo.InvariantCulture));

                    myDataSet.DeliveryLine.Rows.Add(
                        "1",
                        SelectedDelivery.Number + "-" + deliveryLineDTO.Number,
                        SelectedDelivery.OrderDateString,
                        "",
                        SelectedDelivery.OrderByClient.DisplayName,
                        SelectedDelivery.OrderByClient.Address.AddressDetail,
                        SelectedDelivery.OrderByClient.Address.Mobile,
                        SelectedDelivery.OrderByClient.Address.AlternateMobile,
                        SelectedDelivery.OrderByClient.Address.Telephone,
                        deliveryLineDTO.FromClient.DisplayName,
                        deliveryLineDTO.FromAddress.AddressDetail,
                        deliveryLineDTO.FromAddress.Mobile,
                        deliveryLineDTO.FromAddress.AlternateMobile,
                        deliveryLineDTO.FromAddress.Telephone,
                        deliveryLineDTO.ToClient.DisplayName,
                        deliveryLineDTO.ToAddress.AddressDetail,
                        deliveryLineDTO.ToAddress.Mobile,
                        deliveryLineDTO.ToAddress.AlternateMobile,
                        deliveryLineDTO.ToAddress.Telephone,
                        deliverybarcode,
                        "",
                        "",
                        "",
                        "",
                        "",
                        linkno.ToString(CultureInfo.InvariantCulture)
                        );

                    var serNo = 1;
                    foreach (var message in deliveryLineDTO.Messages)
                    {
                        myDataSet.DeliveryMessage.Rows.Add(
                            serNo,
                            message.Number,
                            message.Category.DisplayName,
                            message.UnitOfMeasure.DisplayName,
                            message.Description,
                            message.Unit,
                            "",
                            "",
                            "",
                            "",
                            "",
                            null,
                            linkno.ToString(CultureInfo.InvariantCulture));
                        serNo++;
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show("Can't get data for the report"
                                + Environment.NewLine + exception.Message, "Can't get data", MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }

            return(myDataSet);
        }