protected bool ConfirmObjectAction(string tag, string objectName, ref bool flagValue)
        {
            ConfirmationData data = ConfirmObjectAction(tag, objectName);

            flagValue = data.FlagValue;
            return(data.ConfirmationResult);
        }
        public object DeleteConfirmation(DeleteConfirmationViewModel deleteConfirmationViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, new BaseResponse(ResponseStatus.ValidationError.ToString(), ModelState.Values.ToList()[0].Errors[0].ErrorMessage)));
            }

            CurrentUserInfo currentUserInfo = _tokenHelper.GetUserInfo();

            if (!_projectLogic.IsProjectExist(currentUserInfo.Id, deleteConfirmationViewModel.ProjectId))
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, new BaseResponse(ResponseStatus.Notfound.ToString(), ResponseMessagesModel.ProjectNotFound)));
            }

            //TODO: check if in this day there is any report!!!!

            if (!_confirmationLogic.IsReportConfirmedBy(deleteConfirmationViewModel.ProjectId, currentUserInfo.Id, deleteConfirmationViewModel.ReportDate))
            {
                return(Request.CreateResponse(HttpStatusCode.Conflict, new BaseResponse(ResponseStatus.ValidationError.ToString(), ResponseMessagesModel.ConfirmationNotFound)));
            }

            ConfirmationData confirmationData =
                DeleteConfirmationViewModel.GetConfirmationData(currentUserInfo.Id, deleteConfirmationViewModel);

            _confirmationLogic.Delete(confirmationData);

            return(Request.CreateResponse(HttpStatusCode.OK, new BaseResponse(ResponseStatus.Success.ToString(), ResponseMessagesModel.Success)));
        }
示例#3
0
        public void Add(ConfirmationData confirmationData)
        {
            _unitOfWork.BeginTransaction();

            _confirmationRepository.Create(confirmationData);

            _unitOfWork.Commit();
        }
示例#4
0
        public void Delete(ConfirmationData confirmationData)
        {
            ConfirmationData currentconfirmationData = _confirmationRepository.GetAll()
                                                       .First(c => c.ProjectData.Id == confirmationData.ProjectData.Id &&
                                                              c.ConfirmedBy.Id == confirmationData.ConfirmedBy.Id &&
                                                              c.ReportDate.Date == confirmationData.ReportDate.Date);

            _confirmationRepository.Delete(currentconfirmationData.Id);
        }
示例#5
0
        //pass user recpeient and user sender, get info from those
        public ActionResult Confirmation(string recepientid, string badgeid, string comment)
        {
            Badge newBadge = new Badge();
            //get our recepient
            int  recepientID = Int32.Parse(recepientid);
            User Recepient   = new Models.User();

            Recepient = Db.Db.GetUser(recepientID);

            //get our sender
            //access the user who is logged in
            User sender = new User();

            sender = LoginController.GetSessionUser();



            //create a new gift to add to the DB
            int      convertBadgeID = Int32.Parse(badgeid);
            Gift     newGift        = new Gift();
            DateTime?GiftTime       = DateTime.Now;             //get the current date

            newGift.GiftDate    = GiftTime;
            newGift.BadgeId     = convertBadgeID;
            newGift.SenderId    = sender.UserId;
            newGift.RecipientId = Recepient.UserId;
            newGift.Comment     = comment;

            try
            {
                Point location = GetNewBadgeLocation(Recepient);
                newGift.TreeLocX = location.X;
                newGift.TreeLocY = location.Y;
            }
            catch (Exception e)
            {
                // ignore for now
            }

            Db.Db.CreateGift(newGift);         //add gift to db

            //create a confdata model for the view
            ConfirmationData confdata = new ConfirmationData();

            confdata.name    = Recepient.FirstName + " " + Recepient.LastName;
            newBadge         = Db.Db.GetBadge(convertBadgeID);
            confdata.badge   = newBadge.Name;
            confdata.comment = comment;
            // confdata.username = sender. + " " + sender.lastname;

            //Do query to get the email connected to the name
            EmailManager.SendTextEmail(comment, "YOU RECIEVED A BADGE", Recepient.Email, "GSTBADGESYSTEM", "noreply", response => { });
            return(View(confdata));
        }
        protected ConfirmationData ConfirmObjectAction(string tag, string objectName)
        {
            try
            {
                _fileTaskWaitEvent.Set();
                TaskbarThumbnailManager.Instance.SetProgressStatus(TaskbarProgressBarStatus.Paused);

                ConfirmationData retVal = new ConfirmationData();

                MainThread.Send(delegate(object x)
                {
                    DialogResult dr = DialogResult.Abort;

                    if (_task.ObjectsCount == 1)
                    {
                        dr = MessageDisplay.Query(
                            Translator.Translate(tag, objectName), "TXT_CONFIRM");
                    }
                    else
                    {
                        dr = MessageDisplay.QueryWithCancelAndAbort(
                            Translator.Translate(tag, objectName),
                            "TXT_CONFIRM", (_task.ObjectsCount > 1));
                    }

                    switch (dr)
                    {
                    case DialogResult.Abort:
                        CanContinue = false;
                        break;

                    case DialogResult.No:
                        retVal.ConfirmationResult = false;
                        break;

                    case DialogResult.Yes:
                        retVal.ConfirmationResult = true;
                        break;

                    case DialogResult.OK:     // YES ALL
                        retVal.ConfirmationResult = true;
                        retVal.FlagValue          = true;
                        break;
                    }
                });

                return(retVal);
            }
            finally
            {
                _fileTaskWaitEvent.Reset();
                TaskbarThumbnailManager.Instance.SetProgressStatus(TaskbarProgressBarStatus.Normal);
            }
        }
