private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox2.SelectedIndex < 0)
            {
                MessageBox.Show("Select User Email!!!!");
            }
            else
            {
                string uEmail = comboBox2.SelectedItem.ToString();

                UserSer      userS     = new UserSer();
                int          uID       = userS.GetUserIdByEmail(uEmail);
                ShareTaskSer uS        = new ShareTaskSer();
                List <int>   catIDList = uS.GetCategoryID(LogIn.user_ID, uID);
                //MessageBox.Show(catIDList.Count.ToString());
                CategorySer   cS;
                List <string> catNameList = new List <string>();
                string        catName;

                for (int i = 0; i < catIDList.Count; i++)
                {
                    cS = new CategorySer();
                    //MessageBox.Show(catIDList[i].ToString());
                    catName = cS.GetCategoryName(catIDList[i], LogIn.user_ID);
                    catNameList.Add(catName);
                }

                for (int i = 0; i < catNameList.Count; i++)
                {
                    comboBox3.Items.Add(catNameList[i]);
                }
            }
        }
Esempio n. 2
0
        private void button8_Click(object sender, EventArgs e)
        {
            CategorySer        cg     = new CategorySer();
            int                cat_Id = cg.GetCategoryID(ProjectName, LogIn.user_ID);
            ShareCategroyTasks sct    = new ShareCategroyTasks(cat_Id);

            sct.Show();
        }
        private void UpdateAddTaskInfo_Load(object sender, EventArgs e)
        {
            CategorySer     catService = new CategorySer();
            List <Category> catList    = catService.GetAll(LogIn.user_ID);

            for (int i = 0; i < catList.Count; i++)
            {
                cBCategory.Items.Add(catList[i].Name);
            }
        }
Esempio n. 4
0
        public void ContentFormLoad(string name)
        {
            //CategoryListShow();
            ContentUserControl cuc = new ContentUserControl();

            cuc.ProjectName = name;
            CategorySer s      = new CategorySer();
            int         cat_ID = s.GetCategoryID(name, LogIn.user_ID);

            TaskListShow(cuc.Flow, cat_ID);
            panel4.Controls.Add(cuc);
        }
Esempio n. 5
0
        private void btnToday_Click(object sender, EventArgs e)
        {
            //Before


            //flowLayoutPanel1Today.Controls.Clear();
            //CategorySer cs = new CategorySer();
            //pnlContentChangeToday.BringToFront();
            //int catID = cs.GetCategoryID("Today");
            //TaskListShow(flowLayoutPanel1Today, catID);


            //if (!(flowLayoutPanel2.VerticalScroll.Value == 0 && scrollPos != 0))
            //    scrollPos = flowLayoutPanel2.VerticalScroll.Value;

            //only THis Open

            //HomePage2.home2.Close();
            //HomePage2.home2 = new HomePage2("Today");
            //HomePage2.home2.Show();

            //only THis Open

            //HomePage2.home2.ContentFormLoad("Today");


            //HomePage2.home2.flowLayoutPanel2.VerticalScroll.Value = scrollPos;



            //AFter

            try
            {
                //CategoryListShow();
                CategorySer s     = new CategorySer();
                int         catID = s.GetCategoryID("Today", LogIn.user_ID);

                TaskSer      taskS    = new TaskSer();
                List <Tasks> taskList = taskS.GetAll(catID);
                UserControlForOnlyTestPurpose.uC.Project_Name = "Today";
                UserControlForOnlyTestPurpose.uC.LoadTaskList(taskList);
            }


            catch (Exception ep)
            {
                MessageBox.Show(ep.Message);
            }
        }
Esempio n. 6
0
        private void button6_Click(object sender, EventArgs e)
        {
            CategorySer  cg       = new CategorySer();
            int          cat_Id   = cg.GetCategoryID(ProjectName, LogIn.user_ID);
            TaskSer      tk       = new TaskSer();
            List <Tasks> taskList = tk.GetAll(cat_Id);


            string spreadSheetPath = "E:\\SQL SERVER\\sajib.xlsx";

            File.Delete(spreadSheetPath);
            FileInfo spreadSheetInfo = new FileInfo(spreadSheetPath);

            ExcelPackage pck = new ExcelPackage(spreadSheetInfo);

            var workSheet = pck.Workbook.Worksheets.Add("My First");

            workSheet.Cells["A1"].Value = "Task_ID";
            workSheet.Cells["B1"].Value = "Task_Title";
            workSheet.Cells["C1"].Value = "Task_Date";
            workSheet.Cells["D1"].Value = "Task_Time";
            workSheet.Cells["E1"].Value = "Task_Repeat_Date_ID";
            workSheet.Cells["F1"].Value = "Task_Description";
            workSheet.Cells["G1"].Value = "Task_Priority";
            workSheet.Cells["H1"].Value = "Category_ID";
            workSheet.Cells["I1"].Value = "Task_Complete";

            int currentRow = 2;

            foreach (var tasklist in taskList)
            {
                workSheet.Cells["A" + currentRow.ToString()].Value = tasklist.Task_ID;
                workSheet.Cells["B" + currentRow.ToString()].Value = tasklist.Tittle;
                workSheet.Cells["C" + currentRow.ToString()].Value = Convert.ToDateTime(tasklist.Date).ToShortDateString();
                workSheet.Cells["D" + currentRow.ToString()].Value = tasklist.Time.ToString();
                workSheet.Cells["E" + currentRow.ToString()].Value = tasklist.RepeatDateTask_ID;

                workSheet.Cells["F" + currentRow.ToString()].Value = tasklist.Description;
                workSheet.Cells["G" + currentRow.ToString()].Value = tasklist.Priority;
                workSheet.Cells["H" + currentRow.ToString()].Value = tasklist.Category_ID;
                workSheet.Cells["I" + currentRow.ToString()].Value = tasklist.Task_Complete;

                currentRow++;
            }

            pck.Save();
            pck.Dispose();
            MessageBox.Show("File Is Exported");
        }
Esempio n. 7
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (!button5.Text.Equals("Show Uncompleted Task"))
            {
                button5.Text = "Show Uncompleted Task";
                flowLayoutPanel1Today.Controls.Clear();
                List <Tasks> tk;
                TaskSer      cs = new TaskSer();

                CategorySer cg     = new CategorySer();
                int         cat_Id = cg.GetCategoryID(ProjectName, LogIn.user_ID);
                //tk = cs.GetAll(cat_Id);
                cg = new CategorySer();
                tk = cs.GetAllCompleteOrNotTask(1, cat_Id);

                for (int i = 0; i < tk.Count; i++)
                {
                    AddTaskInfo ad = new AddTaskInfo();
                    ad.Tittle = tk[i].Tittle;
                    //DateTime dt = DateTime.Parse(tk[i].Date, "dddd, dd MMMM yyyy");
                    ad.Date    = Convert.ToDateTime(tk[i].Date).ToLongDateString();
                    ad.Task_ID = tk[i].Task_ID;
                    Bitmap img = new Bitmap("C:\\Users\\sajib\\source\\repos\\Task Manager\\image\\checkmark.png");
                    ad.Icon = img;
                    flowLayoutPanel1Today.Controls.Add(ad);
                }
            }
            else
            {
                button5.Text = "Show Completed Task";
                flowLayoutPanel1Today.Controls.Clear();
                List <Tasks> tk;
                TaskSer      cs     = new TaskSer();
                CategorySer  cg     = new CategorySer();
                int          cat_Id = cg.GetCategoryID(ProjectName, LogIn.user_ID);
                cg = new CategorySer();
                tk = cs.GetAll(cat_Id);

                for (int i = 0; i < tk.Count; i++)
                {
                    AddTaskInfo ad = new AddTaskInfo();
                    ad.Tittle  = tk[i].Tittle;
                    ad.Date    = Convert.ToDateTime(tk[i].Date).ToLongTimeString();
                    ad.Task_ID = tk[i].Task_ID;
                    flowLayoutPanel1Today.Controls.Add(ad);
                }
            }
        }
Esempio n. 8
0
        private void HomePage2_Load(object sender, EventArgs e)
        {
            //Before

            //CategoryListShow();

            //ContentUserControl cuc = new ContentUserControl();
            //CategorySer s = new CategorySer();


            //if(category_ID != 0)
            //    cuc.ProjectName = s.GetCategoryName(category_ID, LogIn.user_ID);
            //else if(CategoryName != "")
            //{
            //    category_ID = s.GetCategoryID(CategoryName, LogIn.user_ID);
            //    cuc.ProjectName = CategoryName;
            //}


            ////int cat_ID = s.GetCategoryID("Inbox");
            //TaskListShow(cuc.Flow, category_ID);
            //panel4.Controls.Add(cuc);


            //After

            try
            {
                if (checkFormLoadFirstTime == false)
                {
                    CategoryListShow();
                    CategorySer s     = new CategorySer();
                    int         catID = s.GetCategoryID("Inbox", LogIn.user_ID);

                    TaskSer      taskS    = new TaskSer();
                    List <Tasks> taskList = taskS.GetAll(catID);
                    UserControlForOnlyTestPurpose.uC.Project_Name = "Inbox";
                    UserControlForOnlyTestPurpose.uC.LoadTaskList(taskList);

                    checkFormLoadFirstTime = true;
                }
            }
            catch (Exception ep)
            {
                MessageBox.Show(ep.Message);
            }
        }
 private void button4_Click(object sender, EventArgs e)
 {
     if (comboBox3.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);
         userS = new UserSer();
         userS.Delete(viewerID, LogIn.user_ID, catID);
         comboBox3.Items.Remove(comboBox3.SelectedItem);
         comboBox3.Text = "";
     }
 }
