Example #1
0
        public TrackingDataSet TrackCartonsForStoreDetail(string clientID, string storeNumber, DateTime from, DateTime to, string by, string tl)
        {
            //Get carton details
            TrackingDataSet       cartons = new TrackingDataSet();
            TrackingServiceClient client  = null;

            try {
                client = new TrackingServiceClient();
                DataSet ds = null;
                if (by.ToLower() == "delivery")
                {
                    ds = client.TrackCartonsForStoreByDeliveryDate(clientID, storeNumber, from, to, null);
                }
                else
                {
                    ds = client.TrackCartonsForStoreByPickupDate(clientID, storeNumber, from, to, null);
                }
                client.Close();

                //Snag the carton detail
                TrackingDataSet detail = new TrackingDataSet();
                if (ds.Tables["CartonDetailForStoreTable"] != null && ds.Tables["CartonDetailForStoreTable"].Rows.Count > 0)
                {
                    detail.Merge(ds, true, MissingSchemaAction.Ignore);
                }

                //Get all cartons for the specified tl
                cartons.Merge(detail.CartonDetailForStoreTable.Select("TL='" + tl + "'"));
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <TrackingFault> tfe) { client.Abort(); throw new ApplicationException(tfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(cartons);
        }
Example #2
0
        public override global::System.Data.DataSet Clone()
        {
            TrackingDataSet cln = ((TrackingDataSet)(base.Clone()));

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

            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);
        }
Example #4
0
 public TrackingStoreSummary(TrackingModel model, TrackingDataSet tls)
 {
     this.mClientID   = model.ClientID;
     this.mClientName = model.ClientName;
     this.mStore      = model.Store;
     this.mFrom       = model.From;
     this.mTo         = model.To;
     this.mBy         = model.By;
     this.mTLs        = new List <TrackingStoreTL>();
     for (int i = 0; i < tls.CartonDetailForStoreTable.Rows.Count; i++)
     {
         TrackingStoreTL tl = new TrackingStoreTL(tls.CartonDetailForStoreTable[i]);
         this.mTLs.Add(tl);
     }
 }
Example #5
0
 public TrackingStoreDetail(TrackingStoreSummary summary, string tl, TrackingDataSet cartons)
 {
     this.mClientID   = summary.ClientID;
     this.mClientName = summary.ClientName;
     this.mStore      = summary.Store;
     this.mFrom       = summary.From;
     this.mTo         = summary.To;
     this.mBy         = summary.By;
     this.mTL         = tl;
     this.mCartons    = new List <TrackingStoreCarton>();
     for (int i = 0; i < cartons.CartonDetailForStoreTable.Rows.Count; i++)
     {
         TrackingStoreCarton carton = new TrackingStoreCarton(cartons.CartonDetailForStoreTable[i]);
         this.mCartons.Add(carton);
     }
 }
Example #6
0
        public TrackingDataSet GetClients()
        {
            //Get a list of clients
            TrackingDataSet       clients = new TrackingDataSet();
            TrackingServiceClient client  = null;

            try {
                client = new TrackingServiceClient();

                //If user is:
                // Vendor: get list of all it's clients
                // Client: no need to get client's list - fill the drop-down with client's name
                // Argix: get list of all clients
                string      username = Membership.GetUser().UserName;
                ProfileBase profile  = HttpContext.Current.Profile;
                if (profile["ClientVendorID"].ToString() == "000" || Roles.IsUserInRole(username, "administrators"))
                {
                    DataSet ds = client.GetClients(null);
                    if (ds.Tables["ClientTable"] != null && ds.Tables["ClientTable"].Rows.Count > 0)
                    {
                        clients.Merge(ds);
                    }
                }
                else
                {
                    if (profile["Type"].ToString().ToLower() == "vendor")
                    {
                        DataSet ds = client.GetClients(profile["ClientVendorID"].ToString());
                        if (ds.Tables["ClientTable"] != null && ds.Tables["ClientTable"].Rows.Count > 0)
                        {
                            clients.Merge(ds);
                        }
                    }
                    else
                    {
                        clients.ClientTable.AddClientTableRow(profile["ClientVendorID"].ToString(), "", profile["Company"].ToString(), "");
                    }
                }
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            finally { client.Close(); }
            return(clients);
        }
Example #7
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();
                TrackingDataSet ds = new TrackingDataSet();

                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 = "ClientTableDataTable";
                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);
            }
Example #8
0
        public TrackingDataSet TrackCartonsForStoreSummary(string clientID, string storeNumber, DateTime from, DateTime to, string by)
        {
            //Get TL summary
            TrackingDataSet       tlSummary = new TrackingDataSet();
            TrackingServiceClient client    = null;

            try {
                client = new TrackingServiceClient();
                DataSet ds = null;
                if (by.ToLower() == "delivery")
                {
                    ds = client.TrackCartonsForStoreByDeliveryDate(clientID, storeNumber, from, to, null);
                }
                else
                {
                    ds = client.TrackCartonsForStoreByPickupDate(clientID, storeNumber, from, to, null);
                }
                client.Close();

                //Snag the carton detail
                TrackingDataSet detail = new TrackingDataSet();
                if (ds.Tables["CartonDetailForStoreTable"] != null && ds.Tables["CartonDetailForStoreTable"].Rows.Count > 0)
                {
                    detail.Merge(ds, true, MissingSchemaAction.Ignore);
                }

                //Build a summary by TL; start with a dataset of unique
                TrackingDataSet tls = new TrackingDataSet();
                tls.Merge(detail.CartonDetailForStoreTable.DefaultView.ToTable(true, new string[] { "TL" }));
                foreach (TrackingDataSet.CartonDetailForStoreTableRow tl in tls.CartonDetailForStoreTable.Rows)
                {
                    //Get one of the cartons from this TL group
                    TrackingDataSet.CartonDetailForStoreTableRow tlCarton0 = (TrackingDataSet.CartonDetailForStoreTableRow)(detail.CartonDetailForStoreTable.Select("TL='" + tl.TL + "'", "TL ASC"))[0];

                    tl.Store       = tlCarton0.Store;
                    tl.CartonCount = detail.CartonDetailForStoreTable.Select("TL='" + tl.TL + "'").Length;
                    tl.Weight      = int.Parse(detail.CartonDetailForStoreTable.Compute("Sum(weight)", "TL='" + tl.TL + "'").ToString());
                    tl.CBOL        = tlCarton0.IsCBOLNull() ? "" : tlCarton0.CBOL;
                    object minDate = detail.CartonDetailForStoreTable.Compute("Min(PodDate)", "TL='" + tl.TL + "' AND (IsNull(PodDate,#01/01/1900#) <> #01/01/1900#)");
                    if (minDate != System.DBNull.Value)
                    {
                        tl.PodDate = DateTime.Parse(minDate.ToString());
                    }
                    else
                    {
                        if (!tlCarton0.IsOFD1Null())
                        {
                            tl.OFD1 = tlCarton0.OFD1;
                        }
                    }
                    tl.AG     = !tlCarton0.IsAGNull() ? tlCarton0.AG : "";
                    tl.AgName = tlCarton0.Trf == "N" ? tlCarton0.AgName : tlCarton0.AgName + " (Transfer)";
                    tl.AcceptChanges();
                }
                tlSummary.Merge(tls);
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <TrackingFault> tfe) { client.Abort(); throw new ApplicationException(tfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(tlSummary);
        }