Example #1
0
            public static void syncAll()
            {
                //   if (!new ClassSync.LastUpdDB().getUpd())
                {
                    if (connect)
                    {
                        Products.L.Clear();
                        ProductsBC_.list.Clear();
                        StockReal.L.Clear();
                        TVA_.L.Clear();
                        SubGrpProduct.L.Clear();
                        GrpProduct.L.Clear();
                        infoClient.list.Clear();

                        ProductsBC_.set();
                        StockReal.set();
                        TVA_.set();
                        SubGrpProduct.set();
                        GrpProduct.set();
                        ClassGroupProduct.save();
                        ClassGroupProduct.loadFromFile();
                        ProductsWeb_.set();

                        Products.set();


                        infoClient.set();


                        ClassTVA.save();
                        ClassProducts.save();
                        ClassInfoClients.save();
                    }
                }
            }
Example #2
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);
                }
Example #3
0
            public static void syncSingleProduct()
            {
                object date = new LastUpdDB().getUpdAB();

                if (date != null)
                {
                    ClassGroupProduct.loadFromFile();
                    ClassTVA.loadFromFile();
                    ClassProducts.loadFronFile();

                    List <ProductDB.Products> productsAB = ProductDB.Products.selAB(DateTime.Parse(date.ToString()).AddMinutes(-1), DateTime.Now.AddMinutes(1));


                    if (productsAB.Count > 0)
                    {
                        string s = "Les produits suivante a été modifié : " + Environment.NewLine;

                        foreach (var p in productsAB)
                        {
                            // ClassProducts.modifAddOnlyFile(ClassProducts.DbToVar(p));


                            try
                            {
                                s += p.Name + " (" + p.CodeBare + ") - " + "QTY : " + p.StockReal_.Count() + " - Prix : € " + Environment.NewLine;
                            }


                            catch (Exception ex)
                            {
                                string text = "KOD 013214" + ex.Message;

                                //   new ClassFunctuon().showMessageSB(text);

                                new ClassLog(text);
                            }
                        }

                        //   new ClassFunctuon().showMessageTimeList(s);
                    }
                }
            }