public void SendMailTeamMember()
        {
            // Get mail information
            string mailTo = "";
            string nameTo = "";
            string subject = "This proposal is promoted to project.";
            string body = "";

            foreach (ListItem lst in cbxlEmployee.Items)
            {
                int employeeId = int.Parse(lst.Value);

                EmployeeGateway employeesGateway = new EmployeeGateway();
                employeesGateway.LoadForMailsByEmployeeId(employeeId);

                if (employeesGateway.Table.Rows.Count > 0)
                {
                    // Assigned TeamMember
                    mailTo = employeesGateway.GetEMail(employeeId);
                    nameTo = employeesGateway.GetFirstName(employeeId) + " " + employeesGateway.GetLastName(employeeId);
                }
            }

            // Mails body
            body = body + "\nHi " + nameTo + ",\n\nThe following project was promoted to active state. \n";

            // ... for client and project
            body = body + "\n " + lblTitleClientName.Text;
            body = body + "\n Project: " + lblTitleProjectName.Text;

            //Send Mail
            SendMail(mailTo, subject, body);
        }
        public void SendMailFleetManager()
        {
            // Get mail information
            string mailTo = "";
            string nameTo = "";
            string subject = "Service request has been modified.";
            string body = "";

            // MailtTo, nameTo
            int companyLevelId = Int32.Parse(hdfCompanyLevel.Value);

            Employee employees = new Employee();
            employees.LoadByFleetManager(companyLevelId);

            mailTo = employees.GetAllFleetManagersEMails();
            nameTo = employees.GetAllFleetManagersNames();

            // Mails body
            body = body + "\nHi " + nameTo + ",\n\nThe following service request has been modified. \n";

            body = body + "\n Service Number: " + hdfServiceNumber.Value;
            body = body + "\n Service Description: " + hdfServiceDescription.Value;

            // ... Assignation of work
            // ... ... Deadline date
            if (hdfDeadlineDate.Value != "")
            {
                DateTime deadlineDate = DateTime.Parse(hdfDeadlineDate.Value);
                string deadlineDateText = deadlineDate.Month.ToString() + "/" + deadlineDate.Day.ToString() + "/" + deadlineDate.Year.ToString();
                body = body + "\n Deadline date: " + deadlineDateText;
            }
            else
            {
                body = body + "\n Deadline date: ";
            }

            // ... ... Assigned Personal
            if (hdfAssignToTeamMember.Value == "True")
            {
                int employeeId = Int32.Parse(hdfTeamMemberId.Value);
                EmployeeGateway employeesGateway = new EmployeeGateway();
                employeesGateway.LoadForMailsByEmployeeId(employeeId);
                string assignedTo = "";
                if (employeesGateway.Table.Rows.Count > 0)
                {
                    // Assigned TeamMember
                    assignedTo = employeesGateway.GetFirstName(employeeId) + " " + employeesGateway.GetLastName(employeeId);
                }

                body = body + "\n Assigned Team Member: " + assignedTo;
            }

            // ... ... Assigned third party vendor
            if (hdfAssignToThirdPartyVendor.Value == "True")
            {
                body = body + "\n Assigned Third Party Vendor: " + hdfThirdPartyVendor.Value;
            }

            int registeredByLoginId = Convert.ToInt32(Session["loginID"]);
            EmployeeGateway employeeGateway = new EmployeeGateway();
            employeeGateway.LoadByLoginId(registeredByLoginId);
            int registeredByEmployeeId = employeeGateway.GetEmployeIdByLoginId(registeredByLoginId);

            // ... ... Assigned myself
            if (hdfAssignToMyself.Value == "True")
            {
                if (employeeGateway.Table.Rows.Count > 0)
                {
                    body = body + "\n Assigned to myself: " + employeeGateway.GetFirstName(registeredByEmployeeId) + " " + employeeGateway.GetLastName(registeredByEmployeeId);
                }
            }

            // Registered by
            if (employeeGateway.Table.Rows.Count > 0)
            {
                body = body + "\n Registered By: " + employeeGateway.GetFirstName(registeredByEmployeeId) + " " + employeeGateway.GetLastName(registeredByEmployeeId);
            }

            // Service State
            body = body + "\n\n Service State: " + hdfServiceState.Value;

            //Send Mail
            SendMail(mailTo, subject, body);
        }
        public void SendMailTeamMember()
        {
            // Get mail information
            string mailTo = "";
            string nameTo = "";
            string subject = "You have assigned service requests.";
            string body = "";

            if (hdfAssignToTeamMember.Value == "True")
            {
                int employeeId = Int32.Parse(hdfTeamMemberId.Value);

                EmployeeGateway employeesGateway = new EmployeeGateway();
                employeesGateway.LoadForMailsByEmployeeId(employeeId);

                if (employeesGateway.Table.Rows.Count > 0)
                {
                    // Assigned TeamMember
                    mailTo = employeesGateway.GetEMail(employeeId);
                    nameTo = employeesGateway.GetFirstName(employeeId) + " " + employeesGateway.GetLastName(employeeId);
                }

                // Mails body
                body = body + "\nHi " + nameTo + ",\n\nThe following service request has been assigned to you. \n";

                body = body + "\n Service Number: " + hdfServiceNumber.Value;
                body = body + "\n Service Description: " + hdfServiceDescription.Value;

                if (hdfDeadlineDate.Value != "")
                {
                    DateTime deadlineDate = DateTime.Parse(hdfDeadlineDate.Value);
                    string deadlineDateText = deadlineDate.Month.ToString() + "/" + deadlineDate.Day.ToString() + "/" + deadlineDate.Year.ToString();
                    body = body + "\n Deadline date: " + deadlineDateText;
                }
                else
                {
                    body = body + "\n Deadline date: ";
                }

                int registeredByLoginId = Convert.ToInt32(Session["loginID"]);
                employeesGateway.LoadByLoginId(registeredByLoginId);
                int registeredByEmployeeId = employeesGateway.GetEmployeIdByLoginId(registeredByLoginId);

                if (employeesGateway.Table.Rows.Count > 0)
                {
                    body = body + "\n Assigned By: " + employeesGateway.GetFirstName(registeredByEmployeeId) + " " + employeesGateway.GetLastName(registeredByEmployeeId);
                }

                //Send Mail
                SendMail(mailTo, subject, body);
            }
        }
        private void SendMailTeamMember()
        {
            // Get mail information
            string mailTo = "";
            string nameTo = "";
            string subject = "You have assigned service requests.";
            string body = "";

            int employeeId = Int32.Parse(ddlPnlAssignAssignToTeamMember.SelectedValue);
            EmployeeGateway employeesGateway = new EmployeeGateway();
            employeesGateway.LoadForMailsByEmployeeId(employeeId);

            if (employeesGateway.Table.Rows.Count > 0)
            {
                // Assigned TeamMember
                mailTo = employeesGateway.GetEMail(employeeId);
                nameTo = employeesGateway.GetFirstName(employeeId) + " " + employeesGateway.GetLastName(employeeId);
            }

            int serviceId = Int32.Parse(hdfServiceId.Value);
            int companyId = Int32.Parse(hdfCompanyId.Value);
            int companyLevel = Int32.Parse(hdfCompanyLevel.Value);

            ServiceInformationBasicInformationGateway serviceInformationBasicInformationGateway = new ServiceInformationBasicInformationGateway(serviceInformationTDS);
            serviceInformationBasicInformationGateway.LoadByServiceId(serviceId, companyId);

            // Mails body
            body = body + "\nHi " + nameTo + ",\n\nThe following service request has been assigned to you. \n";
            body = body + "\n Unit: " + serviceInformationBasicInformationGateway.GetUnitCode(serviceId) + " - " + serviceInformationBasicInformationGateway.GetUnitDescription(serviceId) + "\n";
            body = body + "\n Fixed Date: ";
            if (serviceInformationBasicInformationGateway.GetMtoDto(serviceId)) body = body + "Yes "; else body = body + "No ";

            string unitType = hdfUnitType.Value;
            if (unitType == "Vehicle")
            {
                body = body + "\n Mileage: " + serviceInformationBasicInformationGateway.GetMileage(serviceId) + " " + hdfMileageUnitOfMeasurement.Value;
            }

            body = body + "\n Problem Description: " + serviceInformationBasicInformationGateway.GetServiceDescription(serviceId);

            if (tkrdpPnlAssignDeadlineDate.SelectedDate.HasValue)
            {
                DateTime deadlineDate = tkrdpPnlAssignDeadlineDate.SelectedDate.Value;
                string deadlineDateText = deadlineDate.Month.ToString() + "/" + deadlineDate.Day.ToString() + "/" + deadlineDate.Year.ToString();
                body = body + " \n Deadline date: " + deadlineDateText;
            }
            else
            {
                body = body + " \n Deadline date: ";
            }

            int registeredByLoginId = Convert.ToInt32(Session["loginID"]);
            employeesGateway.LoadByLoginId(registeredByLoginId);
            int registeredByEmployeeId = employeesGateway.GetEmployeIdByLoginId(registeredByLoginId);
            if (employeesGateway.Table.Rows.Count > 0)
            {
                body = body + "\n Assigned By: " + employeesGateway.GetFirstName(registeredByEmployeeId) + " " + employeesGateway.GetLastName(registeredByEmployeeId);
            }

            //Send Mail
            SendMail(mailTo, subject, body);
        }
        private void SendMailFleetManager( string subject, string title)
        {
            // Get mail information
            string mailTo = "";
            string nameTo = "";
            string body = "";
            int serviceId = Int32.Parse(hdfServiceId.Value);
            int companyId = Int32.Parse(hdfCompanyId.Value);
            int companyLevel = Int32.Parse(hdfCompanyLevel.Value);

            // MailtTo, nameTo
            int companyLevelId = Int32.Parse(hdfCompanyLevel.Value);

            Employee employees = new Employee();
            employees.LoadByFleetManager(companyLevelId);

            mailTo = employees.GetAllFleetManagersEMails();
            nameTo = employees.GetAllFleetManagersNames();

            ServiceInformationBasicInformationGateway serviceInformationBasicInformationGateway = new ServiceInformationBasicInformationGateway(serviceInformationTDS);
            serviceInformationBasicInformationGateway.LoadByServiceId(serviceId, companyId);

            // Mails body
            body = body + "\nHi " + nameTo + ",\n\n"+ title + " \n";
            body = body + "\n Unit: " + serviceInformationBasicInformationGateway.GetUnitCode(serviceId) + " - " + serviceInformationBasicInformationGateway.GetUnitDescription(serviceId);
            body = body + "\n Fixed Date: ";
            if (serviceInformationBasicInformationGateway.GetMtoDto(serviceId)) body = body + "Yes "; else body = body + "No ";

            string unitType = hdfUnitType.Value;
            if (unitType == "Vehicle")
            {
                body = body + "\n Mileage: " + serviceInformationBasicInformationGateway.GetMileage(serviceId) + " " + hdfMileageUnitOfMeasurement.Value;
            }

            body = body + "\n Problem Description: " + serviceInformationBasicInformationGateway.GetServiceDescription(serviceId);

            if (tkrdpPnlAssignDeadlineDate.SelectedDate.HasValue)
            {
                DateTime deadlineDate = tkrdpPnlAssignDeadlineDate.SelectedDate.Value;
                string deadlineDateText = deadlineDate.Month.ToString() + "/" + deadlineDate.Day.ToString() + "/" + deadlineDate.Year.ToString();
                body = body + " \n Deadline date: " + deadlineDateText;
            }
            else
            {
                body = body + " \n Deadline date: ";
            }

            if(rbtnPnlAssignToTeamMember.Checked)
            {
                int employeeId = Int32.Parse(ddlPnlAssignAssignToTeamMember.SelectedValue);
                EmployeeGateway employeesGateway = new EmployeeGateway();
                employeesGateway.LoadForMailsByEmployeeId(employeeId);
                string assignedTo = "";
                if (employeesGateway.Table.Rows.Count > 0)
                {
                    // Assigned TeamMember
                    assignedTo = employeesGateway.GetFirstName(employeeId) + " " + employeesGateway.GetLastName(employeeId);
                }

                body = body + "\n Assigned Team Member: " + assignedTo;
            }

            if (rbtnPnlAssignToThirdPartyVendor.Checked)
            {
                body = body + "\n Assigned Third Party Vendor: " + tbxPnlAssignAssignToThirdPartyVendor.Text;
            }

            //Send Mail
            SendMail(mailTo, subject, body);
        }