Example #1
0
    protected void ButtonFindFriends_Click(object sender, EventArgs e)
    {
        localhostWebService.WebService service = new localhostWebService.WebService();
        DataSet dataset = new DataSet();
        string FullName = TextBoxSearchFriend.Text;
        int x = 0;
        string LastName = "";

        for (int i = 0; i < FullName.Length; i++)//הפעולה מחלקת את הסטרינג השלם לשתי מילים: שם פרטי ושם משפחה
        {
            if (FullName[i].ToString() == " ")
            {
                x = i + 1;
            }        
        }
        LastName = FullName.Substring(x, FullName.Length-x);
        
        FullName = FullName.Substring(0, x-1);

        dataset = service.FindFriends(FullName, LastName);

        GridViewFriends.DataSource = dataset;
        Session["DataSetFriends"] = dataset;
        GridViewFriends.DataBind(); 
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        localhostWebService.WebService service = new localhostWebService.WebService();
        localhostWebService.ContactDetails contact = new localhostWebService.ContactDetails();
        phoneFriendList = new ArrayList();
        foreach (ListItem friend in CheckBoxListFriends.Items)
        {
            // רשימה של החברים שאיתם 
            // מעוניינים לשתף חברים
            if (friend.Selected)
            {
               phoneFriendList.Add(friend.Value);
            }
        }
        
        foreach (ListItem contactItem in CheckBoxListContacts.Items)
        { // עבור כל איש קשר ברשימה לשיתוף מעתיק לחבר
            //יצירת רשימה של אנשי הקשר
            if (contactItem.Selected)
            {
                contact = service.GetContactsByID(int.Parse(contactItem.Value));

                for (int i = 0; i < phoneFriendList.Count; i++ )
                {

                    moveContactsToAFriend(contact, phoneFriendList[i].ToString());

                }
            }
        }
    }
 private void Load_Friends_And_Contacts()
 {
     localhostWebService.WebService service = new localhostWebService.WebService();
     DataSet dataSet = new DataSet();
     dataSet = service.GetFriendsAndContacts(user);
     Session["DataSet"] = dataSet;
 }
Example #4
0
 public void PopulateGridViewWithContacts()
 {
     localhostWebService.WebService service = new localhostWebService.WebService();
     DataSet dataset = new DataSet();
     dataset = service.GetContacts(user);
     GridViewInfo.DataSource = dataset;
     GridViewInfo.DataBind();
 }
Example #5
0
    protected void GridViewFriends_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        localhostWebService.WebService service = new localhostWebService.WebService();
        localhostWebService.FriendDetails friend = new localhostWebService.FriendDetails();
        DataSet dataset=(DataSet)Session["DataSetFriends"];
        UserService userService = new UserService();
        if (e.CommandName == "chck")
        {
            friend.phoneIDAsking = user.phoneNumber;
            int index = Convert.ToInt32(e.CommandArgument);
            
            friend.phoneIDAccepting = dataset.Tables[0].Rows[index]["PhoneNumber"].ToString();
            friend.dateOfFriendship = DateTime.Now;
            friend.status = false;
            service.InsertFriend(friend);
            LabelMsg.Text = "הוסף בהתחלה";
        }


    }
 public void moveContactsToAFriend(localhostWebService.ContactDetails contact, string friendPhone)//כאשר לוחצים על הכפור יעבור המידע של אנשי הקשר שסומנו אל החברים שסומנו 
 {
     localhostWebService.WebService service = new localhostWebService.WebService();
     contact.userPhoneBelong = friendPhone;
     contact.status = "לאישור";
     try
     {
       if(!service.IfContactExist(contact))  // מוסיפים איש קשר רק אם לא קיים
       {
           service.InsertContact(contact);
       }
         Label1.Text = "yaaay";
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }