Exemplo n.º 1
0
        public AttachToMasterViewModel GetGoAhead(string token, GoAheadGetReq objGoAheadGetReq)
        {
            AttachToMasterViewModel model            = new AttachToMasterViewModel();
            GoAheadGetRes           objGoAheadGetRes = new GoAheadGetRes();

            try
            {
                model            = GetSalesOfficerHeraderInfo(objGoAheadGetReq.QRFID, "AttachToMaster", token);
                objGoAheadGetRes = handoverProviders.GetGoAhead(objGoAheadGetReq, token).Result;
                if (objGoAheadGetRes != null)
                {
                    model.GoAheadGetRes = objGoAheadGetRes;
                    model.UserList      = objGoAheadGetRes.UserSystemContactDetails.Select(a => new AttributeValues {
                        AttributeValue_Id = a.VoygerContactId, Value = a.FirstName + " " + a.LastName, Flag = a.IsOperationDefault
                    }).OrderBy(a => a.Value).ToList();
                    model.UserID   = string.IsNullOrEmpty(objGoAheadGetRes.mGoAhead.OperationUserID) ? model.UserList.Where(a => a.Flag == true).FirstOrDefault().AttributeValue_Id : objGoAheadGetRes.mGoAhead.OperationUserID;
                    model.UserName = string.IsNullOrEmpty(objGoAheadGetRes.mGoAhead.OperationUserName) ? model.UserList.Where(a => a.Flag == true).FirstOrDefault().Value : objGoAheadGetRes.mGoAhead.OperationUserName;
                    CostsheetVersion objCostsheetVersion = objGoAheadGetRes.CostsheetVersion.Where(a => a.IsCurrentVersion == true).FirstOrDefault();
                    if (objCostsheetVersion != null)
                    {
                        model.VersionId  = objCostsheetVersion.VersionId;
                        model.QRFPriceId = objCostsheetVersion.QRFPriceId;
                    }
                    if (objGoAheadGetRes.mGoAhead.ConfirmationDeadline != null)
                    {
                        var dt    = objGoAheadGetRes.mGoAhead.ConfirmationDeadline.Value;
                        var day   = dt.Day.ToString().Length == 1 ? "0" + dt.Day.ToString() : dt.Day.ToString();
                        var month = dt.Month.ToString().Length == 1 ? "0" + dt.Month.ToString() : dt.Month.ToString();
                        model.ConfirmationDT = day + "/" + month + "/" + dt.Year;
                    }
                    else
                    {
                        model.ConfirmationDT = null;
                    }
                }
                else
                {
                    objGoAheadGetRes     = new GoAheadGetRes();
                    model.GoAheadGetRes  = objGoAheadGetRes;
                    model.UserList       = new List <AttributeValues>();
                    model.UserID         = "";
                    model.UserName       = "";
                    model.VersionId      = 0;
                    model.QRFPriceId     = "";
                    model.ConfirmationDT = null;
                }
            }
            catch (Exception ex)
            {
                objGoAheadGetRes     = new GoAheadGetRes();
                model.GoAheadGetRes  = objGoAheadGetRes;
                model.UserList       = new List <AttributeValues>();
                model.UserID         = "";
                model.UserName       = "";
                model.VersionId      = 0;
                model.QRFPriceId     = "";
                model.ConfirmationDT = null;
            }
            return(model);
        }
Exemplo n.º 2
0
        public IActionResult AttachToMaster(string QRFID, string type = "")
        {
            AttachToMasterViewModel model = new AttachToMasterViewModel();

            model = handoverMapping.GetGoAhead(token, new GoAheadGetReq {
                QRFID = QRFID, GoAheadId = ""
            });
            if (!string.IsNullOrEmpty(type) && type == "partial")
            {
                return(PartialView("AttachToMaster/_AttachToMaster", model));
            }

            return(View("AttachToMaster/AttachToMaster", model));
        }
Exemplo n.º 3
0
        public AttachToMasterViewModel GetSalesOfficerHeraderInfo(string QRFID, string MenuName, string token)
        {
            AttachToMasterViewModel model = new AttachToMasterViewModel();

            model.MenuViewModel.QRFID    = QRFID;
            model.MenuViewModel.MenuName = MenuName;

            #region Get Costing Officer Tour Info Header By QRFId
            NewQuoteViewModel modelQuote = new NewQuoteViewModel();
            modelQuote.QRFID                    = QRFID;
            model.COHeaderViewModel             = cOCommonLibrary.GetCOTourInfoHeader(ref modelQuote, token);
            model.MenuViewModel.EnquiryPipeline = modelQuote.mdlMenuViewModel.EnquiryPipeline;
            #endregion
            return(model);
        }