示例#7
0
        public ActionResult Yes(ConfirmationActionViewModel model)
        {
            if (!model.HttpPost)
            {
                return(Redirect(model.YesUrl));
            }

            ConfirmationData data = ConfirmationService.GetData(model.Id);

            RouteData route = RoutesHelper.GetRouteDataByUrl("/" + model.YesUrl);

            //var controllerDescriptor = new ReflectedControllerDescriptor(GetType());
            string controllerName = (String)route.Values["controller"];
            string actionName     = (String)route.Values["action"];
            //string values = RouteData.GetRequiredString("id");

            //IControllerActivator
            DefaultControllerFactory d = new DefaultControllerFactory();

            IController controller = d.CreateController(HttpContext.Request.RequestContext, controllerName);

            ControllerDescriptor controllerDescriptor = new ReflectedControllerDescriptor(controller.GetType());
            //d.ReleaseController(controller);

            ActionDescriptor actionDescriptor = controllerDescriptor.FindAction(ControllerContext, actionName);

            RequestContext requestContext = new RequestContext(new RoutesHelper.RewritedHttpContextBase("/" + model.YesUrl), route);

            requestContext.HttpContext.Request.Form.Add((NameValueCollection)data.PostData);

            ControllerContext            ctx         = new ControllerContext(requestContext, (ControllerBase)controller);
            IDictionary <string, object> parameters2 = GetParameterValues(ctx, actionDescriptor);
            IDictionary <string, object> parameters  = new Dictionary <string, object>();

            ControllerContext.HttpContext.Response.Clear();
            NameValueCollection nameValueCollection = data.PostData as NameValueCollection;

            //nameValueCollection.
            actionDescriptor.Execute(ControllerContext, (IDictionary <string, object>)data.PostData);

            //var viewResult = new ViewResult
            //{
            //    ViewName = "",
            //    MasterName = "",
            //    ViewData = new ViewDataDictionary(data.PostData),
            //    TempData = null
            //};

            //return viewResult;
            return(new EmptyResult());
        }
示例#8
0
        public ActionResult Action(Guid id, object[] args)
        {
            ConfirmationData data = ConfirmationService.GetData(id);

            ConfirmationService.SetPostData(id, Request.Form);

            ConfirmationActionViewModel model = new ConfirmationActionViewModel
            {
                Id       = id,
                Message  = data.Message,
                NoUrl    = Request.UrlReferrer.PathAndQuery,
                YesUrl   = data.ActionUrl,
                HttpPost = true
            };

            return(View(model));
        }
    private void SendConfirmation(TCPMessageType tcpMessageType, string targetId, string value1, bool enableDisconnected)
    {
        global::Debug.LogFormat("[SendConfirmation] tcpMessageType:{0}, MyPlayerUserId:{1}, targetId:{2}", new object[]
        {
            tcpMessageType,
            ClassSingleton <MultiBattleData> .Instance.MyPlayerUserId,
            targetId
        });
        ConfirmationData message = new ConfirmationData
        {
            playerUserId   = ClassSingleton <MultiBattleData> .Instance.MyPlayerUserId,
            hashValue      = Singleton <TCPUtil> .Instance.CreateHash(TCPMessageType.Confirmation, ClassSingleton <MultiBattleData> .Instance.MyPlayerUserId, TCPMessageType.None),
            tcpMessageType = tcpMessageType.ToInteger(),
            value1         = value1
        };

        AppCoroutine.Start(this.SendConfirm <ConfirmationData>(TCPMessageType.Confirmation, message, targetId, enableDisconnected), false);
    }
