コード例 #1
0
 public void SetDefaultEmpl(string str, IBODepotEmplacement emplacement, Action <IBOArticle3, Exception> callback)
 {
     try
     {
         callback(repos.SetDefaultEmpl(str, emplacement), null);
     }
     catch (Exception e)
     {
         callback(null, e);
     }
 }
コード例 #2
0
 public void GetArticles(IBODepotEmplacement emplacement, Action <Collection <Article>, Exception> callback)
 {
     try
     {
         callback(repos.GetArticles(emplacement), null);
     }
     catch (Exception e)
     {
         callback(null, e);
     }
 }
コード例 #3
0
        internal Collection <Article> GetArticles(IBODepotEmplacement emplacement)
        {
            using (SqlConnection cnx = new SqlConnection(cnxString))
            {
                cnx.Open();

                using (SqlCommand cmd = cnx.CreateCommand())
                {
                    cmd.CommandText = @"SELECT A.AR_Ref, A.AR_Design, A.AR_Ref, AE.AE_Ref, AG1.EG_Enumere AS Gamme1, AG2.EG_Enumere AS Gamme2,
                            CASE WHEN AG1.EG_Enumere IS NOT NULL THEN ISNULL(GS.GS_QteSto, 0) ELSE ISNULL(S.AS_QteSto, 0) END AS QteSto, 
                            CASE WHEN AG1.EG_Enumere IS NOT NULL THEN ISNULL(GS.GS_QteCom, 0) ELSE ISNULL(S.AS_QteCom, 0) END AS QteCom, 
                            CASE WHEN AG1.EG_Enumere IS NOT NULL THEN ISNULL(GS.GS_QteRes, 0) ELSE ISNULL(S.AS_QteRes, 0) END AS QteRes
                            FROM F_ARTICLE A
                            LEFT JOIN F_ARTGAMME AG1 ON AG1.AR_Ref = A.AR_Ref AND AG1.AG_Type = 0
                            LEFT JOIN F_ARTGAMME AG2 ON AG2.AR_Ref = A.AR_Ref AND AG2.AG_Type = 1
                            LEFT JOIN F_ARTENUMREF AE ON AE.AG_No1 = AG1.AG_No AND AE.AG_No2 = ISNULL(AG2.AG_No, 0)
                            LEFT JOIN F_ARTSTOCK S ON S.AR_Ref = A.AR_Ref 
                            LEFT JOIN F_GAMSTOCK GS ON GS.AR_Ref = A.AR_Ref AND GS.AG_No1 = AG1.AG_No AND GS.AG_No2 = ISNULL(AG2.AG_No, 0)
                            JOIN P_UNITE AS UV ON UV.cbIndice = A.AR_UniteVen 
                            JOIN F_ARTCLIENT AC ON AC.AR_Ref = A.AR_Ref AND AC.AC_Categorie = 1 
                            LEFT JOIN F_DEPOTEMPL DP ON S.DE_No = DP.DE_No AND S.DP_NoPrincipal = DP.DP_No 
                            JOIN F_DEPOT DE ON DE.DE_No = S.DE_No AND DE.DE_Code = @deCode
                            WHERE DP.DP_Code = @dpCode";
                    cmd.Parameters.AddWithValue("@deCode", emplacement.Depot.DE_Code);
                    cmd.Parameters.AddWithValue("@dpCode", emplacement.DP_Code);

                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        Collection <Article> list = new Collection <Article>();
                        while (reader.Read())
                        {
                            list.Add(new Article()
                            {
                                ArRef       = (string)reader["AR_Ref"],
                                AeRef       = (reader["AE_Ref"] == DBNull.Value) ? null : (string)reader["AE_Ref"],
                                Gamme1      = (reader["Gamme1"] == DBNull.Value) ? null : (string)reader["Gamme1"],
                                Gamme2      = (reader["Gamme2"] == DBNull.Value) ? null : (string)reader["Gamme2"],
                                Designation = reader["AR_Design"].ToString(),
                                Stock       = double.Parse(reader["QteSto"].ToString())
                            });
                        }

                        return(list);
                    }
                }
            }
        }
コード例 #4
0
        internal IBOArticle3 SetDefaultEmpl(string str, IBODepotEmplacement empl)
        {
            if (!openBaseCial())
            {
                throw new Exception("Impossible de se connecter à la base");
            }

            using (SqlConnection cnx = new SqlConnection(cnxString))
            {
                cnx.Open();
                using (SqlCommand cmd = cnx.CreateCommand())
                {
                    cmd.CommandText = @"SELECT DISTINCT A.AR_Ref, AE.AE_Ref, CO.CO_Ref, AG1.EG_Enumere AS Gamme1, AG2.EG_Enumere AS Gamme2
                                        FROM F_ARTICLE A
                                        LEFT JOIN F_ARTGAMME AG1 ON AG1.AR_Ref = A.AR_Ref AND AG1.AG_Type = 0
                                        LEFT JOIN F_ARTGAMME AG2 ON AG2.AR_Ref = A.AR_Ref AND AG2.AG_Type = 1
                                        LEFT JOIN F_ARTENUMREF AE ON AE.AG_No1 = AG1.AG_No AND AE.AG_No2 = ISNULL(AG2.AG_No, 0)
                                        JOIN F_ARTFOURNISS AF ON AF.AR_Ref = A.AR_Ref 
                                        LEFT JOIN F_TARIFGAM TG ON TG.AG_No1 = AG1.AG_No AND TG.AG_No2 = ISNULL(AG2.AG_No, 0) AND TG.TG_RefCF = AF.CT_Num
                                        LEFT JOIN F_CONDITION CO ON CO.AR_Ref = A.AR_Ref 
                                        WHERE A.AR_Ref = @str
                                        OR AE.AE_Ref = @str
                                        OR CO.CO_Ref = @str
                                        OR A.AR_CodeBarre = @str
                                        OR AF.AF_CodeBarre = @str
                                        OR AE.AE_CodeBarre = @str
                                        OR TG.TG_CodeBarre = @str
                                        OR CO.CO_CodeBarre = @str";
                    cmd.Parameters.AddWithValue("@str", str);

                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        if (!reader.HasRows)
                        {
                            throw new Exception("Article non trouvé");
                        }

                        reader.Read();
                        IBOArticle3 article = GetInstance().FactoryArticle.ReadReference(reader["AR_Ref"].ToString());

                        if (article.ArticleDepotPrincipal == null)
                        {
                            IBOArticleDepot3 ad = (IBOArticleDepot3)article.FactoryArticleDepot.Create();
                            ad.Depot = empl.Depot;
                            ad.EmplacementPrincipal = empl;
                            ad.WriteDefault();

                            article.Refresh();
                        }
                        else
                        {
                            article.ArticleDepotPrincipal.EmplacementPrincipal = empl;
                            article.ArticleDepotPrincipal.Write();
                            article.Refresh();
                        }

                        return(article);
                    }
                }
            }
        }
コード例 #5
0
 public void SetDefaultEmpl(string str, IBODepotEmplacement emplacement, Action <IBOArticle3, Exception> callback)
 {
     throw new NotImplementedException();
 }
コード例 #6
0
 public void GetArticles(IBODepotEmplacement emplacement, Action <Collection <Article>, Exception> callback)
 {
     throw new NotImplementedException();
 }