Example #1
0
        public HttpResponseMessage AddNewAssignmentByAssetTag(ExternalAddAssignmentViewModel model)
        {
            BO.AssignmentProcess assignmentProcess = new BO.AssignmentProcess();
            //TODO : Add checking of duplicate assets
            if (model.AssigningEmpID != 0)
            {
                int result = assignmentProcess.AssignEquipmentByAssetTag(model);

                if (result > ReturnValues.SUCCESS)
                {
                    return(ReturnMessages.RESPONSE_CREATED());
                }
                else if (result == ReturnValues.DUPLICATE)
                {
                    return(ReturnMessages.RESPONSE_NOTSUCCESSFUL(Constants.EXISTS));
                }
                else if (result == ReturnValues.NOT_AVAILABLE)
                {
                    return(ReturnMessages.RESPONSE_NOTSUCCESSFUL(Constants.NOT_AVAILABLE));
                }
                else
                {
                    return(ReturnMessages.RESPONSE_NOTSUCCESSFUL());
                }
            }

            return(ReturnMessages.RESPONSE_NOTSUCCESSFUL(Constants.MISSING_ID));
        }
Example #2
0
        public HttpResponseMessage ReleaseAsset(ExternalReleaseAssignmentViewModel model)
        {
            if (model.RequestorID != 0)
            {
                if (model.ReasonCode != 0)
                {
                    BO.AssignmentProcess assignProcess = new BO.AssignmentProcess();
                    int result = 0;

                    if (model.RequireApproval)
                    {
                        result = assignProcess.ReleaseAssetWithApproval(model);
                    }
                    else
                    {
                        result = assignProcess.ReleaseAssetWithoutApproval(model);
                    }

                    if (result == ReturnValues.SUCCESS)
                    {
                        return(ReturnMessages.RESPONSE_OK());
                    }
                    else
                    {
                        return(ReturnMessages.RESPONSE_NOTSUCCESSFUL());
                    }
                }
                else
                {
                    return(ReturnMessages.RESPONSE_NOTSUCCESSFUL(Constants.MISSING_CD));
                }
            }
            return(ReturnMessages.RESPONSE_NOTSUCCESSFUL(Constants.MISSING_ID));
        }
Example #3
0
        public HttpResponseMessage TransferAsset(ExternalTransferAssignmentViewModel model)
        {
            int result = 0;

            BO.AssignmentProcess assignProcess = new BO.AssignmentProcess();

            if (model.RequestorID != 0)
            {
                if (model.RequireApproval)
                {
                    result = assignProcess.TransferAssetWithApproval(model);
                }
                else
                {
                    result = assignProcess.TransferAssetWithoutApproval(model);
                }

                if (result >= 0)
                {
                    return(ReturnMessages.RESPONSE_OK());
                }
                else
                {
                    return(ReturnMessages.RESPONSE_NOTSUCCESSFUL());
                }
            }
            return(ReturnMessages.RESPONSE_NOTSUCCESSFUL(Constants.MISSING_ID));
        }
Example #4
0
        public HttpResponseMessage ApproveTransfer(ExternalTransferAssignmentViewModel model)
        {
            if (model.ApprovingID != 0)
            {
                BO.AssignmentProcess assignProcess = new BO.AssignmentProcess();
                int result = assignProcess.TransferRequestApproved(model);

                if (result > 0)
                {
                    return(ReturnMessages.RESPONSE_OK());
                }
            }

            return(ReturnMessages.RESPONSE_NOTSUCCESSFUL(Constants.MISSING_ID));
        }
Example #5
0
        public HttpResponseMessage RejectReleasedAsset(ExternalReleaseAssignmentViewModel model)
        {
            if (model.ApprovingID != 0)
            {
                BO.AssignmentProcess assignProcess = new BO.AssignmentProcess();

                int result = assignProcess.RejectReleasedAsset(model);

                if (result == ReturnValues.SUCCESS)
                {
                    return(ReturnMessages.RESPONSE_OK());
                }
                else
                {
                    return(ReturnMessages.RESPONSE_NOTSUCCESSFUL());
                }
            }

            return(ReturnMessages.RESPONSE_NOTSUCCESSFUL(Constants.MISSING_ID));
        }
