Пример #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();
                    }
                }
            }
Пример #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);
                }
Пример #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);
                    }
                }
            }
Пример #4
0
        public static product DbToVar(ClassSync.ProductDB.Products e)
        {
            product p = new product();

            //  p.ii = listProducts.Count() + 1;

            p.Images = new ClassF().getPathImg(e.CustumerId)[0];

            p.CustumerId = e.CustumerId;

            p.Name = e.Name;

            p.Desc = e.Desc;

            p.tva = int.Parse(e.TVA.Id);

            ClassSync.ProductDB.StockReal sr = null;
            if (e.StockReal_ != null)
            {
                sr = e.StockReal_.First(l => l.IdEstablishment == ClassGlobalVar.IdEstablishment);
            }

            if (sr == null)
            {
                sr = ClassSync.ProductDB.StockReal.addIsNull(p.CustumerId);
            }

            p.price = sr.Price;

            p.qty = sr.QTY;

            p.cusumerIdRealStock = sr.CustomerId;

            p.uniteContenance = e.UniteContenance;

            p.contenance = e.Contenance;

            p.tare = e.Tare;

            p.date = e.Date;

            p.CodeBare = e.CodeBare;

            p.balance = e.Balance;

            p.cusumerIdSubGroup = e.SubGrpProduct.Id;

            ClassGroupProduct.grp_subGrp gs = ClassGroupProduct.getGrpId(p.cusumerIdSubGroup);

            p.grp = gs.grp;

            p.sgrp = gs.subGrp;

            p.ProductsWeb_CustomerId = e.ProductsWeb_CustomerId;


            p.Visible = e.ProductsWeb_.Visible;

            p.DescrCourt       = e.ProductsWeb_.DescrCourt;
            p.DescrLong        = e.ProductsWeb_.DescrLong;
            p.Volume           = e.ProductsWeb_.Volume;
            p.UniteVolume      = e.ProductsWeb_.UniteVolume;
            p.ContenanceBox    = e.ProductsWeb_.ContenanceBox;
            p.ContenancePallet = e.ProductsWeb_.ContenancePallet;
            p.Weight           = e.ProductsWeb_.Weight;
            p.Frozen           = e.ProductsWeb_.Frozen;

            p.bc = e.bc;

            return(p);
        }