public JsonResult UserRegister(SJSCUserMasterModels UserData)
        {
            if (UserData.EmpCode == null)
            {
                Random generator = new Random();
                String r         = generator.Next(0, 999999).ToString("D6");
                UserData.EmpCode = r;
            }
            Int64 IsExist = _sJsisConcernRepository.checkUserIdWithEmpCode(UserData.EmailID, UserData.EmpCode);

            if (IsExist == 0)
            {
                Int64 s = _sJsisConcernRepository.registerUser(UserData);
                Session["SjsUserId"] = UserData.EmailID.Trim();
                Session["SjsPwd"]    = UserData.Pwd.Trim();
                var emailSubject      = "SpiceJet SOD-SJSC User Registration Confirmation Notification:" + System.DateTime.Now.ToString("dd/MMM/yyyy hh:mm:ss tt");
                var emailTemplateName = "SJSCUserRegistrationConfirmation.html";
                var emailCredentials  = EmailCredentials(emailSubject, emailTemplateName, UserData);
                var SJSCRegistrationVerificationLink = ConfigurationManager.AppSettings["SJSCRegistrationVerification"].Trim();
                var uri = SJSCRegistrationVerificationLink + "?str=" + CipherURL.Encrypt(UserData.EmailID.Trim());

                var templateData = emailCredentials.TemplateFilePath;
                templateData = templateData.Replace("[hrefLink]", uri);
                emailCredentials.TemplateFilePath = templateData;
                TempData["emailData"]             = emailCredentials;
                TempData["emailId"] = UserData.EmailID.Trim();
                return(Json(s > 0 ? "Your registration process has been completed successfully. Please Activate your account via clicking on the link sent to your registered Email Id and login." : "Oops! something went wrong", JsonRequestBehavior.AllowGet));
            }
            else
            {
                var msg = "This Employee Code :" + UserData.EmpCode + " or Employee Email ID : " + UserData.EmailID + " has already been registered.";
                return(Json(msg, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult validateUserIdforForgetPassword(SJSCUserMasterModels UserData)
        {
            Int64 IsExist = _sJsisConcernRepository.checkUserId(UserData);

            if (IsExist != 0)
            {
                try
                {
                    var regUserData = _sJsisConcernRepository.GetUserData(UserData.EmailID);
                    _sJsisConcernRepository.modifyPwd(UserData.EmailID);
                    UserData.FirstName = regUserData.FirstName;
                    UserData.LastName  = regUserData.LastName;
                    var ExpDate               = DateTime.Now.AddMinutes(720);
                    var emailSubject          = "SOD-SJSC Account Recovery Notification:" + System.DateTime.Now.ToString("dd/MMM/yyyy hh:mm:ss tt");
                    var emailTemplateName     = "SJSCUserForgotPassword.html";
                    var emailCredentials      = EmailCredentials(emailSubject, emailTemplateName, UserData);
                    var SJSCResetPasswordLink = ConfigurationManager.AppSettings["SJSCResetPassword"].Trim();
                    var uri          = SJSCResetPasswordLink + "?str =" + CipherURL.Encrypt(UserData.EmailID.Trim()) + "&expdate=" + CipherURL.Encrypt(Convert.ToString(ExpDate));
                    var appLink      = "<table><tr style='font-family:Arial;'><td style='padding:10px; height:25px; background-color:#04B431;text-align:center;border-radius:5px'><a style='color:#fff; text-decoration:none;' href='" + uri + "'>Reset Password</a></td></tr></table>";
                    var templateData = emailCredentials.TemplateFilePath;
                    templateData = templateData.Replace("[hrefLink]", appLink);
                    emailCredentials.TemplateFilePath = templateData;
                    TempData["emailData"]             = emailCredentials;
                    TempData["emailId"] = UserData.EmailID.Trim();
                }
                catch (Exception ex)
                {
                    return(Json("Error", JsonRequestBehavior.AllowGet));
                }
                return(Json("Success", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("Invalid", JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 3
0
        public IHttpActionResult Get()
        {
            object emailData  = new object();
            string emailId    = string.Empty;
            var    ListToSend = new List <String>();

            try
            {
                var controller = DependencyResolver.Current.GetService <HotelOnlyController>();
                var res        = _userRepository.GetReminderListTosendApproval(1);
                foreach (var lst in res)
                {
                    var hotelList = new List <TravelRequestHotelDetailModels>();
                    var dicList   = new Dictionary <string, object>();
                    dicList = _userRepository.GetSodHotelInfo(Convert.ToInt64(lst));
                    var    bookingInfo        = dicList["bookingInfolist"] as List <TravelRequestMasterModels>;
                    var    hotel_List         = dicList["hotelinfolist"] as List <TravelRequestHotelDetailModels>;
                    var    flightinfo         = dicList["flightInfolist"] as List <FlightDetailModels>;
                    String hodEmailId         = _userRepository.GetHODEmailIdByTravelReqID(lst.TravelRequestId.ToString());
                    var    emailSubject2      = "SOD-SJSC Hotel Booking Request Notification :" + System.DateTime.Now.ToString();
                    var    emailTemplateName2 = "SodHotelBookingRequestFor_HodHotelApproval.html";

                    var emailCredentials2 = controller.EmailCredentialsHotelHod(emailSubject2, emailTemplateName2, hotel_List, bookingInfo, flightinfo, lst.TravelRequestId.ToString(), hodEmailId);
                    // var emailData_hod = emailCredentials2;


                    var templateData = emailCredentials2.TemplateFilePath;
                    var appLink      = string.Empty;
                    var approvaltype = string.Empty;
                    var emailId_hod  = hodEmailId.Split(',')[0].ToString().Trim();
                    if (hodEmailId.Length > 0)
                    {
                        var skey = new StringBuilder();
                        skey.Append(bookingInfo[0].TravelRequestId.ToString() + ",");
                        skey.Append(bookingInfo[0].EmailId.Trim() + ",");
                        skey.Append(bookingInfo[0].SodBookingTypeId.ToString() + ",");
                        skey.Append(bookingInfo[0].BookingFor.Trim() + ",");
                        skey.Append(hodEmailId.ToString().Trim() + ",");
                        skey.Append(0);

                        var uri1 = ConfigurationManager.AppSettings["emailOnlyHotelApprovalPathHod"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=a");
                        var uri2 = ConfigurationManager.AppSettings["emailOnlyHotelApprovalPathHod"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=r");

                        approvaltype = "Please help to accord your Acceptance or Rejection.";
                        appLink      = "<table><tr style='font-family:Arial;'><td style='width:110px; height:25px; background-color:#04B431;text-align:center;border-radius:5px'><a name='app' style='color:#fff; text-decoration:none;' href='" + uri1 + "'>Acceptance</a></td> <td>&nbsp;</td> <td style='width:110px; height:25px; background-color:#b33;text-align:center;border-radius:5px'><a name='rej' style='color:#fff; text-decoration:none;' href='" + uri2 + "'>Rejection</a> </td></tr></table>";

                        templateData = templateData.Replace("[approvaltype]", approvaltype);
                        templateData = templateData.Replace("[appLink]", appLink);
                        templateData = templateData.Replace("[hodName]", hodEmailId.Split(',')[1]);
                        templateData = templateData.Replace("[RequesterName]", bookingInfo[0].Title + " " + bookingInfo[0].RequestedEmpName);
                        emailCredentials2.TemplateFilePath = templateData;

                        //var emaildata2 = emailData_hod as EmailNotificationModel;
                        var emailid2 = emailId_hod.ToString();
                        EmailNotifications.SendBookingRequestNotificationTo_Requester(emailCredentials2, emailid2);
                        //SendBookingRequestNotificationTo_Requester_Traveldesk
                    }
                }
                return(Json("su"));
            }
            catch (Exception ex)
            {
                return(Json(ex.InnerException.Message.ToString()));

                throw ex;
            }
            return(Json("su"));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Submit Hotel Info
        /// </summary>
        /// <param name="sodRequestsList"></param>
        /// <param name="sodflightList"></param>
        /// <param name="hotelDetailList"></param>
        /// <returns></returns>
        public JsonResult SubmitHotelInfo(List <TravelRequestMasterModels> sodRequestsList, List <FlightDetailModels> sodflightList, List <TravelRequestHotelDetailModels> hotelDetailList)
        {
            var    s           = 0;
            var    jsonmsg     = string.Empty;
            var    BookingType = string.Empty;
            string hodEmailId  = "";

            sodRequestsList[0].IsVendorBooking = false;
            sodRequestsList[0].IsSJSC          = false;
            //check duplicate hotel data
            if (sodRequestsList[0].IsHotelRequired == true)
            {
                foreach (var i in hotelDetailList)
                {
                    var empcode   = i.EmployeeCode;
                    var checkin   = i.CheckInDate;
                    var hotelcity = i.City;

                    var result = _transportRepository.FindDuplicateDataHotel(empcode, checkin, hotelcity);
                    if (result == true)
                    {
                        jsonmsg             = "Warning: A similar hotel booking already exists. Kindly cancel the previous hotel booking and try again.";
                        TempData["jsonmsg"] = jsonmsg;
                        return(Json(jsonmsg, JsonRequestBehavior.AllowGet));
                    }
                }
            }
            GetLoginUserInfo(sodRequestsList[0].RequestedEmpId.ToString());
            var empInfo = TempData["EmpInfo"] as List <string>;

            hodEmailId = _userRepository.GetHODEmailId(empInfo[8]);
            var r = _userRepository.IsBlanketApproverRole(Convert.ToInt32(empInfo[0]));

            sodRequestsList[0].SJSCHodEmailId = hodEmailId.Split(',')[0].ToString().Trim();
            //Save master Information, flight information, hotel information
            s = _userRepository.SaveOnlyHotelBookingRequest(sodRequestsList, sodflightList, hotelDetailList);
            //send mail to approver and user
            var hotelList = new List <TravelRequestHotelDetailModels>();
            var dicList   = new Dictionary <string, object>();

            dicList = _userRepository.GetSodHotelInfo(Convert.ToInt64(s.ToString()));
            TempData["bookingInfo"] = dicList["bookingInfolist"] as List <TravelRequestMasterModels>;
            TempData["hotelList"]   = dicList["hotelinfolist"] as List <TravelRequestHotelDetailModels>;
            TempData["flightinfo"]  = dicList["flightInfolist"] as List <FlightDetailModels>;
            //Send Email Notification
            if (TempData["hotelList"] != null && TempData["bookingInfo"] != null && TempData["flightinfo"] != null)
            {
                var hotel_List        = TempData["hotelList"] as List <TravelRequestHotelDetailModels>;
                var bookingInfo       = TempData["bookingInfo"] as List <TravelRequestMasterModels>;
                var flightinfo        = TempData["flightinfo"] as List <FlightDetailModels>;
                var emailSubject      = "SOD Only-Hotel Booking Request Notification :" + System.DateTime.Now.ToString();
                var emailTemplateName = "OnlyHotelBookingRequestFor_User.html";
                var emailCredentials  = EmailCredentialsHotel(emailSubject, emailTemplateName, hotel_List, bookingInfo, flightinfo, s.ToString(), "pending");
                TempData["emailData"] = emailCredentials;
                TempData["emailId"]   = bookingInfo[0].EmailId.Trim();
                var emaildata = TempData["emailData"] as EmailNotificationModel;
                var emailid   = TempData["emailId"].ToString();
                EmailNotifications.SendBookingRequestNotificationTo_Requester(emaildata, emailid);

                if (bookingInfo[0].RequestedEmpId.ToString() == hodEmailId.Split(',')[2].ToString().Trim() || r == true)
                {
                    _userRepository.UpdateOnlyHotelApprovalStatus(bookingInfo[0].TravelRequestId);
                    //Redirect to Thank You Page
                    jsonmsg = "SOD Hotel Booking Request ID : " + s.ToString() + " ." + "Booking process has been completed successfully.Your booking request has been sent to Traveldesk for Hotel alignment.";

                    TempData["jsonmsg"] = jsonmsg;
                    return(Json(jsonmsg, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    var emailSubject2      = "SOD Hotel Booking Request Notification :" + System.DateTime.Now.ToString();
                    var emailTemplateName2 = "SodHotelBookingRequestFor_HodHotelApproval.html";
                    var emailCredentials2  = EmailCredentialsHotelHod(emailSubject2, emailTemplateName2, hotel_List, bookingInfo, flightinfo, s.ToString(), hodEmailId);

                    var templateData = emailCredentials2.TemplateFilePath;
                    var appLink      = string.Empty;
                    var approvaltype = string.Empty;
                    if (hodEmailId.Length > 0)
                    {
                        var skey = new StringBuilder();
                        skey.Append(bookingInfo[0].TravelRequestId.ToString() + ",");
                        skey.Append(bookingInfo[0].EmailId.Trim() + ",");
                        skey.Append(bookingInfo[0].SodBookingTypeId.ToString() + ",");
                        skey.Append(bookingInfo[0].BookingFor.Trim() + ",");
                        skey.Append(hodEmailId.Split(',')[2].ToString());

                        var uri1 = ConfigurationManager.AppSettings["emailOnlyHotelApprovalPathHod"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=a");
                        var uri2 = ConfigurationManager.AppSettings["emailOnlyHotelApprovalPathHod"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=r");

                        approvaltype = "Please help to accord your Acceptance or Rejection.";
                        appLink      = "<table><tr style='font-family:Arial;'><td style='width:110px; height:25px; background-color:#04B431;text-align:center;border-radius:5px'><a name='app' style='color:#fff; text-decoration:none;' href='" + uri1 + "'>Acceptance</a></td> <td>&nbsp;</td> <td style='width:110px; height:25px; background-color:#b33;text-align:center;border-radius:5px'><a name='rej' style='color:#fff; text-decoration:none;' href='" + uri2 + "'>Rejection</a> </td></tr></table>";

                        templateData = templateData.Replace("[approvaltype]", approvaltype);
                        templateData = templateData.Replace("[appLink]", appLink);
                        templateData = templateData.Replace("[hodName]", hodEmailId.Split(',')[1]);
                        templateData = templateData.Replace("[RequesterName]", bookingInfo[0].RequestedEmpName);
                        emailCredentials2.TemplateFilePath = templateData;
                        //EMail
                        EmailNotifications.SendBookingRequestNotificationTo_Requester(emailCredentials2, hodEmailId.Split(',')[0].ToString().Trim());
                        //SMS Approval
                        SendSMSforApproval(hodEmailId, bookingInfo[0], hotel_List, uri1, uri2);

                        //Redirect to Thank You Page
                        jsonmsg = "SOD Hotel Booking Request ID : " + s.ToString() + " ." + "Booking process has been completed successfully.Your booking request has been sent to your respected approver at  " + hodEmailId.Split(',')[0].ToString();
                    }
                    TempData["jsonmsg"] = jsonmsg;
                    return(Json(jsonmsg, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                jsonmsg             = "Error: Hotel information cannot be saved. Please try again later.";
                TempData["jsonmsg"] = jsonmsg;
                return(Json(jsonmsg, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Reject Sod Booking Request
        /// </summary>
        /// <returns></returns>
        public JsonResult RejectSodBookingRequest(string travelReqId)
        {
            var jsonmsg     = string.Empty;
            var bookingType = string.Empty;
            var strHoldPNR  = string.Empty;

            if ((travelReqId.Split(',')[0] == "undefined") || (travelReqId.Split(',')[0] == ""))
            {
                return(Json("Invalid record.", JsonRequestBehavior.AllowGet));
            }
            var approvalList = new TravelRequestApprovalModels()
            {
                TravelRequestId       = Convert.ToInt64(travelReqId.Split(',')[0]),
                ApprovedByEmpId       = Convert.ToInt32(Session["EmpId"].ToString()),
                RevenueApprovedStatus = 2,//for reject
                RevenueApprovedDate   = System.DateTime.Now,
                Comment = travelReqId.Split(',')[4]
            };
            //Check Duplicate PNR
            var chkpnr = Services.ADO.SodCommonServices.CheckDuplicatePNR(Convert.ToInt64(travelReqId.Split(',')[0]), 1);

            if (!chkpnr.Equals("0"))
            {
                return(Json("Sorry : PNR has been already generated for this Booking Request ID-" + travelReqId.Split(',')[0] + ".Rejection is not allowed.\n Existing PNR No. :" + chkpnr, JsonRequestBehavior.AllowGet));
            }

            //Get Data to show for rejection
            var sodRequestsList    = new List <TravelRequestMasterModels>();
            var sodflightList      = new List <FlightDetailModels>();
            var passengerList      = new List <PassengerDetailModels>();
            var approvalInfoList   = new List <TravelRequestApprovalModels>();
            var passengerMealsList = new List <PassengerMealAllocationModels>();
            var hotelList          = new List <TravelRequestHotelDetailModels>();
            var s = _sodApproverRepositorty.RejectSodBookingRequest_Revenue(approvalList);

            if (s >= 1)
            {
                var dicList = new Dictionary <string, object>();
                dicList            = _sodApproverRepositorty.GetSodBookingInfoForPNR(Convert.ToInt64(travelReqId.Split(',')[0]));
                sodRequestsList    = dicList["bookingInfo"] as List <TravelRequestMasterModels>;
                sodflightList      = dicList["flightInfo"] as List <FlightDetailModels>;
                passengerList      = dicList["passInfo"] as List <PassengerDetailModels>;
                approvalInfoList   = dicList["approvalInfo"] as List <TravelRequestApprovalModels>;
                passengerMealsList = dicList["mealsInfo"] as List <PassengerMealAllocationModels>;
                hotelList          = dicList["hotelInfo"] as List <TravelRequestHotelDetailModels>;
                bookingType        = sodRequestsList[0].SodBookingTypeId == 1 ? "SOD" : "NON-SOD";

                //by lata (to gnerate standby PNR and send Email notification
                if (travelReqId.Split(',')[5] == "1")
                {
                    sodRequestsList[0].BookingFor = "standby";
                    var pnr = NavitaireServices.Generate_PNR(sodRequestsList, sodflightList, passengerList, passengerMealsList);
                    pnr = pnr + "|0001.11";
                    var pnrc = "Your Standby PNR is :" + pnr.Split('|')[0];
                    //insert value in sodtravelrequestmaster_reject with standbyPNR
                    SaveRejectwithStandByPNR(sodRequestsList[0], pnr);

                    sendNotification_RejectStandby(sodRequestsList, sodflightList, passengerList, passengerMealsList, hotelList, travelReqId.Split(',')[0], pnrc);
                }
                //Hold PNR
                if (sodRequestsList[0].IsAmountPaidByTraveller.Equals(true))
                {
                    strHoldPNR = ConfigurationManager.AppSettings["strHOLDPNRPassenger"].Trim();
                }
                else
                {
                    strHoldPNR = "";
                }
                //Send Rejection Email Notification
                var emailSubject      = bookingType + " " + "Booking Request Notification Rejection through Revenue and Itinerary :" + System.DateTime.Now.ToString("dd-MMM-yyyy-hh:mm:ss");
                var emailTemplateName = "SodBookingRequest_Rejection_User.html";
                var emailCredentials  = EmailCredentials(emailSubject, emailTemplateName, sodRequestsList, sodflightList, passengerList, passengerMealsList, hotelList, travelReqId.Split(',')[0].ToString(), strHoldPNR);

                if (approvalInfoList[0].IsMandatoryTravel == 1)
                {
                    emailCredentials.TemplateFilePath = emailCredentials.TemplateFilePath.Replace("[Team]", "Revenue Dept. and forwarded to C-Level Approval.");
                }
                else if (approvalInfoList[0].IsMandatoryTravel == 0)
                {
                    emailCredentials.TemplateFilePath = emailCredentials.TemplateFilePath.Replace("[Team]", "Revenue Dept. and the booking request has been closed.");
                }

                TempData["emailData"] = emailCredentials;
                TempData["emailId"]   = sodRequestsList[0].EmailId.Trim();

                //Check If Mandatory for send email
                if (approvalInfoList[0].IsMandatoryTravel == 1)
                {
                    emailSubject      = bookingType + " " + "Booking Request Notification Rejection through Revenue and Itinerary :" + System.DateTime.Now.ToString("dd-MMM-yyyy-hh:mm:ss");
                    emailTemplateName = "SodBookingRequestNotificationTemplate_HOD.html";

                    //Send Notification to C-Level: Need C- Level Approval Email Template
                    var      counter  = 0;
                    var      emailids = _sodApproverRepositorty.GetCXOMailId(sodRequestsList[0].CLevelApprover1, sodRequestsList[0].CLevelApprover2);
                    string[] arr      = emailids.Split('|');

                    if (arr.Length == 2)
                    {
                        counter = 1;
                    }
                    else if (arr.Length == 4)
                    {
                        counter = 2;
                    }

                    for (int i = 0; i <= counter; i++)
                    {
                        var skey = new StringBuilder();
                        skey.Append(sodRequestsList[0].TravelRequestId.ToString() + ",");
                        skey.Append(sodRequestsList[0].EmailId.Trim() + ",");
                        skey.Append(sodRequestsList[0].SodBookingTypeId.ToString() + ",");
                        skey.Append(sodRequestsList[0].BookingFor.Trim() + ",");
                        skey.Append(arr[i] + ",");
                        skey.Append(sodRequestsList[0].IsMandatoryTravel.ToString() + ",RN");

                        var uri1 = ConfigurationManager.AppSettings["emailApprovalPathcxo"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=a");
                        var uri2 = ConfigurationManager.AppSettings["emailApprovalPathcxo"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=r");

                        var approvaltype = "Please help to accord your Acceptance or Rejection.";
                        var appLink      = "<table><tr style='font-family:Arial;'><td style='width:110px; height:25px; background-color:#04B431;text-align:center;border-radius:5px'><a name='app' style='color:#fff; text-decoration:none;' href='" + uri1 + "'>Acceptance</a></td> <td>&nbsp;</td> <td style='width:110px; height:25px; background-color:#b33;text-align:center;border-radius:5px'><a name='rej' style='color:#fff; text-decoration:none;' href='" + uri2 + "'>Rejection</a> </td></tr></table>";

                        //Wrap link in template
                        emailCredentials = EmailCredentials(emailSubject, emailTemplateName, sodRequestsList, sodflightList, passengerList, passengerMealsList, hotelList, travelReqId.Split(',')[0].ToString(), strHoldPNR);
                        var templateData = emailCredentials.TemplateFilePath;
                        var hodName      = "Sir/Madam";

                        templateData = templateData.Replace("[approvaltype]", approvaltype);
                        templateData = templateData.Replace("[appLink]", appLink);
                        templateData = templateData.Replace("[hodName]", hodName);
                        emailCredentials.TemplateFilePath = templateData;
                        i = i + 1;
                        EmailNotifications.SendBookingRequestNotificationTo_Requester(emailCredentials, arr[i]);
                    }
                    jsonmsg = bookingType + " " + "booking request has been rejected and has been sent to CXO Panel.";
                }
                else if (approvalInfoList[0].IsMandatoryTravel == 0)
                {
                    //This methos also can be used by Revenue dept to close the Booking Request
                    var trRequestMaster = new TravelRequestMasterModels()
                    {
                        TravelRequestId = Convert.ToInt64(travelReqId.Split(',')[0]),
                        BookingStatus   = "Close",
                        StatusDate      = System.DateTime.Now
                    };
                    var c = _sodApproverRepositorty.CloseSodBookingRequest_HOD(trRequestMaster);
                    jsonmsg = bookingType + " " + "booking request has been rejected and the request has been closed.";
                }
            }
            return(Json(s >= 1 ? jsonmsg : string.Empty, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Send Email Notification & generate PNR for booking requester/user
        /// </summary>
        /// <returns></returns>
        public string BackgroundProcessNotification()
        {
            var jsonmsg = string.Empty;
            //Sod Confirm booking
            var travelReqId = TempData["requestData"].ToString();

            if (travelReqId.Split(',')[2].Equals("SOD") && travelReqId.Split(',')[3].Equals("Confirm"))
            {
                var pnrStatus = GeneratePNR(Convert.ToInt64(travelReqId.Split(',')[0]), travelReqId.Split(',')[1].Trim());
                if (pnrStatus.Length.Equals(6))
                {
                    jsonmsg = "SOD Booking Request ID :" + travelReqId.Split(',')[2].ToUpper() + "-" + travelReqId.Split(',')[0] + "\n Booking Type :Confirm \n\n Approval Process has been completed successfully.\n PNR No :" + pnrStatus;
                }
            }
            else
            {
                //Send Email Notification to One CXO  :23-Nov-2016
                //Get Data to show for rejection
                var strHoldPNR         = "";
                var sodRequestsList    = new List <TravelRequestMasterModels>();
                var sodflightList      = new List <FlightDetailModels>();
                var passengerList      = new List <PassengerDetailModels>();
                var approvalInfoList   = new List <TravelRequestApprovalModels>();
                var passengerMealsList = new List <PassengerMealAllocationModels>();
                var hotelList          = new List <TravelRequestHotelDetailModels>();
                var dicList            = new Dictionary <string, object>();

                //Fill Value in List
                dicList            = _sodApproverRepositorty.GetSodBookingInfoForPNR(Convert.ToInt64(travelReqId.Split(',')[0]));
                sodRequestsList    = dicList["bookingInfo"] as List <TravelRequestMasterModels>;
                sodflightList      = dicList["flightInfo"] as List <FlightDetailModels>;
                passengerList      = dicList["passInfo"] as List <PassengerDetailModels>;
                approvalInfoList   = dicList["approvalInfo"] as List <TravelRequestApprovalModels>;
                passengerMealsList = dicList["mealsInfo"] as List <PassengerMealAllocationModels>;
                hotelList          = dicList["hotelInfo"] as List <TravelRequestHotelDetailModels>;
                var bookingType = sodRequestsList[0].SodBookingTypeId == 1 ? "SOD" : "NON-SOD";

                //Allocate Email Template
                var emailSubject      = bookingType + " " + "Booking Request Notification Acceptance through Revenue and Itinerary :" + System.DateTime.Now.ToString("dd-MMM-yyyy-hh:mm:ss");
                var emailTemplateName = "SodBookingRequestNotificationTemplate_HOD.html";

                //Send Notification to one C-Level:
                var strcxodetails = _sodApproverRepositorty.GetCXOMailId(sodRequestsList[0].CLevelApprover1, sodRequestsList[0].CLevelApprover2);
                var emailid       = strcxodetails.Split('|')[1];
                var cxoEmpId      = strcxodetails.Split('|')[0];

                var skey = new StringBuilder();
                skey.Append(sodRequestsList[0].TravelRequestId.ToString() + ",");
                skey.Append(sodRequestsList[0].EmailId.Trim() + ",");
                skey.Append(sodRequestsList[0].SodBookingTypeId.ToString() + ",");
                skey.Append(sodRequestsList[0].BookingFor.Trim() + ",");
                skey.Append(cxoEmpId + ",");
                skey.Append(sodRequestsList[0].IsMandatoryTravel.ToString() + ",RY");

                //passing querystring
                var uri1 = ConfigurationManager.AppSettings["emailApprovalPathcxo"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=a");
                var uri2 = ConfigurationManager.AppSettings["emailApprovalPathcxo"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=r");

                var approvaltype = "Please help to accord your Acceptance or Rejection.";
                var appLink      = "<table><tr style='font-family:Arial;'><td style='width:110px; height:25px; background-color:#04B431;text-align:center;border-radius:5px'><a name='app' style='color:#fff; text-decoration:none;' href='" + uri1 + "'>Acceptance</a></td> <td>&nbsp;</td> <td style='width:110px; height:25px; background-color:#b33;text-align:center;border-radius:5px'><a name='rej' style='color:#fff; text-decoration:none;' href='" + uri2 + "'>Rejection</a> </td></tr></table>";

                //Get Hold booking Status
                if (sodRequestsList[0].IsAmountPaidByTraveller.Equals(true))
                {
                    strHoldPNR = ConfigurationManager.AppSettings["strHOLDPNRPassenger"].Trim();
                }
                else
                {
                    strHoldPNR = "";
                }

                //Wrap link in template
                var emailCredentials = EmailCredentials(emailSubject, emailTemplateName, sodRequestsList, sodflightList, passengerList, passengerMealsList, hotelList, travelReqId.Split(',')[0].ToString(), strHoldPNR);
                var templateData     = emailCredentials.TemplateFilePath;
                var hodName          = "Sir/Madam";

                templateData = templateData.Replace("[approvaltype]", approvaltype);
                templateData = templateData.Replace("[appLink]", appLink);
                templateData = templateData.Replace("[hodName]", hodName);
                emailCredentials.TemplateFilePath = templateData;

                //Send email notification
                EmailNotifications.SendBookingRequestNotificationTo_Requester(emailCredentials, emailid);
                jsonmsg = "SOD Booking Request ID :" + travelReqId.Split(',')[2].ToUpper() + "-" + travelReqId.Split(',')[0] + "\n Booking Type :Confirm \n\n Approval Process has been completed successfully.\n The booking request has been sent to CXO Panel at -" + emailid;
            }
            return(jsonmsg);
        }
Ejemplo n.º 7
0
        private void WriteEmailCredentialsForApprover(string subject, string VendoremailTemplateName, List <VendorModels> mailerlist, List <VendorHODDetails> approverDetails, List <string> loggedUserInfo, int batchId)
        {
            var emailCredentials = EmailCredentials(subject, VendoremailTemplateName, mailerlist);
            var SODtemplateData  = emailCredentials.TemplateFilePath;

            SODtemplateData = SODtemplateData.Replace("[RequesterName]", approverDetails[0].ApproverTitle + " " + approverDetails[0].ApproverName);
            SODtemplateData = SODtemplateData.Replace("[hodname]", loggedUserInfo[3] + " " + loggedUserInfo[2]);
            var appLink      = string.Empty;
            var approvaltype = string.Empty;
            var skey         = new StringBuilder();

            skey.Append(batchId + ",");
            skey.Append(approverDetails[0].ApproverEmailID + ",");
            skey.Append(approverDetails[0].ApproverTitle + " " + approverDetails[0].ApproverName + ",");
            var uri1 = ConfigurationManager.AppSettings["emailApprovalPathHodVendor"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=Approved");
            var uri2 = ConfigurationManager.AppSettings["emailApprovalPathHodVendor"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=Rejected");

            approvaltype    = "Please help to accord your Approval or Rejection.";
            appLink         = "<table><tr style='font-family:Arial;'><td style='width:110px; height:25px; background-color:#04B431;text-align:center;border-radius:5px'><a name='app' style='color:#fff; text-decoration:none;' href='" + uri1 + "'>Approve</a></td> <td>&nbsp;</td> <td style='width:110px; height:25px; background-color:#b33;text-align:center;border-radius:5px'><a name='rej' style='color:#fff; text-decoration:none;' href='" + uri2 + "'>Reject</a> </td></tr></table>";
            SODtemplateData = SODtemplateData.Replace("[approvaltype]", approvaltype);
            SODtemplateData = SODtemplateData.Replace("[appLink]", appLink);
            emailCredentials.TemplateFilePath = SODtemplateData;
            TempData["emailData_Hod"]         = emailCredentials;
            TempData["emailId_Hod"]           = approverDetails[0].ApproverEmailID;
        }
Ejemplo n.º 8
0
        // GET: ResendMail
        public JsonResult ResendMailToHod()
        {
            string hodEmailId = string.Empty;
            IList <EmployeeModel> empInfo;
            var controller = DependencyResolver.Current.GetService <EmployeeBookingDetailController>();
            var trId       = Request.QueryString["trId"].ToString();
            //Get Booking Detail
            var dicList            = GetDetailOfBookingHistoryByTrId(trId);
            var sodRequestsList    = dicList["bookingInfo"] as List <TravelRequestMasterModels>;
            var sodflightList      = dicList["flightInfo"] as List <FlightDetailModels>;
            var passengerList      = dicList["passInfo"] as List <PassengerDetailModels>;
            var passengerMealsList = dicList["mealsInfo"] as List <PassengerMealAllocationModels>;
            var cabList            = dicList["cabInfo"] as List <TravelRequestCabDetailModels>;
            var hotelList          = dicList["hotelInfo"] as List <TravelRequestHotelDetailModels>;

            //This is for SJSC-Hotel Booking
            if (sodRequestsList[0].TravelRequestTypeId == 5 || sodRequestsList[0].TravelRequestCode.Contains("SOD SJSC"))
            {
                //string UserDetails=""//will come from SJSCUserInfor table//Nee to check from SJSC Controller Link Gnereation
                var hodEmaildata = _sJsisConcernRepository.GetHodDetails(Session["HodEmailId"].ToString());
                hodEmailId = hodEmaildata[0].HodEmail + "," + hodEmaildata[0].HoDTitle + " " + hodEmaildata[0].HoDName + "," + "000" + "," + hodEmaildata[0].HodMobileNo + "," + "00113581";
            }
            else
            {
                empInfo    = _userRepository.GetEmployeeList(int.Parse(Session["EmpId"].ToString()));
                hodEmailId = _userRepository.GetHODEmailId(empInfo[0].EmployeeVertical);
            }

            if (hodEmailId.Length > 0)
            {
                //Mail Template
                var strHoldPNR        = "";
                var BookingFor        = "";
                var emailSubject      = "";
                var emailTemplateName = "";
                var BookingType       = (sodRequestsList[0].SodBookingTypeId == (short)2) ? "NON-SOD" : "SOD";

                EmailNotificationModel emailCredentials = new EmailNotificationModel();
                if (sodRequestsList[0].BookingFor == "Only Hotel")
                {
                    BookingFor        = sodRequestsList[0].BookingFor;
                    emailSubject      = "SOD Only-Hotel Booking Request Notification :" + System.DateTime.Now.ToString();
                    emailTemplateName = "SodHotelBookingRequestFor_HodHotelApproval.html";
                    emailCredentials  = controller.EmailCredentialsHotelHod(emailSubject, emailTemplateName, hotelList, sodRequestsList, trId, hodEmailId.Split(',')[0]);
                }
                else
                {
                    if (sodRequestsList[0].TravelRequestCode.Contains("SOD SJSC"))
                    {
                        BookingFor   = (sodRequestsList[0].BookingFor.Trim().ToLower() == "standby") ? "Standby" : "Confirm";
                        emailSubject = BookingType + " " + "SJSC" + " " + BookingFor + " " + "Booking Request Notification :" + System.DateTime.Now.ToString();
                    }
                    else
                    {
                        BookingFor   = (sodRequestsList[0].BookingFor.Trim().ToLower() == "standby") ? "Standby" : "Confirm";
                        emailSubject = BookingType + " " + BookingFor + " " + "Booking Request Notification :" + System.DateTime.Now.ToString();
                    }
                    emailTemplateName = "SodBookingRequestNotificationTemplate_HOD.html";
                    emailCredentials  = controller.EmailCredentials(emailSubject, emailTemplateName, sodRequestsList, sodflightList, passengerList, passengerMealsList, hotelList, trId, strHoldPNR);
                }
                TempData["emailData_hod"] = emailCredentials;
                TempData["emailId_hod"]   = hodEmailId.Split(',')[0].ToString().Trim();

                var templateData = emailCredentials.TemplateFilePath;
                var appLink      = string.Empty;
                var approvaltype = string.Empty;
                var uri1         = string.Empty;
                var uri2         = string.Empty;
                if (hodEmailId.Length > 0)
                {
                    var skey = new StringBuilder();
                    skey.Append(sodRequestsList[0].TravelRequestId.ToString() + ",");
                    skey.Append(sodRequestsList[0].EmailId.Trim() + ",");
                    skey.Append(sodRequestsList[0].SodBookingTypeId.ToString() + ",");
                    skey.Append(sodRequestsList[0].BookingFor.Trim() + ",");
                    skey.Append(hodEmailId.Split(',')[2] + ",");
                    skey.Append(sodRequestsList[0].IsMandatoryTravel.ToString());
                    if (sodRequestsList[0].BookingFor == "Only Hotel" || sodRequestsList[0].TravelRequestTypeId == 5)
                    {
                        uri1 = ConfigurationManager.AppSettings["emailOnlyHotelApprovalPathHod"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=a");
                        uri2 = ConfigurationManager.AppSettings["emailOnlyHotelApprovalPathHod"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=r");
                    }
                    else
                    {
                        uri1 = ConfigurationManager.AppSettings["emailApprovalPath"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=a");
                        uri2 = ConfigurationManager.AppSettings["emailApprovalPath"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=r");
                    }

                    if (sodRequestsList[0].IsMandatoryTravel.Equals(1))
                    {
                        approvaltype = "Please help to accord your Acceptance or Rejection or Mandatory Travel – Approval.";
                        appLink      = "<table><tr style='font-family:Arial;'><td style='width:110px; height:25px; background-color:#04B431;text-align:center;border-radius:5px'><a name='app' style='color:#fff; text-decoration:none;' href='" + uri1 + "'>Acceptance</a></td> <td>&nbsp;</td> <td style='width:110px; height:25px; background-color:#b33;text-align:center;border-radius:5px'><a name='rej'  style='color:#fff; text-decoration:none;' href='" + uri2 + "'>Rejection</a> </td><td>&nbsp;</td> <td style='width:275x; height:25px; background-color:#01DF3A;text-align:center;border-radius:5px'><a name='mapp'  style='color:#fff; text-decoration:none;' href='" + uri1 + "'>Mandatory Travel – Approve</a></td></tr></table>";
                    }
                    else
                    {
                        approvaltype = "Please help to accord your Acceptance or Rejection.";
                        appLink      = "<table><tr style='font-family:Arial;'><td style='width:110px; height:25px; background-color:#04B431;text-align:center;border-radius:5px'><a name='app' style='color:#fff; text-decoration:none;' href='" + uri1 + "'>Acceptance</a></td> <td>&nbsp;</td> <td style='width:110px; height:25px; background-color:#b33;text-align:center;border-radius:5px'><a name='rej' style='color:#fff; text-decoration:none;' href='" + uri2 + "'>Rejection</a> </td></tr></table>";
                    }

                    templateData = templateData.Replace("[approvaltype]", approvaltype);
                    templateData = templateData.Replace("[appLink]", appLink);
                    templateData = templateData.Replace("[hodName]", hodEmailId.Split(',')[1]);
                    templateData = templateData.Replace("[RequesterName]", sodRequestsList[0].RequestedEmpName);
                    emailCredentials.TemplateFilePath = templateData;
                }
                var emaildata = TempData["emailData_hod"] as EmailNotificationModel;
                var emailid   = TempData["emailId_hod"].ToString();
                EmailNotification.EmailNotifications.SendBookingRequestNotificationTo_Requester(emailCredentials, emailid);
                return(Json("Success", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("Fail", JsonRequestBehavior.AllowGet));
            }
        }