Example #6
0
        public HttpResponseMessage AcceptOrRejectAssignment(ExternalAcceptanceViewModel model)
        {
            BO.AssignmentProcess assignProcess = new BO.AssignmentProcess();
            //Must have an EmployeeID and if Rejected, must have the optionalRemark
            if (model.acceptingEmployeeID != 0)
            {
                int result = ReturnValues.FAILED;

                if (model.accepted)
                {
                    result = assignProcess.AcceptAssignment(model.acceptingEmployeeID, model.assignmentID);
                }
                else
                {
                    if (!String.IsNullOrEmpty(model.optionalRemarks))
                    {
                        result = assignProcess.RejectAssignment(model.acceptingEmployeeID, model.assignmentID, model.optionalRemarks);
                    }
                    else
                    {
                        return(ReturnMessages.RESPONSE_NOTSUCCESSFUL(Constants.MISSING_CD));
                    }
                }

                if (result == ReturnValues.SUCCESS)
                {
                    return(ReturnMessages.RESPONSE_OK());
                }
                else if (result == ReturnValues.NOT_FOUND)
                {
                    return(ReturnMessages.RESPONSE_NOTFOUND());
                }
                else
                {
                    return(ReturnMessages.RESPONSE_NOTSUCCESSFUL());
                }
            }
            return(ReturnMessages.RESPONSE_NOTSUCCESSFUL(Constants.MISSING_ID));
        }
Example #7
0
        public HttpResponseMessage DenyTransfer(ExternalTransferAssignmentViewModel model)
        {
            if (model.ApprovingID != 0)
            {
                if (model.OptionalRemarks.Trim().Length > 1)
                {
                    BO.AssignmentProcess assignProcess = new BO.AssignmentProcess();
                    int result = assignProcess.TransferRequestDenied(model);

                    if (result == ReturnValues.SUCCESS)
                    {
                        return(ReturnMessages.RESPONSE_OK());
                    }
                }
                else
                {
                    return(ReturnMessages.RESPONSE_NOTSUCCESSFUL(Constants.MISSING_CD));
                }
            }

            return(ReturnMessages.RESPONSE_NOTSUCCESSFUL(Constants.MISSING_ID));
        }
