Esempio n. 1
0
        public Result GetPositionWithPositionNumber(string g)
        {
            string        v           = String.Format("SELECT OTSID,OTSNUM,OTSREF,OTSDEPDTDEB,OTSPDS,OTSARRADR1,OTSARRUSRPAYINTER, OTSDEPTIENOM,OTSARRTIENOM,OTSDTLIM,OTSARRDTDEB,OTSARRUSRVILCP,OTSDEPUSRVILCP,OTSARRADR2, OTSDEPADR1 ,OTSDEPADR2 ,OTSDEPADR2,OTSDEPUSRVILLIB,OTSDEPUSRPAYINTER,OTSDIV1,OTSDIV3,OTSCOL,OTSLONG,OTSLIVHAYON,OTSMEMO FROM ORDRE WHERE OTSNUM = '{0}'", g);
            SqlDataReader readerOrdre = new SqlCommand(v, GetConnection()).ExecuteReader();

            try
            {
                if (readerOrdre != null && readerOrdre.HasRows)
                {
                    while (readerOrdre.Read())
                    {
                        DetailClient dClient = new DetailClient();

                        dClient.raison_sociale = readerOrdre["OTSDEPTIENOM"] == null ? "" : readerOrdre["OTSDEPTIENOM"].ToString();
                        dClient.adresse        = String.Format("{0} {1}", readerOrdre["OTSDEPADR1"] == null ? "" : readerOrdre["OTSDEPADR1"], readerOrdre["OTSDEPADR2"] == null ? "" : readerOrdre["OTSDEPADR2"]);
                        dClient.code_postal    = readerOrdre["OTSDEPUSRVILCP"] == null ? "" : readerOrdre["OTSDEPUSRVILCP"].ToString();
                        dClient.ville          = readerOrdre["OTSDEPUSRVILLIB"] == null ? "" : readerOrdre["OTSDEPUSRVILLIB"].ToString();
                        dClient.pays           = readerOrdre["OTSDEPUSRPAYINTER"] == null ? "" : readerOrdre["OTSDEPUSRPAYINTER"].ToString();


                        DetailClient aClient = new DetailClient
                        {
                            raison_sociale = readerOrdre["OTSARRTIENOM"] == null ? "" : readerOrdre["OTSARRTIENOM"].ToString(),
                            adresse        = String.Format("{0} {1} {2}", readerOrdre["OTSARRADR1"] == null ? "" : readerOrdre["OTSARRADR1"], readerOrdre["OTSARRADR2"] == null ? "" : readerOrdre["OTSARRADR2"], readerOrdre["OTSARRADR1"] == null ? "" : readerOrdre["OTSARRADR1"]),
                            code_postal    = readerOrdre["OTSARRUSRVILCP"] == null ? "" : readerOrdre["OTSARRUSRVILCP"].ToString(),
                            ville          = readerOrdre["OTSARRUSRPAYINTER"] == null ? "" : readerOrdre["OTSARRUSRPAYINTER"].ToString(),
                            pays           = readerOrdre["OTSARRUSRPAYINTER"] == null ? "" : readerOrdre["OTSARRUSRPAYINTER"].ToString()
                        };

                        Arrivee a = new Arrivee();

                        a.date_livraison      = readerOrdre["OTSARRDTDEB"] == null ? "" : readerOrdre["OTSARRDTDEB"].ToString();
                        a.imperatif_livraison = readerOrdre["OTSDTLIM"] == null ? "" : readerOrdre["OTSDTLIM"].ToString();
                        a.destinataire        = aClient;

                        Depart d = new Depart
                        {
                            date_chargement = readerOrdre["OTSDEPDTDEB"] == null ? "" : readerOrdre["OTSDEPDTDEB"].ToString(),
                            expediteur      = dClient
                        };

                        Marchandise m = new Marchandise
                        {
                            palettes = new Palettes
                            {
                                facturees = readerOrdre["OTSDIV1"] == null ? 0 : Convert.ToInt32(readerOrdre["OTSDIV1"]),
                                //coup_de_fourches = (int)readerOrdre["OTSDIV3"]
                            },
                            nombre_colis = readerOrdre["OTSCOL"] == null ? 0 : Convert.ToInt32(readerOrdre["OTSCOL"]),
                            //m.metre_lineaire = (float)readerOrdre["OTSLONG"]; //isNUll
                            poids        = readerOrdre["OTSPDS"] == null ? 0 : (double)readerOrdre["OTSPDS"],
                            hayon_tp     = readerOrdre["OTSLIVHAYON"] == System.DBNull.Value ? false : Convert.ToBoolean(readerOrdre["OTSLIVHAYON"]),
                            observations = readerOrdre["OTSMEMO"] == null ? "" : readerOrdre["OTSMEMO"].ToString()
                        };



                        Result r = new Result();
                        r.id                = readerOrdre["OTSID"] == null ? 0 : Convert.ToInt32(readerOrdre["OTSID"]);
                        r.numero_chrono     = readerOrdre["OTSNUM"] == null ? "" : readerOrdre["OTSNUM"].ToString();
                        r.reference_interne = readerOrdre["OTSREF"] == null ? "" : readerOrdre["OTSREF"].ToString();
                        r.depart            = d;
                        r.arrivee           = a;
                        r.marchandise       = m;


                        return(r);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(null);
            }
            finally
            {
                readerOrdre.Close();
            }


            return(null);
        }
Esempio n. 2
0
        public Result GetPositionWithParcelNumber(string g)
        {
            string v = String.Format("select OTSID,OTSNUM,OTSREF,OTSDEPDTDEB,OTSPDS,OTSARRADR1,OTSARRUSRPAYINTER, OTSDEPTIENOM,OTSARRTIENOM,OTSDTLIM,OTSARRDTDEB,OTSARRUSRVILCP,OTSDEPUSRVILCP,OTSARRADR2, OTSDEPADR1 ,OTSDEPADR2 ,OTSDEPADR2,OTSDEPUSRVILLIB,OTSDEPUSRPAYINTER,OTSDIV1,OTSDIV3,OTSCOL,OTSLONG,OTSLIVHAYON,OTSMEMO from ORDRE as POS,ORDCOL as COL ,  QUAI,tOURNEEVILLE where POS.OTSID = COL.OTLOTSID AND COL.OTLNUMCB = '{0}'	AND otsarrvilid*= TOUVILID AND OTSVPECODE*= QUAVTOCODE", g);

            SqlDataReader readerOrdre = new SqlCommand(v, GetConnection()).ExecuteReader();

            try
            {
                if (readerOrdre != null && readerOrdre.HasRows)
                {
                    while (readerOrdre.Read())
                    {
                        DetailClient dClient = new DetailClient();

                        dClient.raison_sociale = readerOrdre["OTSDEPTIENOM"].ToString();
                        dClient.adresse        = String.Format("{0} {1}", readerOrdre["OTSDEPADR1"], readerOrdre["OTSDEPADR2"]);
                        dClient.code_postal    = readerOrdre["OTSDEPUSRVILCP"].ToString();
                        dClient.ville          = readerOrdre["OTSDEPUSRVILLIB"].ToString();
                        dClient.pays           = readerOrdre["OTSDEPUSRPAYINTER"].ToString();


                        DetailClient aClient = new DetailClient
                        {
                            raison_sociale = readerOrdre["OTSARRTIENOM"].ToString(),
                            adresse        = String.Format("{0} {1} {2}", readerOrdre["OTSARRADR1"], readerOrdre["OTSARRADR2"], readerOrdre["OTSARRADR1"]),
                            code_postal    = readerOrdre["OTSARRUSRVILCP"].ToString(),
                            ville          = readerOrdre["OTSARRUSRPAYINTER"].ToString(),
                            pays           = readerOrdre["OTSARRUSRPAYINTER"].ToString()
                        };

                        Arrivee a = new Arrivee();

                        a.date_livraison      = (readerOrdre["OTSARRDTDEB"]).ToString();
                        a.imperatif_livraison = (readerOrdre["OTSDTLIM"]).ToString();
                        a.destinataire        = aClient;

                        Depart d = new Depart
                        {
                            date_chargement = (readerOrdre["OTSDEPDTDEB"]).ToString(),
                            expediteur      = dClient
                        };

                        Marchandise m = new Marchandise();
                        m.palettes = new Palettes
                        {
                            facturees = Convert.ToInt32(readerOrdre["OTSDIV1"].ToString()),
                            //coup_de_fourches = (int)readerOrdre["OTSDIV3"]
                        };
                        m.nombre_colis = Convert.ToInt32(readerOrdre["OTSCOL"].ToString());
                        //m.metre_lineaire = (float)readerOrdre["OTSLONG"]; //isNUll
                        m.poids        = (double)readerOrdre["OTSPDS"];
                        m.hayon_tp     = Convert.ToBoolean((readerOrdre["OTSLIVHAYON"].ToString()) == "" ? "false" : readerOrdre["OTSLIVHAYON"].ToString());
                        m.observations = readerOrdre["OTSMEMO"].ToString();



                        Result r = new Result();
                        r.numero_chrono     = readerOrdre["OTSNUM"].ToString();
                        r.reference_interne = readerOrdre["OTSREF"].ToString();
                        r.depart            = d;
                        r.arrivee           = a;
                        r.marchandise       = m;


                        return(r);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(null);
            }
            finally
            {
                readerOrdre.Close();
            }


            return(null);
        }
Esempio n. 3
0
        public List <Result> GetPositionWithCodeChauffeur(string g, string dateTime1, string dateTime2)
        {
            string        v           = String.Format("select OTSID,OTSNUM,OTSREF,OTSDEPDTDEB,OTSPDS,OTSARRADR1,OTSARRUSRPAYINTER, OTSDEPTIENOM,OTSARRTIENOM,OTSDTLIM,OTSARRDTDEB,OTSARRUSRVILCP,OTSDEPUSRVILCP,OTSARRADR2, OTSDEPADR1 ,OTSDEPADR2 ,OTSDEPADR2,OTSDEPUSRVILLIB,OTSDEPUSRPAYINTER,OTSDIV1,OTSDIV3,OTSCOL,OTSLONG,OTSLIVHAYON,OTSMEMO from ordre , ordpla, voyage where voyid=otpvoyid and  otpotsid=otsid and OTPCHSALCODE='{0}' and VOYDEPDTDEB between '{1} 00:00:00' and  '{2} 23:59:59'", g, dateTime1, dateTime2);
            SqlDataReader readerOrdre = new SqlCommand(v, GetConnection()).ExecuteReader();

            try
            {
                if (readerOrdre != null && readerOrdre.HasRows)
                {
                    List <Result> res = new List <Result>();
                    while (readerOrdre.Read())
                    {
                        DetailClient dClient = new DetailClient();

                        dClient.raison_sociale = readerOrdre["OTSDEPTIENOM"].ToString();
                        dClient.adresse        = String.Format("{0} {1}", readerOrdre["OTSDEPADR1"], readerOrdre["OTSDEPADR2"]);
                        dClient.code_postal    = readerOrdre["OTSDEPUSRVILCP"].ToString();
                        dClient.ville          = readerOrdre["OTSDEPUSRVILLIB"].ToString();
                        dClient.pays           = readerOrdre["OTSDEPUSRPAYINTER"].ToString();


                        DetailClient aClient = new DetailClient
                        {
                            raison_sociale = readerOrdre["OTSARRTIENOM"].ToString(),
                            adresse        = String.Format("{0} {1} {2}", readerOrdre["OTSARRADR1"], readerOrdre["OTSARRADR2"], readerOrdre["OTSARRADR1"]),
                            code_postal    = readerOrdre["OTSARRUSRVILCP"].ToString(),
                            ville          = readerOrdre["OTSARRUSRPAYINTER"].ToString(),
                            pays           = readerOrdre["OTSARRUSRPAYINTER"].ToString()
                        };

                        Arrivee a = new Arrivee();

                        a.date_livraison      = (readerOrdre["OTSARRDTDEB"]).ToString();
                        a.imperatif_livraison = (readerOrdre["OTSDTLIM"]).ToString();
                        a.destinataire        = aClient;

                        Depart d = new Depart
                        {
                            date_chargement = (readerOrdre["OTSDEPDTDEB"]).ToString(),
                            expediteur      = dClient
                        };

                        Marchandise m = new Marchandise();
                        m.palettes = new Palettes
                        {
                            facturees = Convert.ToInt32(readerOrdre["OTSDIV1"].ToString()),
                            //coup_de_fourches = (int)readerOrdre["OTSDIV3"]
                        };
                        m.nombre_colis = Convert.ToInt32(readerOrdre["OTSCOL"].ToString());
                        //m.metre_lineaire = (float)readerOrdre["OTSLONG"]; //isNUll
                        m.poids = (double)readerOrdre["OTSPDS"];
                        //m.hayon_tp = Convert.ToBoolean((readerOrdre["OTSLIVHAYON"].ToString()) == "" ? "false" : readerOrdre["OTSLIVHAYON"].ToString());
                        m.observations = readerOrdre["OTSMEMO"].ToString();



                        Result r = new Result();
                        r.numero_chrono     = readerOrdre["OTSNUM"].ToString();
                        r.reference_interne = readerOrdre["OTSREF"].ToString();
                        r.depart            = d;
                        r.arrivee           = a;
                        r.marchandise       = m;

                        res.Add(r);
                    }

                    return(res);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(null);
            }
            finally
            {
                readerOrdre.Close();
            }

            return(null);
        }