示例#10
0
    public void SendConfirmation(TCPMessageType tcpMessageType, string targetId, string myUserId, string tcpKey)
    {
        global::Debug.LogFormat("[SendConfirmation] tcpMessageType:{0}, MyPlayerUserId:{1}, targetId:{2}", new object[]
        {
            tcpMessageType,
            myUserId,
            targetId
        });
        ConfirmationData message = new ConfirmationData
        {
            playerUserId   = myUserId,
            hashValue      = this.CreateHash(TCPMessageType.Confirmation, myUserId, TCPMessageType.None),
            tcpMessageType = tcpMessageType.ToInteger()
        };

        this.SendMessageForTarget(TCPMessageType.Confirmation, message, new List <int>
        {
            targetId.ToInt32()
        }, tcpKey);
    }
        public async Task <ActionResult> TotalCodeTenantConfirmEmail(ContentModel model)
        {
            var confirmModel = GetModel <ConfirmEmailModel>(CurrentPage);

            confirmModel.BackUrl = LoginSession.LoggedIn ? model.Content.Parent.Children.FirstOrDefault(x => x.ContentType.Alias.Equals("totalCodeAccountPage")).Url : confirmModel.Root.Url;

            if (Request.QueryString.Count == 0)
            {
                return(Redirect("/"));
            }
            //string domain = System.Net.WebUtility.UrlDecode(Request.Url.ToString());
            string id = Request.QueryString["a"], code = Request.QueryString["b"].Replace(" ", "+"), email = Request.QueryString["c"];
            var    tenantUid        = model.Content.Parent.GetProperty("tenantUid").GetValue().ToString();
            var    origin           = TenantHelper.GetCurrentTenantUrl(model);
            string domain           = helper.GetConfirmVerificationUrl(tenantUid, origin, email, Umbraco.CultureDictionary.Culture.TwoLetterISOLanguageName, id, code);
            var    confirmationData = new ConfirmationData
            {
                ClientId        = id,
                Code            = code,
                Email           = email,
                VerificationUrl = new Uri(domain).ToString()
            };

            var key           = ApiKeyCache.GetByTenantUid(tenantUid);
            var authorization = await new Authorization().GetAuthorizationAsync(key);
            var response      = (ConfirmEmailResponseContent)await verificationService.ConfirmEmailAsync(tenantUid, origin, confirmationData.Email, confirmationData.Code, confirmationData.VerificationUrl, authorization.AccessToken);


            confirmationData.IsConfirmed = response.Success;

            if (!response.Success)
            {
                // TODO: remove logging
                logger.Info <ConfirmEmailController>($"Verification Url: {confirmationData.VerificationUrl}");
                logger.Info <ConfirmEmailController>(JsonConvert.SerializeObject(response));
            }

            ViewData["ConfirmationData"] = confirmationData;

            return(Index(confirmModel));
        }
示例#12
0
    IEnumerator RightClickRemoveItem()
    {
        // whatever you're doing now with the temporary / placement preview building

        waitingOnConfirm = true;
        ConfirmationData ConfirmCheck = ConfirmationPopup.Current.GenerateConfirmPopup("Removing item: " + equipped.name + " ? ");

        while (ConfirmCheck.confirm == ConfirmResult.none)
        {
            yield return(null); // wait
        }
        if (ConfirmCheck.confirm == ConfirmResult.yes)
        {
            equipped.inventory.RemoveItem(equipped.equipmentType);
            SetDefault();
            waitingOnConfirm = false;
        }
        else if (ConfirmCheck.confirm == ConfirmResult.no)
        {
            waitingOnConfirm = false;
        }
    }
示例#13
0
        public ActionResult Action(Guid id)
        {
            ConfirmationData data = ConfirmationService.GetData(id);

            if (data.IsUsed)
            {
                return(Redirect(data.ReturnUrl));
            }

            string returnUrl = Request.UrlReferrer.PathAndQuery;

            ConfirmationService.SetReturnUrl(id, returnUrl);

            ConfirmationActionViewModel model = new ConfirmationActionViewModel
            {
                Id      = id,
                Message = data.Message,
                NoUrl   = returnUrl,
                YesUrl  = data.ActionUrl
            };

            return(View(model));
        }
    protected void RecieveConfirmation(TCPMessageType tcpMessageType, object messageObj)
    {
        global::Debug.Log("Confirmation: 受信");
        ConfirmationData confirmationData = TCPData <ConfirmationData> .Convert(messageObj);

        if (this.CheckRecieveData(confirmationData.playerUserId, confirmationData.hashValue))
        {
            return;
        }
        TCPMessageType tcpMessageType2 = (TCPMessageType)confirmationData.tcpMessageType;

        this.confirmationChecks[tcpMessageType2].Add(confirmationData.playerUserId);
        global::Debug.LogFormat("confirmationChecks : {0}から確認用{1}を受信しました. Count:{2}", new object[]
        {
            confirmationData.playerUserId,
            tcpMessageType2,
            this.confirmationChecks[tcpMessageType2].Count
        });
        if (tcpMessageType2 == TCPMessageType.AdventureScene && confirmationData.value1 == "1" && !this.adventureSceneEndList.Contains(confirmationData.playerUserId))
        {
            this.adventureSceneEndList.Add(confirmationData.playerUserId);
        }
    }
