public string WithJSON(string LastLogin)  /// get list of notes
        {

            JavaScriptSerializer ser = new JavaScriptSerializer();

            DBConnection DBop = new DBConnection(); 
            DataTable dataTable = new DataTable();
             string[] myname =null;
                  string[] datesin=null; 
              int HasNewNews = 0;
            dataTable = DBop.NewConectionDLL.SelectDataSet("News", "top 10 NewsTitle,NewsDate ", "NewsDate>= '" + LastLogin + "'", " NewsDate DESC").Tables[0];
            if ((dataTable != null) && (dataTable.Rows.Count > 0))
            {
                myname = new string[dataTable.Rows.Count];
                datesin = new string[dataTable.Rows.Count];
                HasNewNews = 1;
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
datesin[i]=Convert.ToString (dataTable.Rows[i]["NewsTitle"]);
myname[i] = Convert.ToString(dataTable.Rows[i]["NewsDate"]);
                }

    }
      

            var jsonData = new
            {
                NewNews = HasNewNews,
                name = myname  ,
             DateUp=datesin 
            };

            return ser.Serialize(jsonData); //products.ToString();
        }
        public ErrorTrack ReturnLastLocation(string PhoneMac)
        {
            DBConnection DBop = new DBConnection();
            ErrorTrack error = new ErrorTrack();

            /// check if this account avilable
            DataTable dataTable = new DataTable();
            dataTable = DBop.NewConectionDLL.SelectDataSet("AdminPhones", " * ", "PhoneMac like '" + PhoneMac + "'").Tables[0];
            if ((dataTable != null) && (dataTable.Rows.Count > 0))
            {
                int PhoneID = (int)dataTable.Rows[0]["PhoneID"];

                dataTable = DBop.NewConectionDLL.SelectDataSet("Tracking", " * ", "PhoneID=" + PhoneID + " and DateRecord=( select max(DateRecord) from Tracking where PhoneID=" + PhoneID + ")").Tables[0];
                if ((dataTable != null) && (dataTable.Rows.Count > 0))
                {
                    TrackingTable[] mytrack1 = new TrackingTable[dataTable.Rows.Count];
                    for (int i = 0; i < dataTable.Rows.Count; i++)
                    {
                        mytrack1[i] = new TrackingTable();
                        mytrack1[i].Latitude = (Double)dataTable.Rows[i]["Latitude"];
                        mytrack1[i].longitude = (Double)dataTable.Rows[i]["longitude"];
                        mytrack1[i].DateRecord = (DateTime)dataTable.Rows[i]["DateRecord"];

                    }
                    error.myTrack = mytrack1;
                    error.ErrorID = 2;
                    error.ErrorMessage = "Greate you find record";
                    return error;

                }
                else
                {
                    error.ErrorID = 1;
                    error.ErrorMessage = "Error , cannot Find Records in this date Range";
                    return error;
                }


            }
            else
            {
                error.ErrorID = 1;
                error.ErrorMessage = "Error , this phone isnot register in your database";
                return error;
            }


        }
        public ErrorTrack ReturnTrackRange(string PhoneMac, string FromDate,string Todate)
        {
            DBConnection DBop = new DBConnection();
            ErrorTrack error = new ErrorTrack();

            /// check if this account avilable
            DataTable dataTable = new DataTable();
            dataTable = DBop.NewConectionDLL.SelectDataSet("AdminPhones", " * ", "PhoneMac like '" + PhoneMac + "'").Tables[0];
            if ((dataTable != null) && (dataTable.Rows.Count > 0))
            {
                int PhoneID = (int)dataTable.Rows[0]["PhoneID"];

                dataTable = DBop.NewConectionDLL.SelectDataSet("Tracking", " * ", "DateRecord Between '" + FromDate + "' AND '" + Todate + "' and PhoneID="+ PhoneID +" order by DateRecord DESC").Tables[0];
                if ((dataTable != null) && (dataTable.Rows.Count > 0))
                {
                   TrackingTable[] mytrack1 = new TrackingTable[dataTable.Rows.Count ];
                    for (int i = 0; i < dataTable.Rows.Count;i++ )
                    {
                        mytrack1[i] = new TrackingTable();
                      mytrack1[i].Latitude = (Double)dataTable.Rows[i]["Latitude"];
                      mytrack1[i].longitude = (Double)dataTable.Rows[i]["longitude"];
                        mytrack1[i].DateRecord = (DateTime)dataTable.Rows[i]["DateRecord"];

                    }
                    error.myTrack = mytrack1;
                        error.ErrorID = 2;
                    error.ErrorMessage = "Greate you insert new record";
                    return error;

                }
                else
                {
                    error.ErrorID = 1;
                    error.ErrorMessage = "Error , cannot Find Records in this date Range";
                    return error;
                }


            }
            else
            {
                error.ErrorID = 1;
                error.ErrorMessage = "Error , this phone isnot register in your database";
                return error;
            }
        }
        public ErrorAdminPhones ReturnAdminPhones(int UserID)
        {
            DBConnection DBop = new DBConnection();
            ErrorAdminPhones error = new ErrorAdminPhones();
  DataTable dataTable = new DataTable();
                dataTable = DBop.NewConectionDLL.SelectDataSet("AdminPhones", " * ", "UserID=" + UserID).Tables[0];
                if ((dataTable != null) && (dataTable.Rows.Count > 0))
                {
                    AdminPhonesTable[] mytrack1 = new AdminPhonesTable[dataTable.Rows.Count];
                    for (int i = 0; i < dataTable.Rows.Count; i++)
                    {
                        mytrack1[i] = new AdminPhonesTable();
                        mytrack1[i].PhoneMac = (string)dataTable.Rows[i]["PhoneMac"];
                        mytrack1[i].PhoneName = (string)dataTable.Rows[i]["PhoneName"];
                        

                    }
                    error.myphones= mytrack1;
                    error.ErrorID = 2;
                    error.ErrorMessage = "Greate you insert new record";
                    return error;

                }
                else
                {
                    error.ErrorID = 1;
                    error.ErrorMessage = "Error , cannot Find Records in this date Range";
                    return error;
                }


            }
        public ReturnError InsertTrackR(string PhoneMac, string Latitude, string   longitude)
        {
            DBConnection DBop = new DBConnection();
            ReturnError error = new ReturnError();

            /// check if this account avilable
            DataTable dataTable = new DataTable();
            dataTable = DBop.NewConectionDLL.SelectDataSet("AdminPhones", " * ", "PhoneMac like '" + PhoneMac + "'").Tables[0];
            if ((dataTable != null) && (dataTable.Rows.Count > 0))
            {
                int PhoneID = (int)dataTable.Rows[0]["PhoneID"];

                ColoumnParam[] Coloumns = new ColoumnParam[4];
                Coloumns[0] = new ColoumnParam("Latitude", ColoumnType.Float, Latitude);
                Coloumns[1] = new ColoumnParam("longitude", ColoumnType.Float, longitude);
                Coloumns[2] = new ColoumnParam("PhoneID", ColoumnType.Int, PhoneID);
                Coloumns[3] = new ColoumnParam("DateRecord", ColoumnType.DateTime, DateTime.Now);
                if (DBop.NewConectionDLL.InsertRow("Tracking", Coloumns))
                {

                    error.ErrorID = 2;
                    error.ErrorMessage = "Greate you insert new record";
                    return error;

                }
                else
                {
                    error.ErrorID = 1;
                    error.ErrorMessage = "Error , cannot insert this record in the Database";
                    return error;
                }


            }
            else
            {
                error.ErrorID = 1;
                error.ErrorMessage = "Error , this phone isnot register in your database";
                return error;
            }
        }
        public ReturnError OpenAccount(string FullName, string UserName, String Password, Boolean AccountType,string EmailAdrress)
        {
            DBConnection DBop = new DBConnection();
            ReturnError error = new ReturnError();
            /// check if empty data
            if (( FullName.Length==0)||(  UserName.Length==0)||(Password.Length==0)||( EmailAdrress.Length==0))
            {
                error.ErrorID = 1;
                error.ErrorMessage = "please fill all your information";
                return error;
            }

            /// check if this account avilable
            DataTable dataTable = new DataTable();
            dataTable = DBop.NewConectionDLL.SelectDataSet("Admins", " * ", "UserName like '" + UserName + "' or EmailAdrress like '" + EmailAdrress + "'").Tables[0];
            if ((dataTable != null) && (dataTable.Rows.Count > 0))
            {
                error.ErrorID = 1;
                error.ErrorMessage = "the user name or email address already used by other account try with different email or user name";
                return error;
            }

            /// save new account
            /// 
            ColoumnParam[] Coloumns = new ColoumnParam[6];
            Coloumns[0] = new ColoumnParam("FullName", ColoumnType.varchar50, FullName);
            Coloumns[1] = new ColoumnParam("UserName", ColoumnType.varchar50, UserName);
            Coloumns[2] = new ColoumnParam("Password", ColoumnType.varchar50, Password);
            Coloumns[3] = new ColoumnParam("AccountType", ColoumnType.Bit, AccountType);
            Coloumns[4] = new ColoumnParam("DateRegister", ColoumnType.DateTime, DateTime.Now);
            Coloumns[5] = new ColoumnParam("EmailAdrress", ColoumnType.varchar50, EmailAdrress);
            if (DBop.NewConectionDLL.InsertRow("Admins", Coloumns))
            {
                dataTable = DBop.NewConectionDLL.SelectDataSet("Admins", " * ", "UserName like '" + UserName + "'").Tables[0];

                
                /////send email to new account=========================================================
                // System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
                // mail.To.Add(EmailAdrress);
                // mail.From = new MailAddress( "*****@*****.**" , "Email head", System.Text.Encoding.UTF8);
                // mail.Subject = "Complete your final steps with  my phone locations";
                //mail.SubjectEncoding = System.Text.Encoding.UTF8;
                //mail.Body = "Thank you for using my phone locations system" + Environment.NewLine + "Your account  now ready to be used.  please setup this app from google play on your phone" + Environment.NewLine + "https://play.google.com/store/apps/details?id=phonelocation.example.asuss550c.phonelocation" + Environment.NewLine + "Then from setting login with your user name and password." + Environment.NewLine + "And enjoy." + Environment.NewLine + "Best regards,"; 
                //mail.BodyEncoding = System.Text.Encoding.UTF8;
                //mail.IsBodyHtml = true;
                //mail.Priority = MailPriority.High;
                //SmtpClient client = new SmtpClient();
                //client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "abc3551356");
                //client.Port = 25;
                //client.Host = "mail.alrubaye.com";
                //client.EnableSsl = true;
                //try
                //{
                //    client.Send(mail);
                //   // Page.RegisterStartupScript("UserMsg", "<script>alert('Successfully Send...');if(alert){ window.location='SendMail.aspx';}</script>");
                //}
                //catch (Exception ex)
                //{
                //    Exception ex2 = ex;
                //    string errorMessage = string.Empty;
                //    while (ex2 != null)
                //    {
                //        errorMessage += ex2.ToString();
                //        ex2 = ex2.InnerException;
                //    }
                //  //  Page.RegisterStartupScript("UserMsg", "<script>alert('Sending Failed...');if(alert){ window.location='SendMail.aspx';}</script>");
                //}
                error.ErrorID = 2;
                error.AdminID = (int)dataTable.Rows[0]["UserID"];
                error.ErrorMessage = "Greate you insert new record";
                return error;
            }
            else
            {
                error.ErrorID = 1;
                error.ErrorMessage = "Error , cannot insert this record in the Database";
                return error;
            }


        }
        public ReturnError IsExisitAccount(string UserName, string Password)
        {
            DBConnection DBop = new DBConnection();
            ReturnError error = new ReturnError();

            /// check if this account avilable
            DataTable dataTable = new DataTable();
            dataTable = DBop.NewConectionDLL.SelectDataSet("Admins", " * ", "UserName like '" + UserName + "' AND Password like '" + Password + "'").Tables[0];
            if ((dataTable != null) && (dataTable.Rows.Count > 0))
            {
                error.ErrorID = 2;
                error.AdminID = (int)dataTable.Rows[0]["UserID"];
                error.ErrorMessage = "Greate we find  record";
                return error;
            }


            else
            {
                error.ErrorID = 1;
                error.ErrorMessage = "Error , cannot find this record in the Database";
                return error;
            }


        }
        public ReturnError InsertPhoneInfo(int UserID, string PhoneMac, string PhoneName)
        {
            DBConnection DBop = new DBConnection();
            ReturnError error = new ReturnError();

            /// check if this account avilable
            DataTable dataTable = new DataTable();
            dataTable = DBop.NewConectionDLL.SelectDataSet("Admins", " * ", "UserID=" + UserID).Tables[0];
            if ((dataTable != null) && (dataTable.Rows.Count > 0))
            {
                Boolean isnulti = (Boolean)dataTable.Rows[0]["AccountType"];
                dataTable = DBop.NewConectionDLL.SelectDataSet("AdminPhones", " * ", "PhoneMac like '" + PhoneMac + "'").Tables[0];
                if ((dataTable != null) && (dataTable.Rows.Count > 0))
                {
                    error.ErrorID = 1;
                    error.ErrorMessage = "this phone is already registered in database";
                    return error;
                }
                // check if this phone is not comercial
                
                if (isnulti == false)
                {
                    dataTable = DBop.NewConectionDLL.SelectDataSet("AdminPhones", " * ", "UserID=" + UserID ).Tables[0];
                    if ((dataTable != null) && (dataTable.Rows.Count > 0))
                    {
                        error.ErrorID = 1;
                        error.ErrorMessage = "this type of account is for one device only";
                        return error;
                    }
                }
               
                ColoumnParam[] Coloumns = new ColoumnParam[4];
                Coloumns[0] = new ColoumnParam("UserID", ColoumnType.Int, UserID);
                Coloumns[1] = new ColoumnParam("PhoneMac", ColoumnType.varchar50, PhoneMac);
                Coloumns[2] = new ColoumnParam("DateRegister", ColoumnType.DateTime, DateTime.Now);
                Coloumns[3] = new ColoumnParam("PhoneName", ColoumnType.varchar50, PhoneName);
                if (DBop.NewConectionDLL.InsertRow("AdminPhones", Coloumns))
                {

                    error.ErrorID = 2;
                    error.ErrorMessage = "Greate you insert new record";
                    return error;

                }
                else
                {
                    error.ErrorID = 1;
                    error.ErrorMessage = "Error , cannot insert this record in the Database";
                    return error;
                }



            }


            else
            {
                error.ErrorID = 1;
                error.ErrorMessage = "Error , cannot find this record in the Database";
                return error;
            }


        }
        public ReturnError ReturnLastLocationPN(string PhoneNumber)
        {
            DBConnection DBop = new DBConnection();
            ReturnError error = new ReturnError();

            string[] Phones = PhoneNumber.Split(':');
          
            for (int k = 0; k < Phones.Length - 1; k++)
            {
                /// check if this account avilable
                DataTable dataTable = new DataTable();
              
                dataTable = DBop.NewConectionDLL.SelectDataSet("AdminPhones", " * ", "PhoneNumber like '%" + Phones[k] + "' and IsVisabale=1").Tables[0];
                if ((dataTable != null) && (dataTable.Rows.Count > 0))
                {
                    int PhoneID = (int)dataTable.Rows[0]["PhoneID"];

                    dataTable = DBop.NewConectionDLL.SelectDataSet("Tracking", " * ", "PhoneID=" + PhoneID + " and DateRecord=( select max(DateRecord) from Tracking where PhoneID=" + PhoneID + ")").Tables[0];
                    if ((dataTable != null) && (dataTable.Rows.Count > 0))
                    {
                          
                            error.ErrorMessage = error.ErrorMessage + ":" + Phones[k];
                          
                    }



                }

            } // for for
            if (error.ErrorMessage != null)
            {
               // error.myTrack = mytrack1;
                error.ErrorID = 2;
               // error.ErrorMessage = "Greate you find record";
                return error;
            }
            else
            {
                error.ErrorID = 1;
                error.ErrorMessage = "Error ,we cannot find any  friend for this phone";
                return error;
            }

        }
        public ReturnError ReturnLastLocationPNOne(string PhoneNumber)
        {
            DBConnection DBop = new DBConnection();
            ReturnError error = new ReturnError();

            /// check if this account avilable
            DataTable dataTable = new DataTable();
            dataTable = DBop.NewConectionDLL.SelectDataSet("AdminPhones", " * ", "PhoneNumber like '%" + PhoneNumber + "' and IsVisabale=1").Tables[0];
            if ((dataTable != null) && (dataTable.Rows.Count > 0))
            {
                int PhoneID = (int)dataTable.Rows[0]["PhoneID"];
                
                dataTable = DBop.NewConectionDLL.SelectDataSet("Tracking", " * ", "PhoneID=" + PhoneID + " and DateRecord=( select max(DateRecord) from Tracking where PhoneID=" + PhoneID + ")").Tables[0];
                if ((dataTable != null) && (dataTable.Rows.Count > 0))
                {

                    error.ErrorMessage = dataTable.Rows[0]["Latitude"].ToString() + ":" + dataTable.Rows[0]["longitude"].ToString() + ":" + dataTable.Rows[0]["DateRecord"].ToString();
                    error.ErrorID = 2;
                   // error.ErrorMessage = "Greate you find record";
                    return error;

                }
                else
                {
                    error.ErrorID = 1;
                    error.ErrorMessage = "Error , cannot Find Records in this date Range";
                    return error;
                }


            }
            else
            {
                error.ErrorID = 1;
                error.ErrorMessage = "You Cannot access to this person location. may be he dont allow you to see his location or he didnot install (my phone locations)";
                return error;
            }


        }
        public ReturnError InsertPhoneNumberPrivicy( string PhoneMac, string PhoneNumber, Boolean IsVisabale)
        {
            DBConnection DBop = new DBConnection();
            ReturnError error = new ReturnError();

            /// check if this account avilable
            DataTable dataTable = new DataTable();
             
              
                dataTable = DBop.NewConectionDLL.SelectDataSet("AdminPhones", " * ", "PhoneMac like '" + PhoneMac + "' and PhoneNumber like '" + PhoneNumber +"'").Tables[0];
                if ((dataTable != null) && (dataTable.Rows.Count > 0))
                {

                    ColoumnParam[] Coloumns = new ColoumnParam[1];
                    
                     Coloumns[0] = new ColoumnParam("IsVisabale", ColoumnType.Bit, IsVisabale);

                     if (DBop.NewConectionDLL.UpdateRow("AdminPhones", Coloumns, "PhoneMac like '" + PhoneMac + "' and PhoneNumber like '" + PhoneNumber + "'"))
                    {

                        error.ErrorID = 2;
                        error.ErrorMessage = "Greate you update the record";
                        return error;

                    }
                    else
                    {
                        error.ErrorID = 1;
                        error.ErrorMessage = "Error , cannot insert this record in the Database";
                        return error;
                    }

                }
                else
                {
                    error.ErrorID = 1;
                    error.ErrorMessage = "Error , this phone is not registared in database";
                    return error;
                }
 

          


        }
        public ReturnError OpenAccount(string FullName, string UserName, String Password, Boolean AccountType, string EmailAdrress)
        {
            DBConnection DBop = new DBConnection();
            ReturnError error = new ReturnError();
            /// check if empty data
            if ((FullName.Length == 0) || (UserName.Length == 0) || (Password.Length == 0) || (EmailAdrress.Length == 0))
            {
                error.ErrorID = 1;
                error.ErrorMessage = "please fill all your information";
                return error;
            }

            /// check if this account avilable
            DataTable dataTable = new DataTable();
            dataTable = DBop.NewConectionDLL.SelectDataSet("Admins", " * ", "UserName like '" + UserName + "' or EmailAdrress like '" + EmailAdrress + "'").Tables[0];
            if ((dataTable != null) && (dataTable.Rows.Count > 0))
            {
                error.ErrorID = 1;
                error.ErrorMessage = "the user name or email address already used by other account try with different email or user name";
                return error;
            }

            /// save new account
            /// 
            ColoumnParam[] Coloumns = new ColoumnParam[6];
            Coloumns[0] = new ColoumnParam("FullName", ColoumnType.varchar50, FullName);
            Coloumns[1] = new ColoumnParam("UserName", ColoumnType.varchar50, UserName);
            Coloumns[2] = new ColoumnParam("Password", ColoumnType.varchar50, Password);
            Coloumns[3] = new ColoumnParam("AccountType", ColoumnType.Bit, AccountType);
            Coloumns[4] = new ColoumnParam("DateRegister", ColoumnType.DateTime, DateTime.Now);
            Coloumns[5] = new ColoumnParam("EmailAdrress", ColoumnType.varchar50, EmailAdrress);
            if (DBop.NewConectionDLL.InsertRow("Admins", Coloumns))
            {
               dataTable = DBop.NewConectionDLL.SelectDataSet("Admins", " * ", "UserName like '" + UserName + "'").Tables[0];

              //  dataTable = DBop.NewConectionDLL.SelectDataSet("Admins", " * " ).Tables[0];
                /////send email to new account=========================================================
                // System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
                // mail.To.Add(EmailAdrress);
                // mail.From = new MailAddress( "*****@*****.**" , "Email head", System.Text.Encoding.UTF8);
                // mail.Subject = "Complete your final steps with  my phone locations";
                //mail.SubjectEncoding = System.Text.Encoding.UTF8;
              //  for (int i = 0; i < dataTable.Rows.Count; i++) { 
                    try
                    {

                        string smtpAddress = "mail.alrubaye.com";
                        int portNumber = 25;
                        bool enableSSL = false;

                        string emailFrom = "*****@*****.**";
                        string password = "******";
                        string emailTo =  EmailAdrress;
                        string subject = "Welcome in my phone location system";
                        string body = "Thank you for using my phone locations system \n" + "  \n Your account  now ready to be used.  please setup this app from google play on your phone \n" + "https://play.google.com/store/apps/details?id=phonelocation.example.asuss550c.phonelocation" + "\nThen from setting login with your user name and password." + "And enjoy." + "Best regards,";

                        using (MailMessage mail = new MailMessage())
                        {
                            mail.From = new MailAddress(emailFrom);
                            mail.To.Add(emailTo);
                            mail.Subject = subject;
                            mail.Body = body;
                            mail.IsBodyHtml = true;
                            // Can set to false, if you are sending pure text.

                            //  mail.Attachments.Add(new Attachment("C:\\SomeFile.txt"));
                            //  mail.Attachments.Add(new Attachment("C:\\SomeZip.zip"));

                            using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
                            {
                                smtp.Credentials = new NetworkCredential(emailFrom, password);
                                smtp.EnableSsl = enableSSL;
                                smtp.Send(mail);
                            }
                        }
                    }
                    catch (Exception ex) { }
                //} // for loop
                error.ErrorID = 2;
                error.AdminID = (int)dataTable.Rows[0]["UserID"];
                error.ErrorMessage = "Greate you insert new record";
                return error;
            }
            else
            {
                error.ErrorID = 1;
                error.ErrorMessage = "Error , cannot insert this record in the Database";
                return error;
            }


        }
        protected void Page_Load(object sender, EventArgs e)
        {
              if (Session["adminID"] == null)
                Response.Redirect("AdminLogin.aspx");

           

              if (!Page.IsPostBack)
              {

                  ///Images/StylesImage/business_user.png
                  ///Images/AdminImage/20%&6292015124826.jpg
                  DBConnection DBop = new DBConnection();
                  DataTable dataTable = new DataTable();
                  dataTable = DBop.NewConectionDLL.SelectDataSet("MyStudents", "AccountTypeID,StudentFirstName", "StudentID=" + Session["adminID"]).Tables[0];
                  if ((dataTable != null) && (dataTable.Rows.Count > 0))
                  {
                     // LaPathImage.Text = Convert.ToString(dataTable.Rows[0]["ImagePath"]);
                      // string Name = Convert.ToString(dataTable.Rows[0]["StudentFirstName"]);


                      int AccounType = Convert.ToInt32(dataTable.Rows[0]["AccountTypeID"]);
                      DataTable TBUse = new DataTable("tblUserSystemViewGrid");
                      //  add tabel coloumns
                      DataColumn keyField1 = new DataColumn("ViewUserID", typeof(int));
                      TBUse.Columns.Add(keyField1);
                      DataColumn keyField2 = new DataColumn("NameView", typeof(string));
                      TBUse.Columns.Add(keyField2);
                      DataColumn keyField3 = new DataColumn("ImageView", typeof(string));
                      TBUse.Columns.Add(keyField3);
                      DataColumn keyField4 = new DataColumn("LinkPageView", typeof(string));
                      TBUse.Columns.Add(keyField4);
                      DataColumn keyField5 = new DataColumn("ViewUserLevel", typeof(string));
                      TBUse.Columns.Add(keyField5);


                      //  add tabel contain
                      DataRow oneRow;
                      // 1
                      oneRow = TBUse.NewRow();

                      oneRow["ViewUserID"] = 1;
                      oneRow["NameView"] = "التنبيهات";
                      oneRow["ImageView"] = "~/Images/StylesImage/image.png";
                      oneRow["LinkPageView"] = "MyDashoard.aspx";
                      oneRow["ViewUserLevel"] = "1,2,3 ";
                      TBUse.Rows.Add(oneRow);

                      oneRow = TBUse.NewRow();
                      oneRow["ViewUserID"] = 2;
                      oneRow["NameView"] = "الجدول";
                      oneRow["ImageView"] = "~/Images/StylesImage/calendar.png";
                      oneRow["LinkPageView"] = "TutorialSchedule.aspx";
                      oneRow["ViewUserLevel"] = "1,2,3"; ;
                      TBUse.Rows.Add(oneRow);
                      oneRow = TBUse.NewRow();
                      oneRow["ViewUserID"] =3;
                      oneRow["NameView"] = "واجباتي";
                      oneRow["ImageView"] = "~/Images/StylesImage/business_user_edit.png";
                      oneRow["LinkPageView"] = "MyHomeWorks.aspx";
                      oneRow["ViewUserLevel"] = "1,2,3";
                      TBUse.Rows.Add(oneRow);
                     

                      // 2
                      oneRow = TBUse.NewRow();
                      oneRow["ViewUserID"] = 4;
                      oneRow["NameView"] = "الحضور";
                      oneRow["ImageView"] = "~/Images/StylesImage/user-info-icon.png";
                      oneRow["LinkPageView"] = "StudentAttendance.aspx"; // "NewActivity.aspx?ID=C5AC851D-91C1-4A48-858A-2FAE20738FDC"; //
                      oneRow["ViewUserLevel"] = "1,2,3";
                      TBUse.Rows.Add(oneRow);
                      // 2
                      // 2
                      oneRow = TBUse.NewRow();
                      oneRow["ViewUserID"] = 5;
                      oneRow["NameView"] = "ادارةالطلاب";
                      oneRow["ImageView"] = "~/Images/StylesImage/user_add.png";
                      oneRow["LinkPageView"] = "ManageStudent.aspx";  //"~/NewActivity.aspx?ID=C5AC851D-91C1-4A48-858A-2FAE20738FDC"
                      oneRow["ViewUserLevel"] = "1,2";
                      TBUse.Rows.Add(oneRow);

                      //oneRow = TBUse.NewRow();
                      //oneRow["ViewUserID"] = 6;
                      //oneRow["NameView"] = "الدورات ";
                      //oneRow["ImageView"] = "~/Images/StylesImage/application_edit.png";
                      //oneRow["LinkPageView"] = "ManagedAccounts.aspx";
                      //oneRow["ViewUserLevel"] = "1";
                      //TBUse.Rows.Add(oneRow);
                      //peopleaccount
                      oneRow = TBUse.NewRow();
                      oneRow["ViewUserID"] = 7;
                      oneRow["NameView"] = "المراسلات";
                      oneRow["ImageView"] = "~/Images/StylesImage/messages.png";
                      oneRow["LinkPageView"] = "AddNews.aspx";
                      oneRow["ViewUserLevel"] = "2,1";
                      TBUse.Rows.Add(oneRow);
                      //Enrollnto.aspx
                      oneRow = TBUse.NewRow();
                      oneRow["ViewUserID"] = 8;
                      oneRow["NameView"] = "الدورات";
                      oneRow["ImageView"] = "~/Images/StylesImage/application_edit.png";
                      oneRow["LinkPageView"] = "Enrollnto.aspx";
                      oneRow["ViewUserLevel"] = "2,1,3";
                      TBUse.Rows.Add(oneRow);

                      //ManageMetrics
                      oneRow = TBUse.NewRow();
                      oneRow["ViewUserID"] = 9 ;
                      oneRow["NameView"] = "كلمة المرور";
                      oneRow["ImageView"] = "~/Images/StylesImage/Password.gif";
                      oneRow["LinkPageView"] = "ChangePssword.aspx";
                      oneRow["ViewUserLevel"] = "2,1,3";
                      TBUse.Rows.Add(oneRow);

                      ////EmployeesPerformance
                      oneRow = TBUse.NewRow();
                      oneRow["ViewUserID"] = 10;
                      oneRow["NameView"] = "خروج";
                      oneRow["ImageView"] = "~/Images/StylesImage/logtout.png";
                      oneRow["LinkPageView"] = "AdminLogin.aspx";
                      oneRow["ViewUserLevel"] = "2,1,3";
                      TBUse.Rows.Add(oneRow);

                      ////PeopleTracking
                      ////EmployeesPerformance
                      //oneRow = TBUse.NewRow();
                      //oneRow["ViewUserID"] = 7;
                      //oneRow["NameView"] = "Tracking";
                      //oneRow["ImageView"] = "~/Images/StylesImage/peopleTracking.png";
                      //oneRow["LinkPageView"] = "PeopleTracking.aspx";
                      //oneRow["ViewUserLevel"] = "2,1,3";
                      //TBUse.Rows.Add(oneRow);
                      ////EmployeesPerformance
                      //oneRow = TBUse.NewRow();
                      //oneRow["ViewUserID"] = 7;
                      //oneRow["NameView"] = "Project";
                      //oneRow["ImageView"] = "~/Images/StylesImage/project.png";
                      //oneRow["LinkPageView"] = "ManageProject.aspx";
                      //oneRow["ViewUserLevel"] = "2,1,3";
                    //  TBUse.Rows.Add(oneRow);
                      try
                      {
                          DataRow[] matchingRows = TBUse.Select(" ViewUserLevel LIKE '%" + AccounType + "%'", " ViewUserID");

                          DataTable FoundRow = TBUse.Clone();

                          foreach (DataRow dtRow in matchingRows)
                          {
                              FoundRow.ImportRow(dtRow);
                              // DataGridView1.DataSource = FoundRows
                          }
                          DataList1.DataSource = FoundRow;
                          DataList1.DataBind();
                      }
                      catch (Exception ex)
                      {
                          //  MsgBox(ex.Message);
                      }

                      // set admin pic




                  }
              }
        }