Esempio n. 10
0
        //After



        public void ForProjectUserControl(string projectName)
        {
            try
            {
                CategorySer s     = new CategorySer();
                int         catID = s.GetCategoryID(projectName, LogIn.user_ID);

                TaskSer      taskS    = new TaskSer();
                List <Tasks> taskList = taskS.GetAll(catID);
                userControlForOnlyTestPurpose2.Project_Name = projectName;

                userControlForOnlyTestPurpose2.LoadTaskList(taskList);
            }
            catch (Exception ep)
            {
                MessageBox.Show(ep.Message);
            }
        }
Esempio n. 11
0
        public void CategoryListShow()
        {
            flowLayoutPanel2.Controls.Clear();
            CategorySer     catS    = new CategorySer();
            List <Category> catList = catS.GetAll(LogIn.user_ID);

            for (int i = 0; i < catList.Count; i++)
            {
                if (catList[i].Name.Equals("Inbox") || catList[i].Name.Equals("Today") || catList[i].Name.Equals("Next 7 Day"))
                {
                    continue;
                }
                pUC              = new ProjectUserControl();
                pUC.ProjectName  = catList[i].Name;
                pUC.ProjectColor = catList[i].Color;
                flowLayoutPanel2.Controls.Add(pUC);
            }
        }
Esempio n. 12
0
        private void btnInbox_Click(object sender, EventArgs e)
        {
            //After

            try
            {
                //CategoryListShow();
                CategorySer s     = new CategorySer();
                int         catID = s.GetCategoryID("Inbox", LogIn.user_ID);

                TaskSer      taskS    = new TaskSer();
                List <Tasks> taskList = taskS.GetAll(catID);
                UserControlForOnlyTestPurpose.uC.Project_Name = "Inbox";
                UserControlForOnlyTestPurpose.uC.LoadTaskList(taskList);
            }
            catch (Exception ep)
            {
                MessageBox.Show(ep.Message);
            }
        }
Esempio n. 13
0
        public void LoadDataInfoOfTask(Tasks obj)
        {
            button1.Text = "Update";

            this.obj              = obj;
            textBox1.Text         = obj.Tittle;
            textBox2.Text         = obj.Description;
            dateTimePicker2.Value = Convert.ToDateTime(obj.Date);
            dateTimePicker1.Value = Convert.ToDateTime(obj.Time);

            CategorySer cS = new CategorySer();

            cBCategory.Text = cS.GetCategoryName(obj.Category_ID, LogIn.user_ID);

            if (obj.Priority == 1)
            {
                cBPriority.Text = "Low";
            }
            else if (obj.Priority == 2)
            {
                cBPriority.Text = "Medium";
            }
            else
            {
                cBPriority.Text = "High";
            }

            if (obj.RepeatName == "")
            {
                cBRepeat.Text = "Doesn't Repeat";
            }
            else
            {
                cBRepeat.Text = obj.RepeatName;
            }

            for (int i = 0; i < obj.Notify_Time_List.Count; i++)
            {
                cBSelectedReminders.Items.Add(obj.Notify_Time_List[i].NotifyTimeBeforeString);
            }
        }
Esempio n. 14
0
        public void RefreshContent()
        {
            flowLayoutPanel1Today.Controls.Clear();
            List <Tasks> tk;
            TaskSer      cs     = new TaskSer();
            CategorySer  cg     = new CategorySer();
            int          cat_Id = cg.GetCategoryID(ProjectName, LogIn.user_ID);

            //MessageBox.Show(ProjectName);
            //MessageBox.Show(cat_Id.ToString());
            cg = new CategorySer();
            tk = cs.GetAllSortByDate(cat_Id);

            for (int i = 0; i < tk.Count; i++)
            {
                AddTaskInfo ad = new AddTaskInfo();
                ad.Tittle  = tk[i].Tittle;
                ad.Date    = Convert.ToDateTime(tk[i].Date).ToLongDateString();
                ad.Task_ID = tk[i].Task_ID;
                flowLayoutPanel1Today.Controls.Add(ad);
            }
        }