示例#15
0
    IEnumerator GoldTest()
    {
        // whatever you're doing now with the temporary / placement preview building
        waitingOnConfirm = true;
        ConfirmationData ConfirmCheck = ConfirmationPopup.Current.GenerateConfirmPopup("Gift 5 gold to the begger!");

        while (ConfirmCheck.confirm == ConfirmResult.none)
        {
            yield return(null); // wait
        }
        if (ConfirmCheck.confirm == ConfirmResult.yes)
        {
            PopupText.Instance.GenerateText("5 gold given to the beggar!");


            Destroy(gameObject);
        }
        else if (ConfirmCheck.confirm == ConfirmResult.no)
        {
            PopupText.Instance.GenerateText("5 gold added!");

            Destroy(gameObject);
        }
    }
示例#16
0
        protected ConfirmationData ConfirmObjectAction(string tag, string objectName)
        {
            ConfirmationData retVal = new ConfirmationData();

            MainThread.Send(delegate(object x)
            {
                DialogResult dr = DialogResult.Abort;

                if (_task.ObjectsCount == 1)
                {
                    dr = MessageDisplay.Query(
                    Translator.Translate(tag, objectName), "TXT_CONFIRM");
                }
                else
                {
                    dr = MessageDisplay.QueryWithCancelAndAbort(
                    Translator.Translate(tag, objectName),
                    "TXT_CONFIRM", (_task.ObjectsCount > 1));
                }

                switch (dr)
                {
                    case DialogResult.Abort:
                        CanContinue = false;
                        break;

                    case DialogResult.No:
                        retVal.ConfirmationResult = false;
                        break;

                    case DialogResult.Yes:
                        retVal.ConfirmationResult = true;
                        break;

                    case DialogResult.OK: // YES ALL
                        retVal.ConfirmationResult = true;
                        retVal.FlagValue = true;
                        break;
                }
            });

            return retVal;
        }
示例#17
0
        public static void ClientConfirmPlayer(Player confirmPlayer, PlayerCorpse playerCorpse, string jsonData, bool covert = false)
        {
            ConfirmationData data = PlayerCorpse.GetDezerializedData(jsonData);

            if (data == null)
            {
                return;
            }

            Player deadPlayer = data.Player;

            if (deadPlayer.IsValid())
            {
                deadPlayer.SetRole(Utils.GetObjectByType <Role>(Utils.GetTypeByLibraryName <Role>(data.RoleName)), TeamFunctions.GetTeam(data.TeamName));

                if (!covert)
                {
                    deadPlayer.IsConfirmed     = true;
                    deadPlayer.CorpseConfirmer = confirmPlayer;
                }
            }

            if (playerCorpse.IsValid())
            {
                playerCorpse.DeadPlayer = deadPlayer;
                playerCorpse.Data       = data;

                InspectMenu.Instance.SetPlayerData(playerCorpse);
            }

            if (deadPlayer.IsValid())
            {
                Scoreboard.Instance.UpdateClient(deadPlayer.Client);
            }

            if (!confirmPlayer.IsValid())
            {
                return;
            }

            Client confirmClient = confirmPlayer.Client;

            // TODO improve
            if (deadPlayer.IsValid())
            {
                InfoFeed.Current?.AddEntry(
                    confirmClient,
                    deadPlayer.Client,
                    "found the body of",
                    $"({deadPlayer.Role.Name})"
                    );
            }
            else
            {
                InfoFeed.Current?.AddEntry(
                    confirmClient,
                    $"found the body of {data.Name}!"
                    );
            }

            if (confirmPlayer == Local.Pawn as Player && data.Credits > 0)
            {
                InfoFeed.Current?.AddEntry(
                    confirmClient,
                    $"found $ {data.Credits} credits!"
                    );
            }
        }