public static Response Send(IdentityTaskData IdentityTaskData)
        {
            Response status;

            IdentityTaskData = AmazonDynamoDBTaskTable.Instance.ConvertToLowerCase(IdentityTaskData);
            status           = AmazonDynamoDBTaskTable.Instance.SaveDataInDynamoDb(IdentityTaskData);
            return(status);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            getTaskName = Request.QueryString["taskname"];
            Response response = AmazonDynamoDBIdentityTable.Instance.GetAllDataInDynamoDb();
            List <IdentityDataModel> Identities = response.IdentityDataModel;

            if (null != Identities)
            {
                foreach (IdentityDataModel Identity in Identities)
                {
                    IdentityDataModel identity = Identity;
                    identity = AmazonDynamoDBIdentityTable.Instance.ConvertToTitleCase(identity);
                    var tr = new HtmlTableRow();
                    tr.ID = identity.Email;
                    HtmlTableCell      checkbox = new HtmlTableCell();
                    HtmlGenericControl element  = new HtmlGenericControl("input");
                    element.Attributes.Add("type", "checkbox");
                    element.Attributes.Add("name", "chkbox[]");
                    element.Attributes.Add("runat", "server");
                    element.Attributes.Add("id", identity.Email + "checkbox");
                    element.Attributes.Add("onchange", "checkAll(this,'" + identity.Email + "')");
                    checkbox.Controls.Add(element);
                    checkbox.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(checkbox);


                    HtmlTableCell name = new HtmlTableCell();
                    name.InnerText = identity.FirstName + " " + identity.LastName;
                    name.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(name);
                    HtmlTableCell email = new HtmlTableCell();
                    email.InnerText = identity.Email;
                    email.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(email);
                    HtmlTableCell country = new HtmlTableCell();
                    country.InnerText = identity.CountryOfResidence;
                    country.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(country);
                    HtmlTableCell assignedGame = new HtmlTableCell();
                    assignedGame.InnerText = "";
                    assignedGame.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(assignedGame);

                    HtmlAnchor _edit = new HtmlAnchor();
                    _edit.HRef = "#";
                    _edit.Attributes.CssStyle.Add("margin-left", "0px");
                    HtmlImage editimage = new HtmlImage();
                    editimage.Attributes.Add("src", "../Images/edit.png");
                    editimage.Attributes.CssStyle.Add("width", "15px");
                    _edit.Controls.Add(editimage);
                    _edit.Attributes.Add("onclick", "editCustomTaskValue('" + email.InnerText + "')");
                    _edit.Attributes.Add("id", "edit" + email.InnerText);
                    HtmlAnchor _delete = new HtmlAnchor();
                    _delete.HRef = "#";
                    _delete.Attributes.CssStyle.Add("margin-left", "30%");
                    HtmlImage deleteimage = new HtmlImage();
                    deleteimage.Attributes.Add("src", "../Images/delete.png");
                    deleteimage.Attributes.CssStyle.Add("width", "30px");
                    _delete.Attributes.Add("onclick", "deleteCustomTaskValue('" + email.InnerText + "')");
                    _delete.Attributes.Add("id", "delete" + email.InnerText);
                    _delete.Controls.Add(deleteimage);
                    HtmlTableCell actioncell = new HtmlTableCell();
                    actioncell.Controls.Add(_edit);
                    actioncell.Controls.Add(_delete);
                    actioncell.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(actioncell);

                    taskIdentities.Rows.Add(tr);
                    foreach (WebsiteDataModel website in identity.WebsiteDataModel)
                    {
                        var item = selectwebsite.Items.FindByText(website.WebsiteName);
                        if (null == item)
                        {
                            selectwebsite.Items.Add(website.WebsiteName);
                        }
                    }
                }

                if (null != getTaskName)
                {
                    response = AmazonDynamoDBTaskTable.Instance.GetDataInDynamoDb(getTaskName.ToLower());
                    if (null != (response.IdentityTaskData))
                    {
                        identityTaskData = response.IdentityTaskData.FirstOrDefault();
                        identityTaskData = AmazonDynamoDBTaskTable.Instance.ConvertToTitleCase(identityTaskData);
                        //find identity from azure table and render content in fields.
                        ListItem selectedtask = selecttask.Items.FindByText(identityTaskData.SelectTask);
                        selectedtask.Selected = true;
                        task_name.Value       = identityTaskData.TaskName;
                        section.Value         = identityTaskData.Section;
                        wageramount.Value     = identityTaskData.WagerAmount;
                        balancetarget.Value   = identityTaskData.BalanceTarget;
                        balancelimit.Value    = identityTaskData.BalanceLimit;
                        stoploss.Value        = identityTaskData.StopLoss;
                        ListItem Selectedwebsite = selectwebsite.Items.FindByText(identityTaskData.TaskWebsite);
                        if (null == Selectedwebsite)
                        {
                            selectwebsite.Items.Add(identityTaskData.TaskWebsite);
                            Selectedwebsite = selectwebsite.Items.FindByText(identityTaskData.TaskWebsite);
                        }

                        Selectedwebsite.Selected = true;
                        ListItem selectedBrowser = selectbrowser.Items.FindByText(identityTaskData.SelectBrowser);
                        selectedBrowser.Selected = true;
                        ListItem selectedMode = selectmode.Items.FindByText(identityTaskData.SelectMode);
                        selectedMode.Selected = true;
                        ListItem selectedBetSizeOption = betsizeoption.Items.FindByText(identityTaskData.BetSizeOption);
                        selectedBetSizeOption.Selected = true;
                        betsize.Value    = identityTaskData.BetSize;
                        maxbetsize.Value = identityTaskData.MaxBetSize;
                        List <string> selectedIdentities = new List <string>();
                        int           i = 0;
                        for (var j = 1; j < taskIdentities.Rows.Count; j++)
                        {
                            foreach (var identityEmail in identityTaskData.SelectedIdentities)
                            {
                                var row = taskIdentities.Rows[j];
                                if (row.ID == identityEmail)
                                {
                                    var htmlcontrol = row.Cells[0];
                                    //foreach ( HtmlTableCell item in row.Cells )
                                    //    {
                                    HtmlControl object1 = (HtmlControl)row.Cells[0].Controls[0];
                                    if (null != object1)
                                    {
                                        object1.Attributes.Add("checked", "checked");
                                        if (!(selectedIdentities.Contains(identityEmail)))
                                        {
                                            selectedIdentities.Add(identityEmail);
                                            i++;
                                            break;
                                        }
                                    }
                                    //}
                                }
                            }    //foreach 2nd
                        }
                        foreach (var identity in identityTaskData.SelectedGames)
                        {
                            if (identity != null && !(gamesContainer.InnerHtml.Contains(identity)))
                            {
                                gamesContainer.InnerHtml          += identity;
                                gamesContainer.InnerHtml          += "<br />";
                                gamesContainer.Style["visibility"] = "visible";
                            }
                        }
                        hiddenselectedIdentities.Value = string.Join(",", identityTaskData.SelectedIdentities);
                        hiddenselectedGames.Value      = string.Join(",", identityTaskData.SelectedGames);
                    }
                    Count = Identities.Count;

                    //taskcount.InnerText = (response.IdentityTaskData.Count).ToString();
                }
                countDiv.InnerText = DashBoard.Count.ToString();
            }
        }
        private void GenerateHTML(Response response)
        {
            List <IdentityTaskData> Identities = response.IdentityTaskData;

            if (null != Identities)
            {
                int tasknumber = 0;
                foreach (IdentityTaskData Identity in Identities)
                {
                    IdentityTaskData identity = AmazonDynamoDBTaskTable.Instance.ConvertToTitleCase(Identity);
                    var tr = new HtmlTableRow();
                    tr.ID = identity.TaskName;
                    tasknumber++;
                    HtmlTableCell taskNumber = new HtmlTableCell();
                    taskNumber.InnerText = tasknumber.ToString();
                    taskNumber.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(taskNumber);
                    HtmlTableCell taskname = new HtmlTableCell();
                    taskname.InnerText = identity.TaskName;
                    taskname.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(taskname);
                    HtmlTableCell selectedtask = new HtmlTableCell();
                    selectedtask.InnerText = identity.SelectTask;
                    selectedtask.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(selectedtask);
                    HtmlTableCell taskwebsite = new HtmlTableCell();
                    taskwebsite.InnerText = identity.TaskWebsite;
                    taskwebsite.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(taskwebsite);
                    HtmlTableCell taskidentities = new HtmlTableCell();
                    taskidentities.InnerText = identity.SelectedIdentities.Count.ToString();
                    taskidentities.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(taskidentities);
                    HtmlTableCell cycletime = new HtmlTableCell();
                    cycletime.InnerText = "time";
                    cycletime.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(cycletime);
                    HtmlTableCell finishedcycle = new HtmlTableCell();
                    finishedcycle.InnerText = "time";
                    finishedcycle.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(finishedcycle);
                    HtmlTableCell status = new HtmlTableCell();
                    status.InnerText = "Active";
                    status.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(status);

                    HtmlAnchor _edit = new HtmlAnchor();
                    _edit.HRef = "/AddTask.aspx?taskname=" + identity.TaskName;
                    _edit.Attributes.CssStyle.Add("margin-left", "5px");
                    HtmlImage editimage = new HtmlImage();
                    editimage.Attributes.Add("src", "../Images/edit.png");
                    editimage.Attributes.CssStyle.Add("width", "20px");
                    _edit.Controls.Add(editimage);
                    _edit.Attributes.Add("id", "edit" + identity.TaskName);
                    HtmlAnchor _delete = new HtmlAnchor();
                    _delete.HRef = "#";
                    _delete.Attributes.CssStyle.Add("margin-left", "10%");
                    HtmlImage deleteimage = new HtmlImage();
                    deleteimage.Attributes.Add("src", "../Images/delete.png");
                    deleteimage.Attributes.CssStyle.Add("width", "40px");
                    _delete.Attributes.Add("onclick", "deleteTask('" + identity.TaskName + "')");
                    _delete.Attributes.Add("id", "delete" + identity.TaskName);
                    _delete.Controls.Add(deleteimage);

                    HtmlGenericControl toggleButton = new HtmlGenericControl("input");
                    toggleButton.Attributes.Add("type", "button");
                    toggleButton.Attributes.Add("class", "btn btn-click");
                    toggleButton.Attributes.Add("value", "Continue");
                    toggleButton.Attributes.CssStyle.Add("width", "auto");
                    toggleButton.Attributes.CssStyle.Add("background-color", "#61d461");
                    toggleButton.Attributes.CssStyle.Add("color", "#ffffff");
                    toggleButton.Attributes.CssStyle.Add(" margin-left", "10px");
                    toggleButton.Attributes.Add("onclick", "SetTask('" + identity.TaskName + "','" + identity.Email + "')");
                    toggleButton.Attributes.Add("id", "toggle" + identity.TaskName);

                    HtmlGenericControl stopButton = new HtmlGenericControl("input");
                    stopButton.Attributes.Add("type", "button");
                    stopButton.Attributes.Add("class", "btn btn-click");
                    stopButton.Attributes.Add("value", "Stop");
                    stopButton.Attributes.CssStyle.Add("width", "auto");
                    stopButton.Attributes.CssStyle.Add("background-color", "#f74444");
                    stopButton.Attributes.CssStyle.Add("color", "#ffffff");
                    stopButton.Attributes.CssStyle.Add(" margin-left", "20px");
                    stopButton.Attributes.Add("onclick", "StopTask('" + identity.TaskName + "','" + identity.Email + "')");
                    stopButton.Attributes.Add("id", "stop" + identity.TaskName);


                    HtmlTableCell actioncell = new HtmlTableCell();
                    actioncell.Controls.Add(_edit);
                    actioncell.Controls.Add(_delete);
                    actioncell.Controls.Add(toggleButton);
                    actioncell.Controls.Add(stopButton);
                    actioncell.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(actioncell);

                    taskSchedule.Rows.Add(tr);
                }
                Count = Identities.Count;
                //taskcount.InnerText = (Identities.Count).ToString();
                countDiv.InnerText = DashBoard.Count.ToString();
            }
        }