Ejemplo n.º 1
0
                public static List <StockReal> sel(Guid ProductsCustumerId, Guid Establishment_CustomerId)
                {
                    List <object[]> l = new ClassDB(null).queryResonse(
                        "SELECT * FROM StockReal WHERE (ProductsCustumerId = '" + ProductsCustumerId + "' AND  Establishment_CustomerId ='" + Establishment_CustomerId + "') ");

                    return(ListObjToStockReal(l));
                }
Ejemplo n.º 2
0
            public static void set()
            {
                List <object[]> S = new ClassDB(null).queryResonse("SELECT * FROM InfoClients WHERE TypeClient ='2'");

                foreach (object[] s in S)
                {
                    InfoClients ic = new InfoClients();
                    ic.custumerId                     = (Guid)s[0];
                    ic.TypeClient                     = (int)s[1];
                    ic.Sex                            = (int)s[2];
                    ic.Name                           = s[3].ToString();
                    ic.Surname                        = s[4].ToString();
                    ic.NameCompany                    = s[5].ToString();
                    ic.SIRET                          = s[6].ToString();
                    ic.FRTVA                          = s[7].ToString();
                    ic.OfficeAddress                  = s[8].ToString();
                    ic.OfficeZipCode                  = s[9].ToString();
                    ic.OfficeCity                     = s[10].ToString();
                    ic.HomeAddress                    = s[11].ToString();
                    ic.HomeZipCode                    = s[12].ToString();
                    ic.HomeCity                       = s[13].ToString();
                    ic.Telephone                      = s[14].ToString();
                    ic.Mail                           = s[15].ToString();
                    ic.Password                       = s[16].ToString();
                    ic.Countrys_CustomerId            = (Guid)s[17];
                    ic.FavoritesProductAutoCustomerId = (Guid)s[18];
                    ic.Nclient                        = s[19].ToString();
                    list.Add(ic);
                }
            }
Ejemplo n.º 3
0
                public static void set()
                {
                    List <object[]> l = new ClassDB(null).queryResonse("SELECT * FROM TVA");

                    foreach (object[] o in l)
                    {
                        TVA_ t = new TVA_();
                        t.CustumerId = (Guid)o[0];
                        t.Id         = (string)o[1];
                        t.val        = (string)o[2];
                        L.Add(t);
                    }
                }
Ejemplo n.º 4
0
                public static void set()
                {
                    List <object[]> l = new ClassDB(null).queryResonse("SELECT * FROM SubGrpNameSet");

                    foreach (object[] o in l)
                    {
                        SubGrpProduct sg = new SubGrpProduct();
                        sg.Id            = (int)o[0];
                        sg.SubGroupName  = (string)o[1];
                        sg.GrpProductId  = (int)o[2];
                        sg.GrpProductSet = null;
                        L.Add(sg);
                    }
                }
Ejemplo n.º 5
0
                public static void set()
                {
                    List <object[]> S = new ClassDB(null).queryResonse("SELECT * FROM TranslateNameProductsSet");


                    foreach (object[] s in S)
                    {
                        TranslateNameProductsSet t = new TranslateNameProductsSet();
                        t.CustomerId        = (Guid)s[0];
                        t.ProductCustomerId = (Guid)((s[1] is DBNull ? Guid.Empty : s[1]));
                        t.cod_lng           = s[2].ToString();
                        t.Name    = s[3].ToString();
                        t.Details = s[4].ToString();
                        list.Add(t);
                    }
                }
Ejemplo n.º 6
0
                public static void set()
                {
                    List <object[]> S = new ClassDB(null).queryResonse("SELECT * FROM ProductsBC");


                    foreach (object[] s in S)
                    {
                        ProductsBC_ p = new ProductsBC_();
                        p.CustomerId        = (Guid)s[0];
                        p.CustomerIdProduct = (Guid)((s[1] is DBNull ? Guid.Empty : s[1]));
                        p.CodeBar           = s[2].ToString();
                        p.QTY         = (decimal)(s[3] is DBNull ? 1.0m : s[3]);
                        p.Description = s[4].ToString();
                        list.Add(p);
                    }
                }