Example #8
0
        public static Dictionary <string, int> GetNextStatus(ActionType action, int assetID, int assignmentID = 0)
        {
            BO.AssetProcess      assetProcess  = new BO.AssetProcess();
            BO.AssignmentProcess assignProcess = new BO.AssignmentProcess();

            Dictionary <string, int> result = new Dictionary <string, int>();

            vwFixAssetList  asset      = assetProcess.GetAssetByID(assetID);
            AssetAssignment assignment = new AssetAssignment();

            if (assignmentID > 0)
            {
                assignment = assignProcess.GetAssignmentbyID(assignmentID);
            }

            //FA - FixAsset Status;
            //AA - Current Assignment Status ( for transafer, this is for the requestor)
            //NAA - Next Assignment Status ( only for transfer, this is for the receipient)

            switch (action)
            {
            case ActionType.ASSET_NEW:
                result.Clear();
                result.Add("FA", Constants.ASSET_STATUS_FORASSIGNMENT);
                return(result);

            case ActionType.ASSET_TRANSFER:
                result.Clear();
                result.Add("FA", Constants.ASSET_STATUS_FORTRANSFER);
                result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_APPROVAL);
                return(result);

            case ActionType.ASSET_TRANSFER_WOAPPROVAL:
            case ActionType.ASSET_TRANSFER_APPROVED:
                result.Clear();
                if (asset.AssetStatusID == Constants.ASSET_STATUS_WITH_MIS)
                {
                    result.Add("FA", Constants.ASSET_STATUS_ASSIGNED);
                    result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_ACCEPTANCE);
                }
                else
                {
                    result.Add("FA", Constants.ASSET_STATUS_ASSIGNED);
                    result.Add("AA", Constants.ASSIGNMENT_STATUS_RELEASED);
                    result.Add("NAA", Constants.ASSIGNMENT_STATUS_WT_ACCEPTANCE);
                }
                return(result);

            case ActionType.ASSET_TRANSFER_DENIED:
            case ActionType.ASSET_RELEASE_DENIED:
                result.Clear();
                result.Add("FA", Constants.ASSET_STATUS_ASSIGNED);
                result.Add("AA", Constants.ASSIGNMENT_STATUS_ACCEPTED);
                return(result);

            case ActionType.ASSET_RELEASE:
                result.Clear();
                result.Add("FA", Constants.ASSET_STATUS_FORRELEASE);
                result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_APPROVAL);
                return(result);

            case ActionType.ASSET_RELEASE_WOAPPROVAL:
            case ActionType.ASSET_RELEASE_APPROVED:
                result.Clear();
                result.Add("FA", Constants.ASSET_STATUS_RELEASED);
                result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_ACCEPTANCE);
                return(result);

            case ActionType.ASSIGNMENT_MIS:
                result.Clear();
                result.Add("FA", Constants.ASSET_STATUS_WITH_MIS);
                result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_ACCEPTANCE);
                return(result);

            case ActionType.ASSIGNMENT_EMPLOYEE:
                result.Clear();
                result.Add("FA", Constants.ASSET_STATUS_ASSIGNED);
                result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_ACCEPTANCE);
                return(result);

            case ActionType.ASSET_RELEASE_ACCEPTED:
            case ActionType.ASSIGNMENT_ACCEPTED:
                result.Clear();
                result.Add("FA", asset.AssetStatusID);
                result.Add("AA", Constants.ASSIGNMENT_STATUS_ACCEPTED);
                return(result);

            case ActionType.ASSET_RELEASE_REJECTED:
                result.Clear();
                result.Add("FA", Constants.ASSIGNMENT_STATUS_RELEASED);
                result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_APPROVAL);
                return(result);

            case ActionType.ASSIGNMENT_REJECTED:
                result.Clear();
                switch (asset.AssetStatusID)
                {
                case Constants.ASSET_STATUS_WITH_MIS:
                    result.Add("FA", Constants.ASSET_STATUS_FORRELEASE);
                    result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_APPROVAL);
                    break;

                case Constants.ASSET_STATUS_ASSIGNED:
                    result.Add("FA", Constants.ASSET_STATUS_FORRELEASE);
                    result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_APPROVAL);
                    break;

                case Constants.ASSET_STATUS_FORRELEASE:
                    result.Add("FA", asset.AssetStatusID);
                    result.Add("AA", assignment.AssignmentStatusID);
                    break;
                }
                return(result);
            }

            return(result);
        }
