Beispiel #1
0
        void add_Reminder_MenuItem_Click(object sender, EventArgs e)
        {
            if (db_Connect.get_User_Details_For_This_User(username, company_Name).mail_Id == "")
            {
                MessageBox.Show("Please set the Mail Id First");
                settings_Click(null, EventArgs.Empty);
                return;
            }
            if (db_Connect.get_User_Details_For_This_User(username, company_Name).encrypted_Mail_Password == "")
            {
                MessageBox.Show("Please set the Mail Password First");
                settings_Click(null, EventArgs.Empty);
                return;
            }

            Reminder_Creator_Form job_Form = new Reminder_Creator_Form("Add", database_Server, database_Name, database_Uid, database_Password);

            string[] users = db_Connect.get_Users_Details(company_Name).Keys.ToArray();
            job_Form.checkedListBox_Receivers_Reminder_Creator_Form.Items.AddRange(users);
            job_Form.button_Add_Or_Update_Reminder_Creator_Form.Click += new EventHandler(button_Add_Or_Update_Reminder_Creator_Form_Click);
            job_Form.ShowDialog();
        }
Beispiel #2
0
        void button_Add_Or_Update_Reminder_Creator_Form_Click(object sender, EventArgs e)
        {
            Reminder_Creator_Form reminder_Creator_Form = (Reminder_Creator_Form)(((Button)(sender)).Parent);
            string error_Message = "";

            if (!reminder_Creator_Form.check_Form(ref error_Message))
            {
                MessageBox.Show(error_Message);
                return;
            }
            //List<string> temp = reminder_Creator_Form.checkedListBox_Receivers_Reminder_Creator_Form.CheckedItems.Select(x => x.ToString()).ToList();

            string server_Side_File_Name = "remind_" + Useful_Functions.Useful_Functions.get_Guid_String() + reminder_Creator_Form.image_Path.Substring(reminder_Creator_Form.image_Path.LastIndexOf("."));
            string image_Path            = upload_The_File_Write_It_In_Database(server_Side_File_Name, reminder_Creator_Form.image_Path);

            if (image_Path == "")
            {
                MessageBox.Show("Error in image uploading,Reminder can't be saved");
                return;
            }

            reminder_Creator_Form.Hide();
            Job.Time_Gap_Type time_Gap_Of_Minutes_Or_Hours = Job.Time_Gap_Type.Hour;
            if (reminder_Creator_Form.radioButton_Hour_Reminder_Creator_Form.Checked)
            {
                time_Gap_Of_Minutes_Or_Hours = Job.Time_Gap_Type.Hour;
            }
            else if (reminder_Creator_Form.radioButton_Minute_Reminder_Creator_Form.Checked)
            {
                time_Gap_Of_Minutes_Or_Hours = Job.Time_Gap_Type.Minute;
            }

            List <Job.Reminder_Type> given_Reminder_Types = new List <Job.Reminder_Type>();

            if (reminder_Creator_Form.checkBox_Sms_Reminder_Creator_Form.Checked)
            {
                given_Reminder_Types.Add(Job.Reminder_Type.SMS);
            }
            if (reminder_Creator_Form.checkBox_Mail_Remainder_Creator_Form.Checked)
            {
                given_Reminder_Types.Add(Job.Reminder_Type.Mail);
            }
            if (reminder_Creator_Form.checkBox_Computer_Reminder_Creator_Form.Checked)
            {
                given_Reminder_Types.Add(Job.Reminder_Type.Computer);
            }

            List <string> job_Doiers_Names      = reminder_Creator_Form.checkedListBox_Receivers_Reminder_Creator_Form.CheckedItems.Cast <string>().ToList();
            List <string> job_Doiers_Mail_Ids   = (from f in job_Doiers_Names select db_Connect.get_Mail_Id_For_This_Username(f, company_Name)).ToList();
            List <string> job_Doiers_Mobile_Nos = (from f in job_Doiers_Names select db_Connect.get_Phone_No_For_This_Username(f, company_Name)).ToList();

            TimeZoneInfo temp_Time_Zone_Info = TimeZoneInfo.Local;
            Job          temp_Job            = new Job(image_Path,
                                                       company_Name,
                                                       job_Doiers_Names,
                                                       job_Doiers_Mail_Ids,
                                                       job_Doiers_Mobile_Nos,
                                                       username,
                                                       reminder_Creator_Form.textBox_Subject_Reminder_Creator_Form.Text,
                                                       reminder_Creator_Form.textBox_Body_Reminder_Creator_Form.Text,
                                                       reminder_Creator_Form.textBox_Notes_Reminder_Creator_Form.Text,
                                                       Convert.ToInt32(reminder_Creator_Form.numericUpDown_Reminder_Creator_Form.Value),
                                                       time_Gap_Of_Minutes_Or_Hours,
                                                       given_Reminder_Types,
                                                       DateTime.Now.ToUniversalTime(),
                                                       reminder_Creator_Form.dateTimePicker_Start_Reminder_Creator_Form.Value.ToUniversalTime(),
                                                       reminder_Creator_Form.dateTimePicker_DeadLine_Reminder_Creator_Form.Value.ToUniversalTime(),
                                                       "remind_" + Useful_Functions.Useful_Functions.get_Guid_String(),
                                                       new DateTime(1, 1, 1),
                                                       temp_Time_Zone_Info);

            db_Connect.save_This_Reminder_In_Database(temp_Job);
            align_Picture_Boxes();
        }