Esempio n. 15
0
        private void btnAddCategory_Click(object sender, EventArgs e)
        {
            if (tBoxCategoryName.Text != null && !(tBoxCategoryName.Text.Equals("Enter Project Name")))
            {
                Category cat = new Category();
                cat.Name = tBoxCategoryName.Text;
                if (cBoxColorList.SelectedIndex >= 0)
                {
                    cat.Color = cBoxColorList.SelectedIndex;
                }
                cat.UserID = LogIn.user_ID;
                CategorySer catS = new CategorySer();
                catS.Insert(cat, LogIn.user_ID);
                MessageBox.Show("Category Is Created");
                this.Close();

                HomePage2.home2.CategoryListShow();
            }
            else
            {
                MessageBox.Show("Please Enter The Project Name");
            }
        }
 private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox3.SelectedIndex < 0)
     {
         MessageBox.Show("Select Category!!!!");
     }
     else
     {
         string       catName  = comboBox3.SelectedItem.ToString();
         CategorySer  catS     = new CategorySer();
         int          catID    = catS.GetCategoryID(catName, LogIn.user_ID);
         ShareTaskSer tS       = new ShareTaskSer();
         List <int>   tkIDList = tS.GetAllTasksFromShareTasks(catID);
         TaskSer      taskService;
         string       tittle;
         for (int i = 0; i < tkIDList.Count; i++)
         {
             taskService = new TaskSer();
             tittle      = taskService.GetTaskTittle(catID, tkIDList[i]);
             cBCategory.Items.Add(tittle);
         }
     }
 }
Esempio n. 17
0
        private void btnAddCategory_Click(object sender, EventArgs e)
        {
            Category cat = new Category();

            cat.Name = tBoxCategoryName.Text;
            if (cBoxColorList.SelectedIndex >= 0)
            {
                cat.Color = cBoxColorList.SelectedIndex;
            }
            cat.UserID = LogIn.user_ID;
            CategorySer catS = new CategorySer();

            catS.Insert(cat, LogIn.user_ID);
            MessageBox.Show("Category Is Created");
            this.Close();

            HomePage2.home2.CategoryListShow();



            //HomePage2.home2.Close();
            //HomePage2.home2 = new HomePage2();
            //HomePage2.home2.Show();
        }
        private int GetCategoryID()
        {
            CategorySer cg = new CategorySer();

            return(cg.GetCategoryID(Project_Name, LogIn.user_ID));
        }
Esempio n. 19
0
        private void button1_Click(object sender, EventArgs e)
        {
            User uN = new User();

            if (textBox1.Text != null && !(textBox1.Text.Equals("Name...........")))
            {
                uN.UserName = textBox1.Text;
                if (textBox2.Text != null && !(textBox2.Text.Equals("Email...........")))
                {
                    uN.Email = textBox2.Text;
                    if (textBox3.Text != null && !(textBox3.Text.Equals("Phone...........")))
                    {
                        uN.Phone = textBox3.Text;
                        if (textBox4.Text != null && !(textBox4.Text.Equals("Password...........")))
                        {
                            uN.Password = textBox4.Text;

                            UserSer uSr = new UserSer();
                            uSr.Insert(uN);
                            uSr = new UserSer();
                            int         uid = uSr.GetUserID(uN.UserName);
                            CategorySer cgS = new CategorySer();

                            Category cat = new Category();
                            cat.Name   = "Inbox";
                            cat.UserID = uid;
                            cat.Color  = 0;
                            cgS.Insert(cat, LogIn.user_ID);

                            cat        = new Category();
                            cat.Name   = "Today";
                            cat.UserID = uid;
                            cat.Color  = 0;
                            cgS.Insert(cat, LogIn.user_ID);

                            cat        = new Category();
                            cat.Name   = "Next 7 Day";
                            cat.UserID = uid;
                            cat.Color  = 0;
                            cgS.Insert(cat, LogIn.user_ID);

                            this.Close();
                        }

                        else
                        {
                            MessageBox.Show("Please Input Your Password");
                        }
                    }

                    else
                    {
                        MessageBox.Show("Please Input Your Phone");
                    }
                }

                else
                {
                    MessageBox.Show("Please Input Your Email");
                }
            }

            else
            {
                MessageBox.Show("Please Input Your Name");
            }
        }
Esempio n. 20
0
 public AddTaskView()
 {
     addTaskView = this;
     InitializeComponent();
     cat = new CategorySer();
 }
