Beispiel #1
0
        public static Response Send(IdentityDataModel IdentityData)
        {
            Response status;

            IdentityData             = AmazonDynamoDBIdentityTable.Instance.SetEmptyValuestoNull(IdentityData);
            IdentityData             = AmazonDynamoDBIdentityTable.Instance.ConvertToLowerCase(IdentityData);
            IdentityData.CurrentDate = System.DateTime.Now.Date.ToString("dd.MM.yyy");
            IdentityData.Name        = IdentityData.FirstName + " " + IdentityData.LastName;
            string json = JsonConvert.SerializeObject(IdentityData);

            if (null == getEmail)
            {
                status = AmazonDynamoDBIdentityTable.Instance.SaveDataInDynamoDb(json, IdentityData);
            }
            else
            {
                status = AmazonDynamoDBIdentityTable.Instance.UpdateDataInDynamoDb(json, IdentityData);
            }
            if (null != IdentityData.Affiliate)
            {
                Response affiliateResponse = AmazonDynamoDBAffiliateTable.Instance.GetDataInDynamoDb(IdentityData.Affiliate);
                AmazonDynamoDBAffiliateTable.Instance.UpdateDataInDynamoDb(affiliateResponse.AffiliateDataModel.FirstOrDefault(), IdentityData.Email);
            }
            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(List <PositionData> Positions, List <IdentityDataModel> Identity)
        {
            if (null != Positions)
            {
                int srno = 0;
                foreach (IdentityDataModel identity in Identity)
                {
                    IdentityDataModel m_Identity = AmazonDynamoDBIdentityTable.Instance.ConvertToTitleCase(identity);
                    var tr = new HtmlTableRow();
                    tr.ID = m_Identity.Email;
                    srno++;
                    HtmlTableCell taskNumber = new HtmlTableCell();
                    taskNumber.InnerText = srno.ToString();
                    taskNumber.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(taskNumber);
                    HtmlTableCell country = new HtmlTableCell();
                    country.InnerText = m_Identity.CountryOfResidence;
                    country.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(country);
                    HtmlTableCell affiliate = new HtmlTableCell();
                    affiliate.InnerText = identity.Affiliate;
                    affiliate.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(affiliate);
                    HtmlTableCell email = new HtmlTableCell();
                    email.InnerText = m_Identity.Email;
                    email.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(email);
                    HtmlTableCell totalplv = new HtmlTableCell();
                    totalplv.InnerText = m_Identity.TotalPLV;
                    totalplv.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(totalplv);

                    plv.Rows.Add(tr);
                }
                int positionnumber = 0;
                foreach (PositionData position in Positions)
                {
                    PositionData m_position = AmazonDynamoDBPositionTable.Instance.ConvertToTitleCase(position);
                    var          tr         = new HtmlTableRow();
                    tr.ID = m_position.PositionLabel;
                    positionnumber++;
                    HtmlTableCell serialno = new HtmlTableCell();
                    serialno.InnerText = positionnumber.ToString();
                    serialno.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(serialno);
                    HtmlTableCell website = new HtmlTableCell();
                    website.InnerText = m_position.PositionWebsite;
                    website.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(website);
                    HtmlTableCell totalPLV = new HtmlTableCell();
                    totalPLV.InnerText = m_position.TotalPLV;
                    totalPLV.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(totalPLV);
                    int count = 0;
                    foreach (var websiteposition in Positions)
                    {
                        if (websiteposition.PositionWebsite.ToLower().Equals(position.PositionWebsite.ToLower()))
                        {
                            count++;
                        }
                    }
                    HtmlTableCell positions = new HtmlTableCell();
                    positions.InnerText = count.ToString();
                    positions.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(positions);

                    plvposition.Rows.Add(tr);
                }

                //taskcount.InnerText = (Identities.Count).ToString();
                countDiv.InnerText = DashBoard.Count.ToString();
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            getEmail = Request.QueryString["email"];
            Response responseaffiliate = AmazonDynamoDBAffiliateTable.Instance.GetAllDataInDynamoDb();
            List <AffiliateDataModel> affiliateList = responseaffiliate.AffiliateDataModel;

            foreach (AffiliateDataModel affiliate in affiliateList)
            {
                selectaffiliate.Items.Add(affiliate.Name);
            }
            if (null != getEmail)
            {
                Response response = AmazonDynamoDBIdentityTable.Instance.GetDataInDynamoDb(getEmail.ToLower());
                identity = response.IdentityDataModel.FirstOrDefault();
                identity = AmazonDynamoDBIdentityTable.Instance.ConvertToTitleCase(identity);
                //find identity from azure table and render content in fields.
                ListItem selectedtitle = title.Items.FindByText(identity.Title);
                selectedtitle.Selected = true;
                first_name.Value       = identity.FirstName;
                middlename.Value       = identity.MiddleName;
                last_name.Value        = identity.LastName;
                setstatus.InnerText    = identity.Status;
                if (null != identity.Status && identity.Status.ToLower().Equals("active"))
                {
                    setstatus.Style.Add("background-color", "#00a65a");
                }
                if (null != identity.Status && identity.Status.ToLower().Equals("onhold"))
                {
                    setstatus.Style.Add("background-color", "#dfdf3afc");
                }
                uname.Value           = identity.UserName;
                email.Value           = identity.Email;
                phone.Value           = identity.Phone;
                address.Value         = identity.Address;
                selectaffiliate.Value = identity.Affiliate;
                dateob.Value          = identity.DateOfBirth;
                ListItem Selectedcountry = country.Items.FindByText(identity.CountryOfResidence);
                Selectedcountry.Selected = true;
                zip.Value   = identity.ZipCode;
                city.Value  = identity.City;
                state.Value = identity.State;
                ListItem Selectedlanguage = language.Items.FindByText(identity.Language);
                Selectedlanguage.Selected = true;
                ListItem Selectedcurrency = currency.Items.FindByText(identity.Currency);
                Selectedcurrency.Selected = true;
                female.Checked            = true;
                birthcountry.Value        = identity.CountryOfBirth;

                List <WebsiteDataModel> websitelist = identity.WebsiteDataModel;
                if (websitelist != null && websitelist.Count > 0)
                {
                    foreach (WebsiteDataModel website in websitelist)
                    {
                        websiteContainer.Attributes.CssStyle.Add("Visibility", "visible");
                        var websitearray = "{ WebsiteLabel:" + website.WebsiteLabel + ", WebsiteName:" + website.WebsiteName + ", UserName: "******",  UserPassword: "******"," +
                                           "WebsiteAccountNumber: " + website.WebsiteAccountNumber + ", PIN:  " + website.PIN + ", SecurityQuestion: " + website.SecurityQuestion + "," +
                                           "SecurityAnswer: " + website.SecurityAnswer + "}";

                        websiteContainer.InnerHtml += "<div id=\"" + website.UserName + "\" style=\"border:solid;Background-color:white;height:auto;word-wrap: break-word;\">" +
                                                      "<div><button class=\"btn btn-default\" type=\"button\" onclick=\"EditWebsite('" + website.UserName + "','" + identity.Email.ToLower() + "')\" style=\"margin-left: 75%;display:inline;\" ><span class=\"glyphicon glyphicon-edit\"></span></button><button class=\"btn btn-default\" type=\"button\" onclick=\"DeleteWebsite('" + website.UserName + "','" + identity.Email.ToLower() + "')\" style=\"display:inline;\"><span class=\"glyphicon glyphicon-trash\"></span></button></div><br />" +
                                                      "<label class=\"labelText\" style=\"display:inline\">Website Label:</label>" +
                                                      "<p type=\"text\" class=\"AddWebsiteLabel\"  readonly=\"readonly\" style=\"border:none;background:none;display:inline\">" + website.WebsiteLabel + "</p><br />" +
                                                      "<label class=\"labelText\" style=\"display:inline\">Website:</label>" +
                                                      "<p type=\"text\" class=\"AddWebsiteName\"  readonly=\"readonly\" style=\"border:none;background:none;display:inline\">" + website.WebsiteName + "</p><br />" +
                                                      "<label class=\"labelText\" style=\"display:inline\">ID:</label>" +
                                                      "<p type=\"text\" class=\"Addusername\"   readonly=\"readonly\" style=\"border:none;background:none;display:inline\">" + website.UserName + "</p><br />" +
                                                      "<label class=\"labelText\" style=\"display:inline\">Password:</label>" +
                                                      "<p type=\"text\" class=\"AddPassword\"    readonly=\"readonly\" style=\"border:none;background:none;display:inline\">" + website.UserPassword + "</p><br />" +
                                                      "<label class=\"labelText\" style=\"display:inline\">Account Number:</label>" +
                                                      "<p type=\"text\" class=\"AddWebsiteAccountNumber\"   readonly=\"readonly\" style=\"border:none;background:none;display:inline\">" + website.WebsiteAccountNumber + "</p><br />" +
                                                      "<label class=\"labelText\" style=\"display:inline\">PIN:</label>" +
                                                      "<p type=\"text\" class=\"AddWebsitePIN\"   readonly=\"readonly\" style=\"border:none;background:none;display:inline\">" + website.PIN + "</p><br />" +
                                                      "<label class=\"labelText\" style=\"display:inline\">Security Question:</label>" +
                                                      "<p type=\"text\" class=\"AddWebsitequestion\"   readonly=\"readonly\" style=\"border:none;background:none;display:inline\">" + website.SecurityQuestion + "</p><br />" +
                                                      "<label class=\"labelText\" style=\"display:inline\">Security Answer:</label>" +
                                                      "<p type=\"text\" class=\"AddWebsiteAnswer\"   readonly=\"readonly\" style=\"border:none;background:none;display:inline\">" + website.SecurityAnswer + "</p><br />" +
                                                      "<label class=\"labelText\" style=\"display:inline\">Notes:</label>" +
                                                      "<p type=\"text\" class=\"AddNotes\"   readonly=\"readonly\" style=\"border:none;background:none;display:inline\">" + website.Notes + "</p><br />" +
                                                      "</div>";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "Javascript", "UpdateWebsiteList('" + websitearray + "');", true);
                    }
                }
            }
            countDiv.InnerText = DashBoard.Count.ToString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            getPositionLabel = Request.QueryString["positionlabel"];
            Response response = AmazonDynamoDBIdentityTable.Instance.GetAllDataInDynamoDb();
            List <IdentityDataModel> Identities = response.IdentityDataModel;
            int colunumber = 0;

            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 affiliate = new HtmlTableCell();
                    affiliate.InnerText = identity.Affiliate;
                    affiliate.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(affiliate);
                    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 total = new HtmlTableCell();
                    total.ID = "total" + colunumber;
                    total.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(total);

                    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);
                    colunumber++;
                }

                if (null != getPositionLabel)
                {
                    response = AmazonDynamoDBPositionTable.Instance.GetDataInDynamoDb(getPositionLabel.ToLower());
                    if (null != (response.PositionData))
                    {
                        identityPositionData = response.PositionData.FirstOrDefault();
                        identityPositionData = AmazonDynamoDBPositionTable.Instance.ConvertToTitleCase(identityPositionData);
                        //find identity from azure table and render content in fields.
                        runpositionlabel.InnerHtml     = identityPositionData.PositionLabel;
                        totalruntime.InnerHtml         = identityPositionData.TotalDateTime;
                        openpositiontime.InnerHtml     = identityPositionData.StartDate + " " + identityPositionData.StartTime;
                        startedpositiontime.InnerHtml  = identityPositionData.StartDate + " " + identityPositionData.StartTime;
                        intervalpositiontime.InnerHtml = identityPositionData.StartDate + " " + identityPositionData.StartTime;
                        positionidentities.InnerHtml   = (string)identityPositionData.SelectedIdentities.Count.ToString();
                        if (null != identityPositionData.Note)
                        {
                            notes.Value = identityPositionData.Note.ToString();
                        }
                        int tasknumber = 1;
                        foreach (var taskhistory in identityPositionData.TasksHistoryList)
                        {
                            var                tableRow    = new HtmlTableRow();
                            HtmlTableCell      tableCell   = new HtmlTableCell();
                            HtmlGenericControl tasklistdiv = new HtmlGenericControl("div");
                            tasklistdiv.InnerText = "Task" + tasknumber;
                            tasklistdiv.Style.Add("border", "solid");
                            tasklistdiv.Style.Add("Background-color", "white");
                            tasklistdiv.Style.Add("width", "auto");
                            tasklistdiv.Style.Add("height", "auto");
                            tasklistdiv.Style.Add("word-wrap", "break-word");
                            tasklistdiv.InnerText  = taskhistory;
                            tasklistdiv.InnerHtml += "<br/>";
                            tableCell.Controls.Add(tasklistdiv);
                            tableRow.Cells.Add(tableCell);
                            tasknumber += 1;
                            taskHistory.Rows.Add(tableRow);
                        }
                        if (null != identityPositionData.SelectTasks)
                        {
                            //HtmlGenericControl tasklistdiv = new HtmlGenericControl("div");
                            //tasklistdiv.InnerText= "Task" + tasknumber;
                            //tasklistdiv.Style.Add("border", "solid");
                            //tasklistdiv.Style.Add("Background-color", "white");
                            //tasklistdiv.Style.Add("width", "auto");
                            //tasklistdiv.Style.Add("height", "auto");
                            //tasklistdiv.Style.Add("word-wrap", "break-word");
                            //HtmlGenericControl innertasklistdiv = new HtmlGenericControl("div");
                            //innertasklistdiv.Style.Add("display", "inline");
                            //HtmlGenericControl deletebutton = new HtmlGenericControl("button");
                            //deletebutton.Attributes.Add("class", "btn btn-default");
                            //deletebutton.Attributes.Add("type", "button");
                            //deletebutton.Attributes.Add("onclick", "DeleteWebsite('tasklistdiv" + tasknumber + "')");
                            //deletebutton.Style.Add("display", "inline");
                            //deletebutton.Style.Add("float", "right");
                            //HtmlGenericControl deletebuttonspan = new HtmlGenericControl("span");
                            //deletebuttonspan.Attributes.Add("class", "glyphicon glyphicon-trash");
                            //deletebutton.Controls.Add(deletebuttonspan);
                            //innertasklistdiv.Controls.Add(deletebutton);
                            //tasklistdiv.Controls.Add(innertasklistdiv);
                            foreach (var tasksteps in identityPositionData.SelectTasks)
                            {
                                tasklist.InnerHtml += tasksteps;
                                tasklist.InnerHtml += "<br />";
                                //HtmlGenericControl tasklistParagragh = new HtmlGenericControl("p");
                                //tasklistParagragh.Attributes.Add("id", "tasklist" + "Task" + tasknumber + tasknumber);
                                //tasklistParagragh.Attributes.Add("readonly", "readonly");
                                //tasklistParagragh.Style.Add("border", "none");
                                //tasklistParagragh.Style.Add("background", "none");
                                //tasklistParagragh.Style.Add("display", "inline");
                                //tasklistParagragh.InnerText = tasksteps;
                                //tasklistParagragh.InnerHtml += "<br/>";
                                //tasklistdiv.Controls.Add(tasklistParagragh);
                            }
                            tasknumber += 1;
                            tasksteps.Style.Add("visibility", "visible");
                        }
                        List <string> selectedIdentities = new List <string>();
                        int           i = 0;
                        for (var j = 1; j < taskIdentities.Rows.Count; j++)
                        {
                            foreach (var identityEmail in identityPositionData.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
                        }
                    }
                }
                countDiv.InnerText = DashBoard.Count.ToString();
            }
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (null != Request.QueryString["positionlabel"])
            {
                getPositionName = (Request.QueryString["positionlabel"]).ToLower();
            }
            Response response = AmazonDynamoDBIdentityTable.Instance.GetAllDataInDynamoDb();
            List <IdentityDataModel> Identities = response.IdentityDataModel;
            int itemnmber = 0;

            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 affiliate = new HtmlTableCell();
                    affiliate.InnerText = identity.Affiliate;
                    affiliate.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(affiliate);
                    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.ID        = identity.CountryOfResidence + itemnmber;
                    country.InnerText = identity.CountryOfResidence;
                    country.Attributes.Add("class", "tablecolumn");
                    tr.Cells.Add(country);


                    //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);
                        }
                    }
                    itemnmber++;
                }

                if (null != getPositionName)
                {
                    response = AmazonDynamoDBPositionTable.Instance.GetDataInDynamoDb(getPositionName);
                    if (null != (response.PositionData))
                    {
                        positionData = response.PositionData.FirstOrDefault();
                        positionData = AmazonDynamoDBPositionTable.Instance.ConvertToTitleCase(positionData);
                        //find identity from azure table and render content in fields.
                        positionlabel.Value   = positionData.PositionLabel;
                        selectselection.Value = positionData.SelectSelection;
                        starttime.Value       = positionData.StartTime;
                        endtime.Value         = positionData.EndTime;
                        startdate.Value       = positionData.StartDate;
                        enddate.Value         = positionData.EndDate;
                        int tasknumber = 3;
                        for (int j = 0; j < positionData.SelectTasks.Count; j++)
                        {
                            if (null != positionData.SelectTasks[j] && j == 0)
                            {
                                step1.Value = positionData.SelectTasks[j];
                            }
                            if (null != positionData.SelectTasks[j] && j == 1)
                            {
                                step2.Value = positionData.SelectTasks[j];
                            }
                            if (null != positionData.SelectTasks[j] && j == 2)
                            {
                                step3.Value = positionData.SelectTasks[j];
                            }
                            if (j > 2)
                            {
                                tasknumber++;
                                HtmlTableRow  tRow = new HtmlTableRow();
                                HtmlTableCell tb1  = new HtmlTableCell();
                                tb1.InnerText = tasknumber.ToString() + ".";
                                tRow.Controls.Add(tb1);
                                HtmlTableCell      tb2          = new HtmlTableCell();
                                HtmlGenericControl inputelement = new HtmlGenericControl("input");
                                inputelement.Attributes.Add("type", "text");
                                inputelement.Attributes.Add("name", "step" + tasknumber);
                                inputelement.Attributes.Add("value", positionData.SelectTasks[j]);
                                inputelement.Attributes.Add("id", "step" + tasknumber);
                                inputelement.Style.Add("width", "80%");
                                inputelement.Style.Add("height", "10%");
                                tb2.Style.Add("width", "80%");
                                tb2.Style.Add("height", "10%");
                                tb2.Controls.Add(inputelement);
                                tRow.Controls.Add(tb2);
                                task.Rows.Add(tRow);
                            }
                        }
                        for (int j = 0; j < positionData.SelectCountries.Count; j++)
                        {
                            HtmlGenericControl iDiv = new HtmlGenericControl("div");
                            iDiv.Attributes.Add("id", positionData.SelectCountries[j]);
                            iDiv.Attributes.Add("class", "form-control");
                            iDiv.Attributes.CssStyle.Add("height", "auto");
                            iDiv.InnerHtml = positionData.SelectCountries[j] + "&nbsp<button class=\"glyphicon glyphicon-remove\" style=\"display:inline;background-color:white\" onclick=\"deleteCountry(\'" + positionData.SelectCountries[j] + "\')\" />";
                            addcountry.Controls.Add(iDiv);
                        }
                        notes.Value = positionData.Note.ToString();
                        ListItem Selectedwebsite = selectwebsite.Items.FindByText(positionData.PositionWebsite);
                        if (null == Selectedwebsite)
                        {
                            selectwebsite.Items.Add(positionData.PositionWebsite);
                            Selectedwebsite = selectwebsite.Items.FindByText(positionData.PositionWebsite);
                        }
                        Selectedwebsite.Selected = true;
                        List <string> selectedIdentities = new List <string>();
                        int           i = 0;
                        for (var j = 1; j < taskIdentities.Rows.Count; j++)
                        {
                            foreach (var positionEmail in positionData.SelectedIdentities)
                            {
                                var row = taskIdentities.Rows[j];
                                if (row.ID == positionEmail)
                                {
                                    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(positionEmail)))
                                        {
                                            selectedIdentities.Add(positionEmail);
                                            i++;
                                            break;
                                        }
                                    }
                                    //}
                                }
                            }    //foreach 2nd
                        }
                    }
                    Count = Identities.Count;
                }
                countDiv.InnerText = DashBoard.Count.ToString();
            }
        }
        private void CreateHTMLTable(List <IdentityDataModel> Identities)
        {
            Response response = AmazonDynamoDBTaskTable.Instance.GetAllDataInDynamoDb();
            List <IdentityTaskData> TaskIdentities = response.IdentityTaskData;
            int tasknumber = 0;

            foreach (IdentityDataModel Identity in Identities)
            {
                IdentityDataModel identity = Identity;
                identity = AmazonDynamoDBIdentityTable.Instance.ConvertToTitleCase(identity);
                var tr = new HtmlTableRow();
                tr.ID = identity.Email;
                tasknumber++;
                HtmlTableCell taskNumber = new HtmlTableCell();
                taskNumber.InnerText = tasknumber.ToString();
                taskNumber.Attributes.Add("class", "tablecolumn");
                tr.Cells.Add(taskNumber);
                HtmlTableCell currentDate = new HtmlTableCell();
                currentDate.InnerText = identity.CurrentDate;
                currentDate.Attributes.Add("class", "tablecolumn");
                tr.Cells.Add(currentDate);
                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 websiteCount = new HtmlTableCell();
                websiteCount.InnerText = identity.WebsiteDataModel.Count.ToString();
                websiteCount.Attributes.Add("class", "tablecolumn");
                tr.Cells.Add(websiteCount);

                HtmlTableCell country = new HtmlTableCell();
                country.InnerText = identity.CountryOfResidence;
                country.Attributes.Add("class", "tablecolumn");
                tr.Cells.Add(country);
                HtmlTableCell      status         = new HtmlTableCell();
                HtmlGenericControl identityStatus = new HtmlGenericControl("span");
                identityStatus.Attributes.Add("class", "label label-success");
                if (null != identity.Status && identity.Status.ToLower().Equals("active"))
                {
                    identityStatus.Attributes.CssStyle.Add("background-color", "#00a65a");
                }
                if (null != identity.Status && identity.Status.ToLower().Equals("onhold"))
                {
                    identityStatus.Attributes.CssStyle.Add("background-color", "#dfdf3afc");
                }
                identityStatus.InnerText = identity.Status;
                status.Controls.Add(identityStatus);
                status.Attributes.Add("class", "tablecolumn");
                //status.Attributes.CssStyle.Add("background-color", "#06d995");
                //status.Attributes.CssStyle.Add("color", "#ffffff");
                tr.Cells.Add(status);
                int taskCount = 0;
                if (null != TaskIdentities)
                {
                    foreach (IdentityTaskData taskIdentity in TaskIdentities)
                    {
                        foreach (string identityName in taskIdentity.SelectedIdentities)
                        {
                            if (identityName.ToLower().Equals(identity.Email))
                            {
                                taskCount++;
                            }
                        }
                    }
                }
                HtmlTableCell identityTask = new HtmlTableCell();
                identityTask.InnerText = taskCount.ToString();
                identityTask.Attributes.Add("class", "tablecolumn");
                tr.Cells.Add(identityTask);

                HtmlAnchor _edit = new HtmlAnchor();
                _edit.HRef = "/AddIdentity.aspx?email=" + email.InnerText;
                _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("id", "edit" + email.InnerText);
                HtmlAnchor _delete = new HtmlAnchor();
                _delete.HRef = "#";
                _delete.Attributes.CssStyle.Add("margin-left", "22px");
                HtmlImage deleteimage = new HtmlImage();
                deleteimage.Attributes.Add("src", "../Images/delete.png");
                deleteimage.Attributes.CssStyle.Add("width", "30px");
                _delete.Attributes.Add("onclick", "deleteIdentity('" + email.InnerText + "')");
                _delete.Attributes.Add("id", "delete" + email.InnerText);
                _delete.Controls.Add(deleteimage);

                HtmlGenericControl copyBasicData = new HtmlGenericControl("input");
                copyBasicData.Attributes.Add("type", "button");
                copyBasicData.Attributes.Add("class", "btn btn-click");
                copyBasicData.Attributes.Add("value", "Copy Data");
                copyBasicData.Attributes.CssStyle.Add("width", "auto");
                copyBasicData.Attributes.CssStyle.Add("background-color", "#06d995");
                copyBasicData.Attributes.CssStyle.Add("color", "#ffffff");
                copyBasicData.Attributes.CssStyle.Add(" margin-left", "10px");
                copyBasicData.Attributes.Add("onclick", "copyPersonalData('" + identity.Email + "')");
                copyBasicData.Attributes.Add("id", "taskSchedule" + identity.Email);

                HtmlGenericControl copyDataButton = new HtmlGenericControl("input");
                copyDataButton.Attributes.Add("type", "button");
                copyDataButton.Attributes.Add("class", "btn btn-click");
                copyDataButton.Attributes.Add("value", "Copy All");
                copyDataButton.Attributes.CssStyle.Add("width", "auto");
                copyDataButton.Attributes.CssStyle.Add("background-color", "#1565c0");
                copyDataButton.Attributes.CssStyle.Add("color", "#ffffff");
                copyDataButton.Attributes.CssStyle.Add(" margin-left", "10px");
                copyDataButton.Attributes.Add("onclick", "copyCompletePersonalData('" + identity.Email + "')");
                copyDataButton.Attributes.Add("id", "copyData" + identity.Email);

                HtmlGenericControl showTasksButton = new HtmlGenericControl("input");
                showTasksButton.Attributes.Add("type", "button");
                showTasksButton.Attributes.Add("class", "btn btn-click");
                showTasksButton.Attributes.Add("value", "Show Tasks");
                showTasksButton.Attributes.CssStyle.Add("width", "auto");
                showTasksButton.Attributes.CssStyle.Add("background-color", "#050500");
                showTasksButton.Attributes.CssStyle.Add("color", "#ffffff");
                showTasksButton.Attributes.CssStyle.Add(" margin-left", "10px");
                showTasksButton.Attributes.Add("onclick", "ShowTasks('" + identity.Email + "')");
                showTasksButton.Attributes.Add("id", "showTasks" + identity.Email);

                HtmlTableCell actioncell = new HtmlTableCell();
                actioncell.Controls.Add(_edit);
                actioncell.Controls.Add(_delete);
                actioncell.Controls.Add(copyBasicData);
                actioncell.Controls.Add(copyDataButton);
                actioncell.Controls.Add(showTasksButton);
                actioncell.Attributes.Add("class", "tablecolumn");
                tr.Cells.Add(actioncell);

                identities.Rows.Add(tr);
            }
        }