Exemple #1
0
            public Guid ins(object o)
            {
                ClassProducts.product p = (ClassProducts.product)o;



                string cmdProductWeb = "INSERT INTO ProductsWeb (CustomerId,[Visible],[Images],[ContenancePallet],[Weight],[Frozen]) VALUES ('"
                                       + p.ProductsWeb_CustomerId + "', 0, '', 0,0,0 )";

                new ClassDB(null).queryNonResonse(cmdProductWeb);


                string cmdInsProduct = "INSERT INTO Products (CustumerId,Name,CodeBare,[Desc],Chp_cat,Balance,Contenance,UniteContenance,Tare,[Date],TVACustumerId,"
                                       //  +"ProductsAwaitingDeliveryCustomerId,"
                                       + "ProductsWeb_CustomerId,SubGrpProduct_Id)"
                                       + "VALUES ('{CustumerId}','{Name}','{CodeBare}','{Desc}','{Chp_cat}','{Balance}','{Contenance}','{UniteContenance}','{Tare}', CAST('{Date}' AS DateTime),'{TVACustumerId}',"
                                       // +"'{ProductsAwaitingDeliveryCustomerId}',"
                                       + "'{ProductsWeb_CustomerId}','{SubGrpProduct_Id}')";



                string c = cmdInsProduct
                           .Replace("{CustumerId}", p.CustumerId.ToString())
                           .Replace("{Name}", p.Name.Replace("'", "''"))
                           .Replace("{CodeBare}", p.CodeBare)
                           .Replace("{Desc}", p.Desc.Replace("'", "''"))
                           .Replace("{Chp_cat}", "0")
                           .Replace("{Balance}", p.balance.ToString())
                           .Replace("{Contenance}", p.contenance.ToString().Replace(",", "."))
                           .Replace("{UniteContenance}", p.uniteContenance.ToString())
                           .Replace("{Tare}", p.tare.ToString())
                           .Replace("{Date}", DateTime.Now.ToString())
                           .Replace("{TVACustumerId}", ClassTVA.listTVA.Find(l => l.id == p.tva).CustumerId.ToString())
                           // .Replace("{ProductsAwaitingDeliveryCustomerId}", Guid.Empty.ToString())
                           .Replace("{ProductsWeb_CustomerId}", p.ProductsWeb_CustomerId.ToString())
                           .Replace("{SubGrpProduct_Id}", p.cusumerIdSubGroup.ToString()
                                    );

                new ClassDB(null).queryNonResonse(c);

                string cmdInsStockReal = "INSERT INTO StockReal (CustomerId,QTY,MinQTY,Price,ProductsCustumerId,Establishment_CustomerId)" +
                                         "VALUES ('{CustomerId}','{QTY}','{MinQTY}','{Price}','{ProductsCustumerId}','{Establishment_CustomerId}')";

                c = cmdInsStockReal
                    .Replace("{CustomerId}", p.cusumerIdRealStock.ToString())

                    .Replace("{QTY}", p.qty.ToString().Replace("'", "''"))
                    .Replace("{MinQTY}", "10")
                    .Replace("{Price}", p.price.ToString().Replace(",", "."))
                    .Replace("{ProductsCustumerId}", p.CustumerId.ToString())
                    .Replace("{Establishment_CustomerId}", ClassGlobalVar.IdEstablishment.ToString()
                             );
                new ClassDB(null).queryNonResonse(c);

                new LastUpdDB().mod(ClassGlobalVar.nameTicket, DateTime.Now, ClassGlobalVar.user, ClassGlobalVar.CustumerId, true);

                return(p.CustumerId);
            }
Exemple #2
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);
            }
Exemple #3
0
            public void mod(object o)
            {
                ClassProducts.product p = (ClassProducts.product)o;
                string cmdUpd           = "UPDATE Products SET [Name]='{Name}', [CodeBare]='{CodeBare}',[Desc]='{Desc}',[TVACustumerId]='{TVACustumerId}'," +
                                          "[SubGrpProduct_Id]='{SubGrpProduct_Id}',[Balance]='{Balance}',[Contenance]={Contenance},[UniteContenance]={UniteContenance}," +
                                          "[Tare]={Tare},[Date]=CAST('{Date}' AS DateTime) WHERE CustumerId= '{CustumerId}'";

                string c = cmdUpd
                           .Replace("{CustumerId}", p.CustumerId.ToString())
                           .Replace("{Name}", p.Name.Replace("'", "''"))
                           .Replace("{CodeBare}", p.CodeBare)
                           .Replace("{Desc}", p.Desc.Replace("'", "''"))
                           .Replace("{TVACustumerId}", ClassTVA.listTVA.Find(l => l.id == p.tva).CustumerId.ToString())

                           .Replace("{SubGrpProduct_Id}", p.sgrp.ToString())
                           .Replace("{Balance}", p.balance.ToString())
                           .Replace("{Contenance}", p.contenance.ToString().Replace(",", "."))
                           .Replace("{UniteContenance}", p.uniteContenance.ToString().Replace(",", "."))
                           .Replace("{Tare}", p.tare.ToString().Replace(",", "."))
                           .Replace("{Date}", DateTime.Now.ToString());

                new ClassDB(null).queryNonResonse(c);

                cmdUpd = "UPDATE StockReal SET QTY='{QTY}',MinQTY='{MinQTY}',Price='{Price}'," +
                         "ProductsCustumerId='{ProductsCustumerId}',Establishment_CustomerId='{Establishment_CustomerId}'" +
                         " WHERE CustomerId= '{CustomerId}'";
                c = cmdUpd


                    .Replace("{QTY}", p.qty.ToString().Replace(",", "."))
                    .Replace("{MinQTY}", "0")
                    .Replace("{Price}", p.price.ToString().Replace(",", "."))
                    .Replace("{ProductsCustumerId}", p.CustumerId.ToString())

                    .Replace("{Establishment_CustomerId}", ClassGlobalVar.IdEstablishment.ToString())
                    .Replace("{CustomerId}", p.cusumerIdRealStock.ToString()
                             );
                new ClassDB(null).queryNonResonse(c);

                new LastUpdDB().mod(ClassGlobalVar.nameTicket, DateTime.Now, ClassGlobalVar.user, ClassGlobalVar.CustumerId, true);
            }