Esempio n. 21
0
        private void AddTaskInDatabase()
        {
            List <string> repeateDateList = new List <string>(100);
            List <BeforeNotificationTime> notificationTimeList = new List <BeforeNotificationTime>();
            CategorySer cSer = new CategorySer();

            if (textBox1.Text != null)
            {
                Tasks ts = new Tasks();
                ts.Tittle = textBox1.Text;

                if (textBox2.Text != null)
                {
                    ts.Description = textBox2.Text;
                }

                ts.Date = dateTimePicker2.Value.ToShortDateString();
                ts.Time = dateTimePicker1.Value.ToString("hh:mm tt");

                if (cBCategory.SelectedIndex < 0)
                {
                    ts.Category_ID = cSer.GetCategoryID("Inbox", LogIn.user_ID);
                }
                else
                {
                    ts.Category_ID = cSer.GetCategoryID(cBCategory.SelectedItem.ToString(), LogIn.user_ID);
                }


                if (cBPriority.SelectedIndex < 0)
                {
                    ts.Priority = 1;
                }
                else
                {
                    if (cBPriority.SelectedItem.ToString().Equals("High"))
                    {
                        ts.Priority = 3;
                    }
                    else if (cBPriority.SelectedItem.ToString().Equals("Medium"))
                    {
                        ts.Priority = 2;
                    }
                    else
                    {
                        ts.Priority = 1;
                    }
                }


                if (cBRepeat.SelectedIndex < 0)
                {
                    ts.RepeatDateTask_ID = System.Guid.NewGuid().ToString();
                }
                else
                {
                    ts.RepeatDateTask_ID = System.Guid.NewGuid().ToString();
                    if (cBRepeat.SelectedItem.ToString().Equals("Every day"))
                    {
                        DateTime dt = DateTime.Now;
                        for (int i = 0; i < repeateDateList.Capacity; i++)
                        {
                            repeateDateList.Add(dt.ToShortDateString());
                            dt = dt.AddDays(1);
                        }
                    }
                    else if (cBRepeat.SelectedItem.ToString().Equals("Every week"))
                    {
                        DateTime dt = DateTime.Now;
                        for (int i = 0; i < repeateDateList.Capacity; i++)
                        {
                            repeateDateList.Add(dt.ToShortDateString());
                            dt = dt.AddDays(7);
                        }
                    }
                    else if (cBRepeat.SelectedItem.ToString().Equals("Every month"))
                    {
                        DateTime dt = DateTime.Now;
                        for (int i = 0; i < repeateDateList.Capacity; i++)
                        {
                            repeateDateList.Add(dt.ToShortDateString());
                            dt = dt.AddMonths(1);
                        }
                    }
                    else
                    {
                        DateTime dt = DateTime.Now;
                        for (int i = 0; i < repeateDateList.Capacity; i++)
                        {
                            repeateDateList.Add(dt.ToShortDateString());
                            dt = dt.AddYears(1);
                        }
                    }
                }



                if (cBSelectedReminders.Items.Count == 0)
                {
                    //MessageBox.Show(cBSelectedReminders.Items.Count.ToString());
                    BeforeNotificationTime notifyTime = new BeforeNotificationTime();
                    notifyTime.Date = dateTimePicker2.Value.ToShortDateString();
                    notifyTime.Time = dateTimePicker1.Value.ToShortTimeString();
                    notificationTimeList.Add(notifyTime);
                }
                else
                {
                    //MessageBox.Show("Inside The Else Part");
                    //5 minutes before
                    //10 minutes before
                    //15 minutes before
                    //30 minutes before
                    //1 hour before
                    for (int i = 0; i < cBSelectedReminders.Items.Count; i++)
                    {
                        BeforeNotificationTime notifyTime = new BeforeNotificationTime();
                        string time;
                        time = cBSelectedReminders.Items[i].ToString();
                        string an = "";
                        for (int k = 0; k < time.Length; k++)
                        {
                            if (time[k] == ' ')
                            {
                                break;
                            }
                            an += (time[k].ToString());
                        }

                        int timeValue = Convert.ToInt32(an);


                        //MessageBox.Show(timeValue.ToString());

                        if (cBSelectedReminders.Items[i].ToString().Contains("minutes before - NO"))
                        {
                            //MessageBox.Show("Inside Minutes Part");
                            notifyTime.NotifyTimeBeforeString = cBSelectedReminders.Items[i].ToString();

                            notifyTime.Date = dateTimePicker2.Value.ToShortDateString();
                            DateTime tm  = dateTimePicker1.Value;
                            DateTime tm2 = tm.AddMinutes(timeValue);
                            TimeSpan t   = tm2 - tm;
                            tm = tm - t;
                            notifyTime.Time = tm.ToShortTimeString();


                            //MessageBox.Show(tm.ToShortTimeString());


                            if (cBSelectedReminders.Items.ToString().Contains("EM"))
                            {
                                notifyTime.Notify_Via = 2;
                            }
                            if (cBSelectedReminders.Items.ToString().Contains("SM"))
                            {
                                notifyTime.Notify_Via = 3;
                            }
                            else
                            {
                                notifyTime.Notify_Via = 1;
                            }



                            notificationTimeList.Add(notifyTime);
                        }
                        else if (cBSelectedReminders.Items[i].ToString().Contains("hours before - NO"))
                        {
                            //MessageBox.Show("Inside Hours Part");
                            notifyTime.NotifyTimeBeforeString = cBSelectedReminders.Items[i].ToString();

                            notifyTime.Date = dateTimePicker2.Value.ToShortDateString();
                            DateTime tm  = dateTimePicker1.Value;
                            DateTime tm2 = tm.AddHours(timeValue);
                            TimeSpan t   = tm2 - tm;
                            tm = tm - t;
                            notifyTime.Time = tm.ToShortTimeString();


                            if (cBSelectedReminders.Items.ToString().Contains("EM"))
                            {
                                notifyTime.Notify_Via = 2;
                            }
                            if (cBSelectedReminders.Items.ToString().Contains("SM"))
                            {
                                notifyTime.Notify_Via = 3;
                            }
                            else
                            {
                                notifyTime.Notify_Via = 1;
                            }


                            notificationTimeList.Add(notifyTime);
                        }
                        else if (cBSelectedReminders.Items[i].ToString().Contains("days before - NO"))
                        {
                            //MessageBox.Show("Inside Days Part");
                            notifyTime.NotifyTimeBeforeString = cBSelectedReminders.Items[i].ToString();

                            DateTime tm  = dateTimePicker1.Value;
                            DateTime tm2 = tm.AddDays(timeValue);
                            TimeSpan t   = tm2 - tm;
                            tm = tm - t;
                            notifyTime.Date = tm.ToShortDateString();
                            notifyTime.Time = dateTimePicker1.Value.ToShortTimeString();


                            if (cBSelectedReminders.Items.ToString().Contains("EM"))
                            {
                                notifyTime.Notify_Via = 2;
                            }
                            if (cBSelectedReminders.Items.ToString().Contains("SM"))
                            {
                                notifyTime.Notify_Via = 3;
                            }
                            else
                            {
                                notifyTime.Notify_Via = 1;
                            }


                            notificationTimeList.Add(notifyTime);
                        }
                        else
                        {
                            //MessageBox.Show("Inside Weeks Part");
                            notifyTime.NotifyTimeBeforeString = cBSelectedReminders.Items[i].ToString();

                            DateTime tm  = dateTimePicker1.Value;
                            DateTime tm2 = tm.AddDays(timeValue * 7);
                            TimeSpan t   = tm2 - tm;
                            tm = tm - t;
                            notifyTime.Date = tm.ToShortDateString();
                            notifyTime.Time = dateTimePicker1.Value.ToShortTimeString();


                            if (cBSelectedReminders.Items.ToString().Contains("EM"))
                            {
                                notifyTime.Notify_Via = 2;
                            }
                            if (cBSelectedReminders.Items.ToString().Contains("SM"))
                            {
                                notifyTime.Notify_Via = 3;
                            }
                            else
                            {
                                notifyTime.Notify_Via = 1;
                            }



                            notificationTimeList.Add(notifyTime);
                        }
                    }
                }

                ts.Repeat_Date_List = repeateDateList;
                ts.Notify_Time_List = notificationTimeList;


                TaskSer taskService = new TaskSer();

                List <int> taskID = taskService.Insert(ts);

                taskService = new TaskSer();

                taskService.InsertInNotificationTime(taskID, ts);

                MessageBox.Show("Task Is Added!!!");

                this.Close();


                UserControlForOnlyTestPurpose.uC.LoadTaskList();
            }
            else
            {
                MessageBox.Show("You Should be Put the task tittle!!!");
            }
        }
