/// <summary>
        /// من أجل البحث المتقم
        /// </summary>
        /// <param name="Stringa">الأسم</param>
        /// <param name="SerchAdvaCoursClass">كلاس البحث المتقدم</param>
        /// <param name="idJop">مصفوفة المناصب</param>
        /// <param name="IdTeam">مصفوفة الفرق</param>
        /// <param name="ActivVitel">هل المتطوع فعال</param>
        /// <param name="InformationSelect"></param>
        /// <param name="SqlCmaand"></param>
        /// <param name="DataGridViewX1"></param>
        /// <param name="DateFrom"></param>
        /// <param name="DateEnd"></param>
        /// <returns></returns>
        public static async Task WaitSqlsersh(string Stringa, SerchAdvaCoursClass SerchAdvaCoursClass, List <int> idJop, List <int> IdTeam, bool ActivVitel, string InformationSelect, SqlCommand SqlCmaand, DevComponents.DotNetBar.Controls.DataGridViewX DataGridViewX1, DateTime DateFrom, DateTime DateEnd)
        {
            await openConction();

            SqlCommand sqlcom1 = null;

            sqlcom1 = Vitl.SerchRetIdInformation(Stringa, InformationSelect, SqlCmaand, DateFrom, DateEnd);

            sqlcom1.Connection = SqlConnection1;
            IAsyncResult result = sqlcom1.BeginExecuteReader();

            SqlDataReader reader = sqlcom1.EndExecuteReader(result);

            DataGridViewX1.Rows.Clear();

            List <IDinformationAdvSrchFullCoures> IDinformationAdvSrchListProsses = new List <IDinformationAdvSrchFullCoures>();

            try
            {
                int NumberDub = reader.FieldCount;


                while (await reader.ReadAsync())
                {
                    IDinformationAdvSrchListProsses.Add(new IDinformationAdvSrchFullCoures(reader.GetInt32(0)));
                }
            }


            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }

            finally
            {
                reader.Close();
            }
            ///هاد من شان البحث هل المتطوع لديه هذا المنصب
            for (int i = 0; i < idJop.Count; i++)
            {
                for (int j = 0; j < IDinformationAdvSrchListProsses.Count; j++)
                {
                    if (await Team.RetHaveVitelJop(IDinformationAdvSrchListProsses[j].idinformation, idJop[i]))
                    {
                        IDinformationAdvSrchListProsses[j].AddJop(idJop[i]);
                    }
                }
            }
            // هاد من أجل البحث هل المتطوع لديه الدوره
            for (int i = 0; i < SerchAdvaCoursClass.idTypeofcorsSerch.Count; i++)
            {
                for (int j = 0; j < IDinformationAdvSrchListProsses.Count; j++)
                {
                    if (await Couress.GetIsItHaveCouresByIdInformation(IDinformationAdvSrchListProsses[j].idinformation, SerchAdvaCoursClass.idTypeofcorsSerch[i], true, !SerchAdvaCoursClass.idTypeofcorsSerchbool[i]))
                    {
                        IDinformationAdvSrchListProsses[j].AddCoures(SerchAdvaCoursClass.idTypeofcorsSerch[i]);
                    }
                }
            }
            //هل هذا المتطوع في الفريق
            for (int i = 0; i < IdTeam.Count; i++)
            {
                for (int j = 0; j < IDinformationAdvSrchListProsses.Count; j++)
                {
                    if (await Team.RetHaveVitelTeam(IDinformationAdvSrchListProsses[j].idinformation, IdTeam[i]))
                    {
                        IDinformationAdvSrchListProsses[j].AddTeam(IdTeam[i]);
                    }
                }
            }
            ///من أجل المتطوعين الفعالين
            if (ActivVitel)
            {
                for (int j = 0; j < IDinformationAdvSrchListProsses.Count; j++)
                {
                    if (await Team.RetHaveVitelACtiv(IDinformationAdvSrchListProsses[j].idinformation))
                    {
                        IDinformationAdvSrchListProsses[j].SetAtciv();
                    }
                }
            }

            List <IDinformationAdvSrchFullCoures> IDView = await IDinformationAdvSrchFullCoures.GetHaveAll(SerchAdvaCoursClass.idTypeofcorsSerch, idJop, IdTeam, ActivVitel, IDinformationAdvSrchListProsses);

            List <List <object> > obj = new List <List <object> > ();

            obj = await Sqldatabasethrding.GetSql(Vitl.Serhid(IDView));



            foreach (List <object> item in obj)
            {
                int i = 0;
                DataGridViewX1.Rows.Add(item[i].ToString(), item[++i].ToString(), item[++i].ToString(), item[++i].ToString(), item[++i].ToString(), item[++i].ToString(), item[++i].ToString(), item[++i].ToString());
            }
        }
Ejemplo n.º 2
0
        private static bool GetHave(List <int> IdCour, List <int> IdJop, List <int> IdTeam, bool IsActiv, IDinformationAdvSrchFullCoures IDinformationAdvSrchFullCoures)
        {
            if (IsActiv)
            {
                if (!IDinformationAdvSrchFullCoures.IsActiv)
                {
                    return(false);
                }
            }

            foreach (var Cour in IdCour)
            {
                if (IDinformationAdvSrchFullCoures.ListCoures.IndexOf(Cour) == -1)
                {
                    return(false);
                }
            }

            foreach (var Cour in IdJop)
            {
                if (IDinformationAdvSrchFullCoures.ListJop.IndexOf(Cour) == -1)
                {
                    return(false);
                }
            }
            foreach (var Cour in IdTeam)
            {
                if (IDinformationAdvSrchFullCoures.ListTeam.IndexOf(Cour) == -1)
                {
                    return(false);
                }
            }
            return(true);
        }