Ejemplo n.º 7
0
                public static void set()
                {
                    List <object[]> l = new ClassDB(null).queryResonse("SELECT * FROM GrpProductSet");

                    foreach (object[] o in l)
                    {
                        GrpProduct sg = new GrpProduct();
                        sg.Id        = (int)o[0];
                        sg.GroupName = (string)o[1];
                        foreach (var s in SubGrpProduct.L.FindAll(k => k.GrpProductId == sg.Id))
                        {
                            sg.SubGrpNameSet.Add(s);
                        }
                        L.Add(sg);
                    }
                }
Ejemplo n.º 8
0
                public static List <Products> selAB(DateTime a, DateTime b)
                {
                    string cmd = "SELECT * FROM Products WHERE (" + "[Date] >=  CAST('{DATETIME_A}' AS DateTime) AND [Date] <= CAST('{DATETIME_B}' AS DateTime))";

                    string c = cmd.Replace("{DATETIME_A}", a.ToString()).Replace("{DATETIME_B}", b.ToString());

                    List <object[]> S = new ClassDB(null).queryResonse(c);

                    List <Products> R = new List <Products>();

                    foreach (object[] s in S)
                    {
                        Products p = new Products();
                        p.CustumerId             = (Guid)s[0];
                        p.Name                   = (string)s[1];
                        p.CodeBare               = (string)s[2];
                        p.Desc                   = (string)s[3];
                        p.Chp_cat                = (short)s[4];
                        p.Balance                = (bool)s[5];
                        p.Contenance             = (decimal)s[6];
                        p.UniteContenance        = (int)s[7];
                        p.Tare                   = (int)s[8];
                        p.Date                   = (DateTime)s[9];
                        p.TVACustumerId          = (Guid)s[10];
                        p.ProductsWeb_CustomerId = (Guid)s[11];
                        //   p.ProductsAwaitingDeliveryCustomerId = (Guid)s[11];

                        List <ClassSync.ProductDB.GrpProduct> L = ClassGroupProduct.groupXMLToGrpProductTabl();

                        List <SubGrpProduct> lgp = L.Find(l => l.SubGrpNameSet.SingleOrDefault(lz => lz.Id == (int)s[12]) != null).SubGrpNameSet.ToList();

                        p.SubGrpProduct = lgp.Find(l => l.Id == (int)s[12]);


                        p.TVA = ClassTVA.xmlToDb().Find(l => l.CustumerId == p.TVACustumerId);

                        List <StockReal> lsr = StockReal.sel(p.CustumerId, ClassGlobalVar.IdEstablishment);

                        tstDubl(lsr, p, out p, false);


                        R.Add(p);
                    }

                    return(R);
                }
Ejemplo n.º 9
0
            public Establishment sel(Guid CustomerId)
            {
                object[] o = new ClassDB(null).queryResonse("SELECT * FROM Establishment WHERE CustomerId = '" + CustomerId + "'")[0];

                Establishment res = new Establishment();

                res.CustomerId = (Guid)o[0];
                res.Type       = (int)o[1];
                res.Name       = (string)o[2];
                res.CP         = (string)o[3];
                res.Ville      = (string)o[4];
                res.Adresse    = (string)o[5];
                res.Phone      = (string)o[6];
                res.Mail       = (string)o[7];

                return(res);
            }
Ejemplo n.º 10
0
            public void del(object o)
            {
                string cmd = "DELETE FROM StockReal WHERE ProductsCustumerId = '{CustumerId}'";

                ClassProducts.product p = (ClassProducts.product)o;
                string c = cmd.Replace("{CustumerId}", p.CustumerId.ToString());
                int    i = new ClassDB(null).queryNonResonse(c);

                cmd = "DELETE FROM Products  WHERE CustumerId= '{CustumerId}'";
                c   = cmd.Replace("{CustumerId}", p.CustumerId.ToString());
                i   = new ClassDB(null).queryNonResonse(c);

                cmd = "DELETE FROM ProductsWeb  WHERE CustomerId= '{CustomerId}'";
                c   = cmd.Replace("{CustomerId}", p.ProductsWeb_CustomerId.ToString());
                i   = new ClassDB(null).queryNonResonse(c);

                new LastUpdDB().mod(ClassGlobalVar.nameTicket, DateTime.Now, ClassGlobalVar.user, ClassGlobalVar.CustumerId, true);
            }
