private void SendMailFleetManagerAcceptRejectCompleted(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 Service: " + serviceInformationBasicInformationGateway.GetServiceNumber(serviceId) + " - " + serviceInformationBasicInformationGateway.GetServiceDescription(serviceId);
            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 (serviceInformationBasicInformationGateway.GetAssignedDeadlineDate(serviceId).HasValue)
            {
                DateTime deadlineDate = (DateTime)serviceInformationBasicInformationGateway.GetAssignedDeadlineDate(serviceId);
                string deadlineDateText = deadlineDate.Month.ToString() + "/" + deadlineDate.Day.ToString() + "/" + deadlineDate.Year.ToString();
                body = body + "\n Deadline Date: " + deadlineDateText;
            }

            // Asignation
            if (serviceInformationBasicInformationGateway.GetAssignTeamMemberId(serviceId).HasValue)
            {
                int employeeId = (int)serviceInformationBasicInformationGateway.GetAssignTeamMemberId(serviceId);
                EmployeeGateway employeesGateway = new EmployeeGateway();
                employeesGateway.LoadByEmployeeId(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;
            }

            // ... Start work information
            if (serviceInformationBasicInformationGateway.GetStartWorkDateTime(serviceId).HasValue)
            {
                DateTime startWorkDate = (DateTime)serviceInformationBasicInformationGateway.GetStartWorkDateTime(serviceId);
                body = body + "\n Start Work Date & Time: " + startWorkDate;
            }

            // ... Complete work information
            if (serviceInformationBasicInformationGateway.GetCompleteWorkDateTime(serviceId).HasValue)
            {
                DateTime completeWorkDate = (DateTime)serviceInformationBasicInformationGateway.GetCompleteWorkDateTime(serviceId);
                body = body + "\n Complete Work Date & Time: " + completeWorkDate;
            }

            //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);
        }
        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);
        }