Exemplo n.º 4
0
        public IActionResult SetAttachToMaster(AttachToMasterViewModel model)
        {
            model.GoAheadGetRes.mGoAhead.CreateUser = ckUserName;
            model.GoAheadGetRes.mGoAhead.EditUser   = ckUserName;
            string type = model.Type;

            GoAheadSetRes objGoAheadSetRes = handoverMapping.SetGoAhead(model, ckUserEmailId, token, ckLoginUser_Id);

            if (!string.IsNullOrEmpty(model.Type) && type == "partial")
            {
                return(Json(new
                {
                    status = objGoAheadSetRes.ResponseStatus.Status,
                    msg = objGoAheadSetRes.ResponseStatus.ErrorMessage,
                    goaheadid = objGoAheadSetRes.mGoAhead.GoAheadId
                }));
                //objGoAheadSetRes.mGoAhead.Depatures = null;
                //objGoAheadSetRes.mGoAhead.Depatures.Add(depres);
                //return PartialView("_Materialisation", objGoAheadSetRes.mGoAhead);
            }
            else
            {
                if (objGoAheadSetRes != null && objGoAheadSetRes.ResponseStatus != null && objGoAheadSetRes.ResponseStatus.Status.ToLower() == "success")
                {
                    //GoAheadSetRes objGoAheadSetResMail = handoverMapping.SendMailHandoverBooking(new GoAheadGetReq { GoAheadId = model.GoAheadGetRes.mGoAhead.GoAheadId, QRFID = model.GoAheadGetRes.mGoAhead.QRFID }, token);

                    TempData["success"] = objGoAheadSetRes.ResponseStatus.ErrorMessage;
                }
                else
                {
                    TempData["error"] = objGoAheadSetRes.ResponseStatus.ErrorMessage;
                }
                //var Status = "";
                //var Msg = "";
                //if (objGoAheadSetResMail != null && objGoAheadSetResMail.ResponseStatus != null)
                //{
                //    Status = objGoAheadSetResMail.ResponseStatus.Status;
                //    Msg = objGoAheadSetResMail.ResponseStatus.ErrorMessage;
                //}
                //else
                //{
                //    Status = "Error";
                //    Msg = "An Error Occurs.";
                //}
                return(RedirectToAction("AttachToMaster", new { QRFId = model.GoAheadGetRes.mGoAhead.QRFID }));
            }
        }
Exemplo n.º 5
0
        public GoAheadSetRes SetGoAhead(AttachToMasterViewModel model, string userEmail, string token, string voyagerUserId)
        {
            GoAheadSetRes objGoAheadSetRes = new GoAheadSetRes();
            GoAheadSetReq objGoAheadSetReq = new GoAheadSetReq {
                mGoAhead = model.GoAheadGetRes.mGoAhead, DepatureId = model.DepartureId
            };

            try
            {
                objGoAheadSetReq.mGoAhead.OperationUserID   = model.UserID;
                objGoAheadSetReq.mGoAhead.OperationUserName = model.UserName;
                objGoAheadSetReq.mGoAhead.QRFID             = model.MenuViewModel.QRFID;

                if (!string.IsNullOrEmpty(model.ConfirmationDT))
                {
                    var dt = model.ConfirmationDT.Split("/");
                    if (dt?.Count() >= 3)
                    {
                        DateTime fromDT = new DateTime(Convert.ToInt32(dt[2]), Convert.ToInt32(dt[1]), Convert.ToInt32(dt[0]));
                        objGoAheadSetReq.mGoAhead.ConfirmationDeadline = fromDT;
                    }
                    else
                    {
                        objGoAheadSetReq.mGoAhead.ConfirmationDeadline = null;
                    }
                }
                objGoAheadSetReq.mGoAhead.QRFPriceId = model.QRFPriceId;
                objGoAheadSetReq.mGoAhead.VersionId  = model.VersionId;
                objGoAheadSetReq.UserEmail           = userEmail;
                objGoAheadSetReq.VoyagerUserId       = voyagerUserId;

                objGoAheadSetRes = handoverProviders.SetGoAhead(objGoAheadSetReq, token).Result;
                objGoAheadSetRes = objGoAheadSetRes != null ? objGoAheadSetRes : new GoAheadSetRes();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(objGoAheadSetRes);
        }