private void button5_Click(object sender, EventArgs e)
        {
            if (cBCategory.SelectedIndex < 0)
            {
                MessageBox.Show("Select Reminder");
            }
            else
            {
                UserSer     userS    = new UserSer();
                int         viewerID = userS.GetUserIdByEmail(comboBox2.SelectedItem.ToString());
                CategorySer cg       = new CategorySer();
                int         catID    = cg.GetCategoryID(comboBox3.SelectedItem.ToString(), LogIn.user_ID);
                TaskSer     tS       = new TaskSer();

                //MessageBox.Show(cBCategory.SelectedItem.ToString());


                int taskID = tS.GetTaskID(cBCategory.SelectedItem.ToString(), catID);
                userS = new UserSer();
                userS.Delete(viewerID, LogIn.user_ID, catID, taskID);
                cBCategory.Items.Remove(cBCategory.SelectedItem);
                cBCategory.Text = "";
            }
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            TaskSer      tS;
            List <int>   taskIdList = new List <int>();
            int          taskID;
            ShareTaskSer stS;
            int          recID;
            UserSer      uS = new UserSer();

            if (textBox1.Text != null)
            {
                if (uS.EmailValidity(textBox1.Text))
                {
                    if (comboBox1.Items.Count > 0)
                    {
                        for (int i = 0; i < comboBox1.Items.Count; i++)
                        {
                            tS     = new TaskSer();
                            taskID = tS.GetTaskID(comboBox1.Items[i].ToString(), cat_ID);
                            taskIdList.Add(taskID);
                        }
                        uS    = new UserSer();
                        recID = uS.GetUserIdByEmail(textBox1.Text);

                        stS = new ShareTaskSer();
                        ShareTask st = new ShareTask();
                        st.Cat_ID     = cat_ID;
                        st.SenderID   = LogIn.user_ID;
                        st.ReceiverId = recID;
                        stS.Insert(st, LogIn.user_ID);

                        for (int i = 0; i < taskIdList.Count; i++)
                        {
                            stS = new ShareTaskSer();
                            stS.Insert(cat_ID, taskIdList[i], LogIn.user_ID, recID);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Are you share all Project!!!!!!!");
                        uS    = new UserSer();
                        recID = uS.GetUserIdByEmail(textBox1.Text);

                        stS = new ShareTaskSer();
                        ShareTask st = new ShareTask();
                        st.Cat_ID     = cat_ID;
                        st.SenderID   = LogIn.user_ID;
                        st.ReceiverId = recID;
                        stS.Insert(st, LogIn.user_ID);

                        TaskSer    tkList   = new TaskSer();
                        List <int> taskList = tkList.GetAllTaskID(cat_ID);
                        for (int i = 0; i < taskList.Count; i++)
                        {
                            stS = new ShareTaskSer();
                            stS.Insert(cat_ID, taskList[i], LogIn.user_ID, recID);
                        }
                    }
                    MessageBox.Show("Tasks Are Shared!!!!!!!");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Please Input Valid User Email Address!!");
                }
            }
            else
            {
                MessageBox.Show("Please Input Email Address!!");
            }
        }