Esempio n. 22
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool checkRepeatIsChange = false;



            TaskSer taskService = new TaskSer();
            Tasks   ts          = new Tasks();

            ts.Task_ID     = obj.Task_ID;
            ts.Tittle      = textBox1.Text;
            ts.Description = textBox2.Text;
            ts.Date        = dateTimePicker2.Value.ToShortDateString();
            ts.Time        = dateTimePicker1.Value.ToShortTimeString();

            CategorySer cS = new CategorySer();
            int         cat_ID;

            if (cBCategory.SelectedIndex < 0)
            {
                cat_ID = cS.GetCategoryID("Inbox", LogIn.user_ID);
            }
            else
            {
                cat_ID = cS.GetCategoryID(cBCategory.SelectedItem.ToString(), LogIn.user_ID);
            }

            ts.Category_ID = cat_ID;

            int prio;

            if (cBPriority.SelectedIndex < 0)
            {
                prio = 1;
            }
            else
            {
                if (cBPriority.SelectedItem.ToString().Equals("High"))
                {
                    prio = 3;
                }
                else if (cBPriority.SelectedItem.ToString().Equals("Medium"))
                {
                    prio = 2;
                }
                else
                {
                    prio = 1;
                }
            }

            ts.Priority = prio;

            List <BeforeNotificationTime> notificationTimeList = new List <BeforeNotificationTime>();

            if (cBSelectedReminders.Items.Count == 0)
            {
                //MessageBox.Show(cBSelectedReminders.Items.Count.ToString());
                BeforeNotificationTime notifyTime = new BeforeNotificationTime();
                notifyTime.Date = dateTimePicker2.Value.ToShortDateString();
                notifyTime.Time = dateTimePicker1.Value.ToShortTimeString();
                notificationTimeList.Add(notifyTime);
            }
            else
            {
                //MessageBox.Show("Inside The Else Part");
                //5 minutes before
                //10 minutes before
                //15 minutes before
                //30 minutes before
                //1 hour before
                for (int i = 0; i < cBSelectedReminders.Items.Count; i++)
                {
                    BeforeNotificationTime notifyTime = new BeforeNotificationTime();
                    string time;
                    time = cBSelectedReminders.Items[i].ToString();
                    string an = "";
                    for (int k = 0; k < time.Length; k++)
                    {
                        if (time[k] == ' ')
                        {
                            break;
                        }
                        an += (time[k].ToString());
                    }

                    int timeValue = Convert.ToInt32(an);


                    //MessageBox.Show(timeValue.ToString());

                    if (cBSelectedReminders.Items[i].ToString().Contains("minutes before - NO"))
                    {
                        //MessageBox.Show("Inside Minutes Part");
                        notifyTime.NotifyTimeBeforeString = cBSelectedReminders.Items[i].ToString();

                        notifyTime.Date = dateTimePicker2.Value.ToShortDateString();
                        DateTime tm  = dateTimePicker1.Value;
                        DateTime tm2 = tm.AddMinutes(timeValue);
                        TimeSpan t   = tm2 - tm;
                        tm = tm - t;
                        notifyTime.Time = tm.ToShortTimeString();


                        //MessageBox.Show(tm.ToShortTimeString());


                        if (cBSelectedReminders.Items.ToString().Contains("EM"))
                        {
                            notifyTime.Notify_Via = 2;
                        }
                        if (cBSelectedReminders.Items.ToString().Contains("SM"))
                        {
                            notifyTime.Notify_Via = 3;
                        }
                        else
                        {
                            notifyTime.Notify_Via = 1;
                        }



                        notificationTimeList.Add(notifyTime);
                    }
                    else if (cBSelectedReminders.Items[i].ToString().Contains("hours before - NO"))
                    {
                        //MessageBox.Show("Inside Hours Part");
                        notifyTime.NotifyTimeBeforeString = cBSelectedReminders.Items[i].ToString();

                        notifyTime.Date = dateTimePicker2.Value.ToShortDateString();
                        DateTime tm  = dateTimePicker1.Value;
                        DateTime tm2 = tm.AddHours(timeValue);
                        TimeSpan t   = tm2 - tm;
                        tm = tm - t;
                        notifyTime.Time = tm.ToShortTimeString();


                        if (cBSelectedReminders.Items.ToString().Contains("EM"))
                        {
                            notifyTime.Notify_Via = 2;
                        }
                        if (cBSelectedReminders.Items.ToString().Contains("SM"))
                        {
                            notifyTime.Notify_Via = 3;
                        }
                        else
                        {
                            notifyTime.Notify_Via = 1;
                        }


                        notificationTimeList.Add(notifyTime);
                    }
                    else if (cBSelectedReminders.Items[i].ToString().Contains("days before - NO"))
                    {
                        //MessageBox.Show("Inside Days Part");
                        notifyTime.NotifyTimeBeforeString = cBSelectedReminders.Items[i].ToString();

                        DateTime tm  = dateTimePicker1.Value;
                        DateTime tm2 = tm.AddDays(timeValue);
                        TimeSpan t   = tm2 - tm;
                        tm = tm - t;
                        notifyTime.Date = tm.ToShortDateString();
                        notifyTime.Time = dateTimePicker1.Value.ToShortTimeString();


                        if (cBSelectedReminders.Items.ToString().Contains("EM"))
                        {
                            notifyTime.Notify_Via = 2;
                        }
                        if (cBSelectedReminders.Items.ToString().Contains("SM"))
                        {
                            notifyTime.Notify_Via = 3;
                        }
                        else
                        {
                            notifyTime.Notify_Via = 1;
                        }


                        notificationTimeList.Add(notifyTime);
                    }
                    else
                    {
                        //MessageBox.Show("Inside Weeks Part");
                        notifyTime.NotifyTimeBeforeString = cBSelectedReminders.Items[i].ToString();

                        DateTime tm  = dateTimePicker1.Value;
                        DateTime tm2 = tm.AddDays(timeValue * 7);
                        TimeSpan t   = tm2 - tm;
                        tm = tm - t;
                        notifyTime.Date = tm.ToShortDateString();
                        notifyTime.Time = dateTimePicker1.Value.ToShortTimeString();


                        if (cBSelectedReminders.Items.ToString().Contains("EM"))
                        {
                            notifyTime.Notify_Via = 2;
                        }
                        if (cBSelectedReminders.Items.ToString().Contains("SM"))
                        {
                            notifyTime.Notify_Via = 3;
                        }
                        else
                        {
                            notifyTime.Notify_Via = 1;
                        }



                        notificationTimeList.Add(notifyTime);
                    }
                }
            }


            ts.Notify_Time_List = notificationTimeList;
            List <string> repeateDateList = new List <string>(100);

            if (cBRepeat.Text.Equals(obj.RepeatName) || cBRepeat.SelectedIndex < 0)
            {
                ts.Repeat_Date_List = obj.Repeat_Date_List;
            }
            else
            {
                if (MessageBox.Show("Are you update All Task Which is follwing this task????", "Hello!!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    checkRepeatIsChange = true;


                    TaskSer taskS = new TaskSer();
                    taskS.DeleteByRepeatID(obj.RepeatDateTask_ID);


                    ts.RepeatDateTask_ID = System.Guid.NewGuid().ToString();
                    if (cBRepeat.SelectedItem.ToString().Equals("Every day"))
                    {
                        DateTime dt = DateTime.Now;
                        for (int i = 0; i < repeateDateList.Capacity; i++)
                        {
                            repeateDateList.Add(dt.ToShortDateString());
                            dt = dt.AddDays(1);
                        }
                    }
                    else if (cBRepeat.SelectedItem.ToString().Equals("Every week"))
                    {
                        DateTime dt = DateTime.Now;
                        for (int i = 0; i < repeateDateList.Capacity; i++)
                        {
                            repeateDateList.Add(dt.ToShortDateString());
                            dt = dt.AddDays(7);
                        }
                    }
                    else if (cBRepeat.SelectedItem.ToString().Equals("Every month"))
                    {
                        DateTime dt = DateTime.Now;
                        for (int i = 0; i < repeateDateList.Capacity; i++)
                        {
                            repeateDateList.Add(dt.ToShortDateString());
                            dt = dt.AddMonths(1);
                        }
                    }
                    else
                    {
                        DateTime dt = DateTime.Now;
                        for (int i = 0; i < repeateDateList.Capacity; i++)
                        {
                            repeateDateList.Add(dt.ToShortDateString());
                            dt = dt.AddYears(1);
                        }
                    }
                }
                else
                {
                    cBRepeat.Text = obj.RepeatName;
                }
            }



            if (checkRepeatIsChange)
            {
                ts.Repeat_Date_List = repeateDateList;
                TaskSer tSer = new TaskSer();
                tSer.Insert(ts);
            }
            else
            {
                TaskSer tSer = new TaskSer();
                tSer.Update(ts);
            }

            this.Close();
        }