Ejemplo n.º 11
0
                public static void set()
                {
                    List <object[]> S = new ClassDB(null).queryResonse("SELECT * FROM Products");



                    foreach (object[] s in S)
                    {
                        Products p = new Products();

                        p.CustumerId = (Guid)s[0];

                        var t = TranslateNameProductsSet.get(p.CustumerId, "FR");

                        p.Name                   = t != null ? t.Name : (string)s[1];
                        p.CodeBare               = (string)s[2];
                        p.Desc                   = (string)s[3];
                        p.Chp_cat                = (short)s[4];
                        p.Balance                = (bool)s[5];
                        p.Contenance             = (decimal)s[6];
                        p.UniteContenance        = (int)s[7];
                        p.Tare                   = (int)s[8];
                        p.Date                   = (DateTime)s[9];
                        p.TVACustumerId          = (Guid)s[10];
                        p.ProductsWeb_CustomerId = (Guid)s[11];
                        //   p.ProductsAwaitingDeliveryCustomerId = (Guid)s[11];

                        p.SubGrpProduct = SubGrpProduct.L.Find(l => l.Id == (int)s[12]) ?? SubGrpProduct.L.First();

                        p.TVA = TVA_.L.Find(l => l.CustumerId == p.TVACustumerId);

                        List <StockReal> lsr = StockReal.L.FindAll(l => (l.ProductsCustumerId == p.CustumerId) &&
                                                                   (l.IdEstablishment == ClassGlobalVar.IdEstablishment)
                                                                   );


                        tstDubl(lsr, p, out p, true);

                        p.ProductsWeb_ = ProductsWeb_.R.Find(l => l.CustomerId == p.ProductsWeb_CustomerId);
                        p.bc           = new List <ProductsBC_>();
                        p.bc.AddRange(ProductsBC_.list.Where(l => l.CustomerIdProduct == p.CustumerId));
                        L.Add(p);
                    }
                }
Ejemplo n.º 12
0
                public static TranslateNameProductsSet get(Guid ProductCustomerId_, string cod_lng_)
                {
                    List <object[]> S = new ClassDB(null).queryResonse("SELECT * FROM TranslateNameProductsSet WHERE ProductCustomerId='" + ProductCustomerId_.ToString() + "' AND cod_lng=' " + cod_lng_ + "'");


                    List <TranslateNameProductsSet> l = new List <TranslateNameProductsSet>();

                    foreach (object[] s in S)
                    {
                        TranslateNameProductsSet t = new TranslateNameProductsSet();
                        t.CustomerId        = (Guid)s[0];
                        t.ProductCustomerId = (Guid)((s[1] is DBNull ? Guid.Empty : s[1]));
                        t.cod_lng           = s[2].ToString();
                        t.Name    = s[3].ToString();
                        t.Details = s[4].ToString();
                        l.Add(t);
                    }

                    return(l.FirstOrDefault());
                }
Ejemplo n.º 13
0
                public static void set()
                {
                    List <object[]> S = new ClassDB(null).queryResonse("SELECT * FROM ProductsWeb");


                    foreach (object[] s in S)
                    {
                        ProductsWeb_ p = new ProductsWeb_();
                        p.CustomerId       = (Guid)s[0];
                        p.Visible          = (bool)((s[1] is DBNull ? false : s[1]));
                        p.Images           = s[2].ToString();
                        p.DescrCourt       = s[3].ToString();
                        p.DescrLong        = s[4].ToString();
                        p.Volume           = (decimal)(s[5] is DBNull ? 0.0m : s[5]);
                        p.UniteVolume      = (int)(s[6] is DBNull ? 0 : s[6]);
                        p.ContenanceBox    = (decimal)(s[7] is DBNull ? 0.0m : s[7]);
                        p.ContenancePallet = (decimal)(s[8] is DBNull ? 0.0m : s[8]);
                        p.Weight           = (decimal)(s[9] is DBNull ? 0.0m : s[9]);
                        p.Frozen           = (bool)(s[10] is DBNull ? false : s[10]);

                        R.Add(p);
                    }
                }
Ejemplo n.º 14
0
                public static void set()
                {
                    List <object[]> l = new ClassDB(null).queryResonse("SELECT * FROM StockReal ");

                    L = ListObjToStockReal(l);
                }