Example #9
0
        public void SendAssignmentEmail(EmailType mailType, int assignmentID, string optVal1 = "", string optVal2 = "", int requestorID = 0, int receipientID = 0)
        {
            BO.AssignmentProcess assProcess   = new BO.AssignmentProcess();
            BO.AssetProcess      assetProcess = new BO.AssetProcess();
            BO.EmployeeProcess   empProcess   = new BO.EmployeeProcess();
            vwAssetAssignment    assignment   = assProcess.GetAssignmentViewByID(assignmentID);
            vwFixAsset           asset        = new vwFixAsset();
            vwEmployeeList       employee     = new vwEmployeeList();

            List <string> receipients   = new List <string>();
            List <string> ccReceipients = new List <string>();
            string        receiver      = string.Empty;

            if (assignment != null)
            {
                asset    = assetProcess.GetFixAssetViewByID(assignment.FixAssetID.Value);
                employee = empProcess.GetEmployeeViewByID(assignment.EmployeeID.Value);
            }
            try
            {
                switch (mailType)
                {
                case EmailType.ASSIGNMENT_ACCEPTANCE:

                    string emailTemplate = GetTemplate("Assignment_Accepted.html");
                    string emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, employee.FirstName + " " + employee.LastName);
                    string emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignmentID);

                    receipients = GetAdminMailToList(employee.DepartmentID);
                    EmailData emailData = new EmailData(employee.EmailAddress, receipients, emailSubj, emailBody);

                    SendAsync(emailData);
                    break;

                case EmailType.ASSIGNMENT_UPDATE:

                    emailTemplate = GetTemplate("Assignment_Update.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, employee.FirstName + " " + employee.LastName);
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignmentID);

                    emailData = new EmailData(employee.EmailAddress, emailSubj, emailBody);

                    SendAsync(emailData);
                    break;

                case EmailType.ASSIGNMENT_ACCEPTANCE_MIS:

                    receipients   = GetMISMailToList(employee.DepartmentID);
                    emailTemplate = GetTemplate("Assignment_Accepted.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, "MIS");
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignmentID);

                    emailData = new EmailData(receipients, emailSubj, emailBody);

                    SendAsync(emailData);
                    break;

                case EmailType.LIST_ASSIGMENTS:

                    receipients   = GetAdminMailToList(employee.DepartmentID);
                    emailTemplate = GetTemplate("Employee_Accountability_Form.html");

                    List <vwAssetAssignment> assignmentsList = new List <vwAssetAssignment>();
                    assignmentsList = assProcess.GetAcceptedAssignmentsbyEmpID(employee.EmployeeID);
                    System.Text.StringBuilder list = new System.Text.StringBuilder();
                    if (assignmentsList != null)
                    {
                        foreach (vwAssetAssignment assign in assignmentsList)
                        {
                            list.Append("<tr>");
                            list.Append(String.Format("<td style=\"padding:15px\">{0}</td>", assign.AssetAssignmentID));
                            list.Append(String.Format("<td style=\"padding:15px\">{0}</td>", assign.AssetTag));
                            list.Append(String.Format("<td style=\"padding:15px\">{0}</td>", assign.SerialNumber));
                            list.Append(String.Format("<td style=\"padding:15px\">{0}</td>", assign.TypeDescription));
                            list.Append(String.Format("<td style=\"padding:15px\">{0}</td>", assign.Brand));
                            list.Append(String.Format("<td style=\"padding:15px\">{0}</td>", assign.Model));
                            list.Append(String.Format("<td style=\"padding:15px\">{0}</td>", assign.DateAssigned.Value.ToShortDateString()));
                            list.Append("</tr>");
                        }
                    }

                    emailBody = String.Format(emailTemplate, employee.EmployeeID, employee.FirstName,
                                              employee.LastName, employee.Description, employee.GroupName, list.ToString());
                    emailSubj = String.Format("FASTrack : Accountability Form for {0} {1}", employee.FirstName, employee.LastName);
                    SendAsync(new Providers.EmailData(employee.EmailAddress, receipients, emailSubj, emailBody));

                    break;

                case EmailType.ASSIGNMENT_NEW:

                    emailTemplate = GetTemplate("Assignment_New.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, employee.FirstName + " " + employee.LastName);
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignmentID);
                    emailData     = new EmailData(employee.EmailAddress, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.ASSIGNMENT_MIS:

                    emailTemplate = GetTemplate("Assignment_MIS.html");
                    receipients   = GetMISMailToList(employee.DepartmentID);
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, "MIS");
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignmentID);
                    emailData     = new EmailData(receipients, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.ASSIGNMENT_REJECTED:

                    emailTemplate = GetTemplate("Assignment_Rejected.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, employee.FirstName + " " + employee.LastName);
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignmentID);
                    emailData     = new EmailData(employee.EmailAddress, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.ASSIGNMENT_REJECTED_NOTIFICATION:

                    switch (assignment.AssetStatusID)
                    {
                    case Common.Constants.ASSET_STATUS_FORASSIGNMENT:
                        receipients = GetAdminMailToList(employee.DepartmentID);
                        receiver    = "Property Custodians";
                        break;

                    case Common.Constants.ASSET_STATUS_FORRELEASE:
                        receipients = GetManagersMailList(employee.DepartmentID);
                        receiver    = "Managers";
                        break;

                    case Common.Constants.ASSET_STATUS_WITH_MIS:
                        receipients = GetMISMailToList(employee.DepartmentID);
                        receiver    = "MIS";
                        break;

                    default:
                        break;
                    }

                    emailTemplate = GetTemplate("Assignment_Rejected_Notifications.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, receiver);
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignmentID);
                    emailData     = new EmailData(receipients, emailSubj, emailBody);
                    SendAsync(emailData);
                    break;

                case EmailType.TRANSFER_MIS_ACCEPTANCE:

                    emailTemplate = GetTemplate("Transfer_MIS_Acceptance.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, "MIS");
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignmentID);

                    receipients = GetMISMailToList(employee.DepartmentID);
                    emailData   = new EmailData(receipients, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.TRANSFER_WDAPPROOVAL_DONE:

                    emailTemplate = GetTemplate("Transfer_Done.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, employee.FirstName + " " + employee.LastName);
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignmentID);
                    emailData     = new EmailData(employee.EmailAddress, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.TRANSFER_WOAPPROVAL_DONE:

                    vwEmployeeList requestor = empProcess.GetEmployeeViewByID(requestorID);
                    emailTemplate = GetTemplate("Transfer_Done.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, requestor.FirstName + " " + requestor.LastName);
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignmentID);
                    emailData     = new EmailData(employee.EmailAddress, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.RELEASE_REQUEST_REJECTED:

                    //Inform the admin ( cc the managers and the owner)
                    receipients   = GetAdminMailToList(employee.DepartmentID);
                    ccReceipients = GetManagersMailList(employee.DepartmentID);
                    ccReceipients.Add(employee.EmailAddress);

                    emailTemplate = GetTemplate("Release_Rejected.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, "Property Custodians");
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignmentID);
                    emailData     = new EmailData(receipients, ccReceipients, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.TRANSFER_TO_MIS_WTAPPROVAL:

                    //Inform MIS about the transfer request to them
                    receipients   = GetMISMailToList(employee.DepartmentID);
                    emailTemplate = GetTemplate("Transfer_To_MIS_WithApproval.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, "MIS");
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignmentID);
                    emailData     = new EmailData(receipients, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.TRANSFER:

                    //Inform the manager about the request
                    requestor     = empProcess.GetEmployeeViewByID(requestorID);
                    receipients   = GetManagersMailList(requestor.DepartmentID);
                    emailTemplate = GetTemplate("Transfer_Approval.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, "Managers", optVal1, optVal2);
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignmentID);
                    emailData     = new EmailData(receipients, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.TRANSFER_REQUEST:

                    //Inform the requestor
                    requestor = empProcess.GetEmployeeViewByID(requestorID);
                    vwEmployeeList receivingEmployee = empProcess.GetEmployeeViewByID(receipientID);

                    emailTemplate = GetTemplate("Transfer_Request.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, requestor.FirstName + " " + requestor.LastName,
                                                             receivingEmployee.FirstName + " " + receivingEmployee.LastName);
                    emailSubj = String.Format("FASTrack : Asset Assignment REF#{0}", assignmentID);
                    emailData = new EmailData(requestor.EmailAddress, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.TRANSFER_REQUEST_CONFIRMATION:

                    requestor     = empProcess.GetEmployeeViewByID(requestorID);
                    emailTemplate = GetTemplate("Transfer_Confirmation.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, requestor.FirstName + " " + requestor.LastName);
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignment.AssetAssignmentID);
                    emailData     = new EmailData(requestor.EmailAddress, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.TRANSFER_REQUEST_BY_MIS:

                    requestor         = empProcess.GetEmployeeViewByID(requestorID);
                    receivingEmployee = empProcess.GetEmployeeViewByID(receipientID);
                    receipients       = GetMISMailToList(requestor.DepartmentID);
                    emailTemplate     = GetTemplate("Transfer_Request_By_MIS.html");
                    emailBody         = BuildAssignmentEmailBody(assignment, emailTemplate, "MIS", receivingEmployee.FirstName + " " + receivingEmployee.LastName);
                    emailSubj         = String.Format("FASTrack : Asset Assignment REF#{0}", assignment.AssetAssignmentID);
                    emailData         = new EmailData(receipients, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.TRANSFER_RECEIVE:

                    //send email to receipient
                    receivingEmployee = empProcess.GetEmployeeViewByID(receipientID);
                    emailTemplate     = GetTemplate("Transferred_Receive.html");
                    emailBody         = BuildAssignmentEmailBody(assignment, emailTemplate, receivingEmployee.FirstName + " " + receivingEmployee.LastName);
                    emailSubj         = String.Format("FASTrack : Asset Assignment REF#{0}", assignment.AssetAssignmentID);
                    emailData         = new EmailData(receivingEmployee.EmailAddress, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.RELEASE_REQUEST_ACCEPTANCE:

                    //Inform the admin.
                    receipients   = GetAdminMailToList(employee.DepartmentID);
                    emailTemplate = GetTemplate("Release_Request_Acceptance.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, "Property Custodians");
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignment.AssetAssignmentID);
                    emailData     = new EmailData(receipients, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.RELEASE_REQUEST_APPROVED:

                    //inform owner
                    emailTemplate = GetTemplate("Release_Approved.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, employee.FirstName + " " + employee.LastName);
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignment.AssetAssignmentID);
                    emailData     = new EmailData(employee.EmailAddress, emailSubj, emailBody);
                    SendAsync(emailData);
                    break;

                case EmailType.TRANSFER_DENIED:

                    //inform the requestor
                    emailTemplate = GetTemplate("ransfer_Denied.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, employee.FirstName + " " + employee.LastName);
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignment.AssetAssignmentID);
                    emailData     = new EmailData(employee.EmailAddress, emailSubj, emailBody);
                    SendAsync(emailData);
                    break;

                case EmailType.RELEASE_REQUEST_CONFIRMATION:

                    //inform the requestor
                    requestor     = empProcess.GetEmployeeViewByID(requestorID);
                    emailTemplate = GetTemplate("Release_Confirmation.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, requestor.FirstName + " " + requestor.LastName);
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignment.AssetAssignmentID);
                    emailData     = new EmailData(requestor.EmailAddress, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.RELEASE_REQUEST_WTAPPROVAL:

                    //Inform the managers about the request for approval.
                    requestor     = empProcess.GetEmployeeViewByID(requestorID);
                    receipients   = GetManagersMailList(requestor.DepartmentID);
                    emailTemplate = GetTemplate("Release_WithApproval.html");
                    emailBody     = BuildAssignmentEmailBody(assignment, emailTemplate, "Managers", requestor.FirstName + " " + requestor.LastName);
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignment.AssetAssignmentID);
                    emailData     = new EmailData(receipients, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.RELEASE_REQUEST_DENIED:

                    //Inform the requestor
                    requestor   = empProcess.GetEmployeeViewByID(requestorID);
                    receipients = GetManagersMailList(requestor.DepartmentID);

                    emailTemplate = GetTemplate("Release_Denied.html");
                    emailBody     = emailBody = BuildAssignmentEmailBody(assignment, emailTemplate, requestor.FirstName + " " + requestor.LastName);
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignment.AssetAssignmentID);
                    emailData     = new EmailData(requestor.EmailAddress, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.RELEASE_REQUEST_ACCEPTED:

                    //Inform the Admin
                    requestor     = empProcess.GetEmployeeViewByID(requestorID);
                    receipients   = GetAdminMailToList(requestor.DepartmentID);
                    emailTemplate = GetTemplate("Release_Accepted.html");
                    emailBody     = emailBody = BuildAssignmentEmailBody(assignment, emailTemplate, requestor.FirstName + " " + requestor.LastName);
                    emailSubj     = String.Format("FASTrack : Asset Assignment REF#{0}", assignment.AssetAssignmentID);
                    emailData     = new EmailData(receipients, emailSubj, emailBody);
                    SendAsync(emailData);

                    break;

                case EmailType.TRANSFER_COMPLETE:

                    //TODO : Is this needed?
                    //return GetTemplate("Asset_Transfer_Complete.txt");
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                Elmah.ErrorLog.GetDefault(null).Log(new Elmah.Error(ex));
            }
        }