Esempio n. 23
0
        private void button7_Click(object sender, EventArgs e)
        {
            CategorySer    cg     = new CategorySer();
            int            cat_Id = cg.GetCategoryID(ProjectName, LogIn.user_ID);
            OpenFileDialog fb     = new OpenFileDialog();

            fb.Filter = "Excel Office | *.xls; *.xlsx";

            if (fb.ShowDialog() == DialogResult.OK)
            {
                FileStream       strem    = new FileStream(fb.FileName, FileMode.Open, FileAccess.Read);
                IExcelDataReader exReader = ExcelReaderFactory.CreateReader(strem);
                DataSet          ds       = exReader.AsDataSet(new ExcelDataSetConfiguration()
                {
                    ConfigureDataTable = (_) => new ExcelDataTableConfiguration()
                    {
                        UseHeaderRow = true
                    }
                });
                TaskSer      tkSer = new TaskSer();
                List <Tasks> tk    = new List <Tasks>();
                Tasks        t;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    t = new Tasks();
                    for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
                    {
                        if (j == 0)
                        {
                            t.Task_ID = Convert.ToInt32(ds.Tables[0].Rows[i][j].ToString());
                        }
                        else if (j == 1)
                        {
                            t.Tittle = ds.Tables[0].Rows[i][j].ToString();
                        }
                        else if (j == 2)
                        {
                            t.Date = ds.Tables[0].Rows[i][j].ToString();
                        }
                        else if (j == 3)
                        {
                            t.Time = ds.Tables[0].Rows[i][j].ToString();
                        }
                        else if (j == 4)
                        {
                            t.RepeatDateTask_ID = ds.Tables[0].Rows[i][j].ToString();
                        }
                        else if (j == 5)
                        {
                            t.Description = ds.Tables[0].Rows[i][j].ToString();
                        }
                        else if (j == 6)
                        {
                            t.Priority = Convert.ToInt32(ds.Tables[0].Rows[i][j].ToString());
                        }
                        else if (j == 7)
                        {
                            t.Category_ID = cat_Id;
                        }
                        else
                        {
                            t.Task_Complete = Convert.ToInt32(ds.Tables[0].Rows[i][j].ToString());
                        }
                    }
                    tk.Add(t);
                }
                exReader.Close();
                strem.Close();

                for (int i = 0; i < tk.Count; i++)
                {
                    tkSer.Insert(tk[i]);
                }

                MessageBox.Show("File Is Imported");
            }
        }
Esempio n. 24
0
        private int GetCatID(string catName)
        {
            CategorySer cs = new CategorySer();

            return(cs.GetCategoryID(catName, LogIn.user_ID));
        }