Esempio n. 1
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        if (!chk_rule.Checked)
        {
            chkerror.Visible = true;
            return;
        }
        if (Page.IsValid)
        {
            int ret = ContestHelper.addContestEmail(Server.HtmlEncode(firstname.Text), Server.HtmlEncode(lastname.Text), Server.HtmlEncode(email.Text), Server.HtmlEncode(phonenumber.Text));
            if (ret != 0)
            {
                string msg = String.Format("Dear Linda! <br>Someone has signed up in the contest \"{0} \"<br> Following is his information.<br>" +
                                           "Deatiled Info:<br>"
                                           + "UserName:{1} {2}<br> UserEmail:{3} <br> User Phone:{4} ", cont_info.Text, firstname.Text, lastname.Text, email.Text, phonenumber.Text);

                ContestHelper.SendEmail("*****@*****.**", "Notification:Someone has signed up in the Contest", msg);


                txt_result.Text    = "Thank you for your submission";
                txt_result.Visible = true;
                firstname.Text     = ""; lastname.Text = ""; email.Text = ""; phonenumber.Text = "";
            }
            else
            {
                txt_result.Text    = "There is high traffic in the server. Please retry later!";
                txt_result.Visible = true;
            }
        }
    }
Esempio n. 2
0
    protected void AdminSubmit_Click(object sender, EventArgs e)
    {
        string name = con_name.Text; string text = con_text.Text; string ruletext = Server.HtmlEncode(con_rule.Text.Replace(Environment.NewLine, "<br />"));
        int    price, validmonth;

        Int32.TryParse(con_price.Text, out price);
        Int32.TryParse(con_valdation.Text, out validmonth);
        DateTime dt;

        DateTime.TryParse(con_startdate.Text, out dt);
        ContestHelper.addContest(name, text, price, validmonth, ruletext, dt.ToString());
        // Response.Write(name+text+ price+ validmonth+ ruletext+ dt.ToString());
        cont_info = ContestHelper.getCotestInfo();
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        txt_result.Visible = false;
        chkerror.Visible   = false;

        cont_info = ContestHelper.getCotestInfo();
        if (!IsPostBack)
        {
            con_name.Text      = Server.HtmlDecode(cont_info.Name); con_text.Text = Server.HtmlDecode(cont_info.Text);
            con_price.Text     = cont_info.Price.ToString();
            con_rule.Text      = Server.HtmlDecode(cont_info.RuleText).Replace("<br />", Environment.NewLine);
            con_valdation.Text = cont_info.ValidMonth.ToString();
            DateTime dt = DateTime.Parse(cont_info.StartDate);
            con_startdate.Text = dt.ToString("yyyy/MM/dd");
        }
    }
        public IActionResult ContestDetail(string contestName)
        {
            ContestDetails contest = new ContestDetails();

            contest.flagNameOne  = HttpContext.Session.GetString("flagNameWithNameOne");
            contest.flagNameTwo  = HttpContext.Session.GetString("flagNameWithNameTwo");
            contest.startingTime = HttpContext.Session.GetString("StartingTime");

            ContestRequest play = new ContestRequest()
            {
                MatchId   = Convert.ToInt32(HttpContext.Session.GetString("MatchId")),
                TourId    = Convert.ToInt32(HttpContext.Session.GetString("tourId")),
                SectionId = ContestHelper.GetContestSection(contestName)
            };
            List <ContestDetailsResp> contestLst = _contestService.GetFullContestDetails(play);

            contest.ContestAdditionalLst = contestLst[0].AddonList;
            return(View(contest));
        }
Esempio n. 5
0
    public (OutcomeLevel outcome, float mod) RollDef(int roll, int target)
    {
        var mod     = 1.0f;
        var outcome = ContestHelper.Contest(roll, target);

        switch (outcome)
        {
        case OutcomeLevel.Critical:
            mod = 0.0f;
            break;

        case OutcomeLevel.Success:
            mod = 0.5f;
            break;

        case OutcomeLevel.Catastrophe:
            mod = 1.5f;
            break;
        }

        return(outcome, mod);
    }