/** * Create a new user **/ public bool CreateUser( User newuser ) { bool toReturn = false; using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connstring"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "INSERT INTO [dbo].[User] ( Name, ID, Email, Password ) VALUES (@Name,@User,@mail,@pass)"; cmd.Parameters.AddWithValue("@Name", newuser.GetName()); cmd.Parameters.AddWithValue("@User", newuser.GetUserName()); cmd.Parameters.AddWithValue("@mail", newuser.GetEmail()); cmd.Parameters.AddWithValue("@pass", newuser.GetPassword()); cmd.Connection = conn; conn.Open(); if (cmd.ExecuteNonQuery()!=0) { toReturn = true; } conn.Close(); } } return toReturn; }
public void UserTest() { User user = new User("NewName", "NewUserName", "NewEmail", "password"); Assert.AreEqual("NewName", user.GetName()); Assert.AreEqual("NewUserName", user.GetUserName()); Assert.AreEqual("NewEmail", user.GetEmail()); Assert.AreEqual("password", user.GetPassword()); }
public void CreateandDeleteUsersTest() { User newuser = new User("NewName", "NewUserName", "NewEmail", "password"); Users users = new Users(); Assert.IsTrue(users.CreateUser(newuser)); Assert.IsTrue(users.DeleteUser(newuser.GetUserName())); }
/** * Get all the information for a user **/ public User GetUser( string username ) { User user; using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connstring"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "SELECT Name, Email, Password FROM [dbo].[User] WHERE ID =@User"; cmd.Parameters.AddWithValue("@User", username); cmd.Connection = conn; conn.Open(); using (SqlDataReader Reader = cmd.ExecuteReader()) { Reader.Read(); user = new User(Reader.GetString(0).ToString(), username, Reader.GetString(1).ToString(), Reader.GetString(2).ToString()); } conn.Close(); } } return user; }
//CONSTRUCTOR public RoadMap( string name ) { mName = name; string UID; using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connstring"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "SELECT Timestamp, Description, UserID, color_dep_of, color_dep_on FROM [dbo].[Roadmap] WHERE Name =@Rname"; cmd.Parameters.AddWithValue("@Rname", name); cmd.Connection = conn; conn.Open(); using (SqlDataReader Reader = cmd.ExecuteReader()) { Reader.Read(); mTimeStamp = Reader.GetDateTime(0); mDescription = Reader.GetString(1); UID = Reader.GetString(2); try { mColor_of = Reader.GetString(3); mColor_on = Reader.GetString(4); } catch { mColor_of = "#ffff00"; mColor_on = "#ff66ff"; } } } using (SqlCommand cmd1 = new SqlCommand()) { cmd1.CommandText = "SELECT Name, Email, Password FROM [dbo].[User] WHERE ID = @User"; cmd1.Parameters.AddWithValue("@User", UID); cmd1.Connection = conn; using (SqlDataReader Reader = cmd1.ExecuteReader()) { Reader.Read(); mUser = new User(Reader.GetString(0), UID, Reader.GetString(1), Reader.GetString(2)); } } mTimeline = new TimeLine(mName); //Get the StrategyPoints using (SqlCommand cmd3 = new SqlCommand()) { cmd3.CommandText = "SELECT Name, Description FROM [dbo].[StrategyPoint] WHERE RoadmapName =@Rname ORDER BY SORT ASC"; cmd3.Parameters.AddWithValue("@Rname", mName); cmd3.Connection = conn; using (SqlDataReader Reader = cmd3.ExecuteReader()) { while (Reader.Read()) { StrategyPoint sp = new StrategyPoint(Reader.GetString(0), Reader.GetString(1), name); mStrategyPoints.Add(sp); } } } conn.Close(); } }
protected void Page_Load(object sender, EventArgs e) { mUser = new DB.User((string)Session["username"], (string)Session["password"]); name.InnerText = mUser.GetUserName() + "'s Roadmaps"; searchtable.Rows.Clear(); searchtable.Visible = false; createbutton.Enabled = false; //searchb.Enabled = true; if (Request.Form["username_ID"] != "" && Request.Form["password_ID"] != "") //FIX: Lets null login. is useful though { RocketRoadmap.DB.User user = new RocketRoadmap.DB.User(Request.Form["username_ID"], Request.Form["password_ID"]); bool flag = user.Login(); if (flag) { Session["username"] = user.GetUserName(); Session["password"] = user.GetPassword(); mUser = new DB.User((string)Session["username"], (string)Session["password"]); name.InnerText = user.GetUserName() + "'s Roadmaps"; } else if (mUser.Login()) { } else { Response.Redirect("index.aspx", false); } } else { Response.Redirect("index.aspx", false); return; } if (mUser.Login()) { RoadMaps umaps = new RoadMaps(); try { List<List<string>> uall = umaps.GetUserMapsInfo(mUser.GetUserName()); TableHeaderRow uhead = new TableHeaderRow(); TableHeaderCell u1 = new TableHeaderCell(); TableHeaderCell u2 = new TableHeaderCell(); TableHeaderCell u3 = new TableHeaderCell(); TableHeaderCell u4 = new TableHeaderCell(); TableHeaderCell u5 = new TableHeaderCell(); TableHeaderCell u6 = new TableHeaderCell(); u1.Text = "Name"; u1.Width = new Unit(20, UnitType.Percentage); u2.Text = "Author"; u2.Width = new Unit(15, UnitType.Percentage); u3.Text = "Description"; u3.Width = new Unit(40, UnitType.Percentage); u4.Text = "Timestamp"; u4.Width = new Unit(20, UnitType.Percentage); u5.Width = new Unit(5, UnitType.Percentage); uhead.Cells.Add(u1); uhead.Cells.Add(u2); uhead.Cells.Add(u3); uhead.Cells.Add(u4); uhead.Cells.Add(u5); userroadmaps.Rows.Add(uhead); foreach (var umap in uall) { TableRow urow = new TableRow(); TableCell ucell_1 = new TableCell(); TableCell ucell_2 = new TableCell(); TableCell ucell_3 = new TableCell(); TableCell ucell_4 = new TableCell(); TableCell ucell_5 = new TableCell(); HtmlInputButton deleteButton = new HtmlInputButton(); deleteButton.Value = "X"; deleteButton.Attributes.Add("onclick","AreYouSure(\""+umap[0]+"\");"); HyperLink link = new HyperLink(); link.NavigateUrl = "Roadmap.aspx?n=" + Uri.EscapeUriString(umap[0]); link.Text = umap[0]; TableCell tCell1 = new TableCell(); ucell_1.Controls.Add(link); ucell_2.Text = umap[1]; ucell_3.Text = umap[2]; ucell_4.Text = umap[3]; ucell_5.Controls.Add(deleteButton); urow.Cells.Add(ucell_1); urow.Cells.Add(ucell_2); urow.Cells.Add(ucell_3); urow.Cells.Add(ucell_4); urow.Cells.Add(ucell_5); userroadmaps.Rows.Add(urow); } } catch (NullReferenceException nre) { } } RoadMaps maps = new RoadMaps(); try { List<List<string>> all = maps.GetAllMapsInfo(); TableHeaderRow uhead = new TableHeaderRow(); TableHeaderCell u1 = new TableHeaderCell(); TableHeaderCell u2 = new TableHeaderCell(); TableHeaderCell u3 = new TableHeaderCell(); TableHeaderCell u4 = new TableHeaderCell(); TableHeaderCell u5 = new TableHeaderCell(); TableHeaderCell u6 = new TableHeaderCell(); u1.Text = "Name"; u1.Width = new Unit(20, UnitType.Percentage); u2.Text = "Author"; u2.Width = new Unit(15, UnitType.Percentage); u3.Text = "Description"; u3.Width = new Unit(40, UnitType.Percentage); u4.Text = "Timestamp"; u4.Width = new Unit(20, UnitType.Percentage); u5.Width = new Unit(5, UnitType.Percentage); uhead.Cells.Add(u1); uhead.Cells.Add(u2); uhead.Cells.Add(u3); uhead.Cells.Add(u4); uhead.Cells.Add(u5); allroadmaps.Rows.Add(uhead); foreach (var map in all) { TableRow row = new TableRow(); TableCell cell_1 = new TableCell(); TableCell cell_2 = new TableCell(); TableCell cell_3 = new TableCell(); TableCell cell_4 = new TableCell(); TableCell cell_5 = new TableCell(); TableCell cell_6 = new TableCell(); HyperLink link = new HyperLink(); link.NavigateUrl = "Roadmap.aspx?n=" + map[0]; link.Text = map[0]; TableCell tCell1 = new TableCell(); cell_1.Controls.Add(link); cell_2.Text = map[1]; cell_3.Text = map[2]; cell_4.Text = map[3]; row.Cells.Add(cell_1); row.Cells.Add(cell_2); row.Cells.Add(cell_3); row.Cells.Add(cell_4); row.Cells.Add(cell_5); allroadmaps.Rows.Add(row); } } catch (NullReferenceException nre) { } }
protected void Page_Load(object sender, EventArgs e) { //User login check DB.User user = new DB.User((string)Session["username"], (string)Session["password"]); if (!user.Login()) { Response.Redirect("index.aspx", false); } //getting map name string url = Request.Url.AbsoluteUri; int index = url.IndexOf("="); string name = HttpUtility.UrlDecode(url.Substring(index + 1)); roadmapnamelabel.InnerText = name; RoadMap roadmap = new RoadMap(name); //getting list of strategy points List<StrategyPoint> strats = roadmap.GetStrategyPoints(); // our main table HtmlTable table = FindControl("roadmapTable") as HtmlTable; int count = 0; double totalHeight = 0; // the last textbox we made HtmlInputText lasttext = new HtmlInputText(); // business value textbox HtmlInputText busVal = new HtmlInputText(); //table that hold all text boxes for strategy point HtmlTable newtable = new HtmlTable(); // our last table HtmlTable lastTable = new HtmlTable(); // the project text box HtmlInputText projText = new HtmlInputText(); // the next input cell we will use HtmlTableCell NextInputCell = new HtmlTableCell(); HtmlTableCell mainTextCell = new HtmlTableCell(); mainTextCell = null; // the delete hyperlink HyperLink delete = new HyperLink(); #region Loading Strats, Vals, and Projects DependentOfColor.Value = roadmap.GetDependeny_of_Color(); DependentOnColor.Value = roadmap.GetDependeny_on_Color(); foreach (StrategyPoint p in strats) { /* * Creating the visual strategy points */ //making a row for this point HtmlTableRow row; row = new HtmlTableRow(); row.ID = "StratVisual" + count.ToString() + "Row"; // making the button HtmlInputButton but = new HtmlInputButton(); but.Name = "Strat"; but.ID = "StratBut" + count.ToString(); // adding the style class but.Attributes.Add("class", "StratVis"); //loading the color string color = p.GetColor(); but.Attributes.Add("style", "background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, " + color + "), color-stop(1, " + color + ")); background:-moz-linear-gradient(top, " + color + " 5%, " + color + " 100%); background:-webkit-linear-gradient(top, " + color + " 5%, " + color + " 100%); background:-o-linear-gradient(top, " + color + " 5%, " + color + " 100%); background:-ms-linear-gradient(top, " + color + " 5%, " + color + " 100%); background:linear-gradient(to bottom, " + color + " 5%, " + color + " 100%); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='" + color + "', endColorstr='" + color + "',GradientType=0);"); but.Style.Add(HtmlTextWriterStyle.Height, "3.4em"); if (count == 0) { totalHeight = totalHeight + 5.2; } else { totalHeight = totalHeight + 5; } but.Value = p.GetDescription(); /* * Loading in info to edit panel */ // setting the text box to edit HtmlInputText textbox; if (count == 0) { textbox = StratBox0; } else { textbox = lasttext; } // setting correct text value textbox.Value = p.GetDescription(); //allow deletion of all stratboxes except the last if (count<strats.Count()) { textbox.Attributes.Add("firstadd", "1"); } //cell for text boxes HtmlTableCell cell = new HtmlTableCell(); // adding in elementes to table row.Cells.Add(cell); cell.Controls.Add(but); table.Rows.Add(row); //increasing index to next point count++; //making a new row and setting it to last row so we can grab it in next loop HtmlTableRow lastRow = new HtmlTableRow(); lastRow.ID = "StratBox" + count.ToString() + "Row"; // if this is the first point set the first color box if not reset the elements and set the color for the last point if (mainTextCell == null) { ColorPicker0.Value = color; } else { mainTextCell.InnerHtml = "<input type=\"color\" class=\"stratColor\" id=\"ColorPicker" + (count - 1).ToString() + "\" onchange=\"changeColor(" + (count - 1).ToString() + ")\" value =\"" + color + "\">"; mainTextCell.Controls.Add(lasttext); delete = new HyperLink(); delete.ID = "StratDelete" + (count - 1).ToString(); delete.Attributes.Add("class", "remove_strat"); delete.Text = " X"; mainTextCell.Controls.Add(delete); mainTextCell.Controls.Add(newtable); } //making the next strategy text input mainTextCell = new HtmlTableCell(); HtmlInputText text = new HtmlInputText(); lasttext = text; text.ID = "StratBox" + count.ToString(); text.Attributes.Add("class", "txtStrat"); text.Attributes.Add("BusTotal", "1"); text.Attributes.Add("placeholder", "Add Strategy Point"); text.Attributes.Add("runat", "server"); text.Attributes.Add("onkeyup", "addStrat(event,this," + count.ToString() + ")"); //setting color to default value in case this is our last point int colorNum = count % colorList.Count; mainTextCell.InnerHtml = "<input type=\"color\" class=\"stratColor\" id=\"ColorPicker" + count.ToString() + "\" onchange=\"changeColor(" + count.ToString() + ")\" value =\"" + colorList[colorNum] + "\">"; mainTextCell.Controls.Add(text); //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), text.ID + "BusBox0Row", "showStrat(" + text.ID + "BusBox0Row);", true); //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), text.ID + "BusBox0ProjBox0", "hideProj("+ text.ID + "BusBox0ProjBox0);", true); //adding the delete button delete = new HyperLink(); delete.ID = "StratDelete" + count.ToString(); delete.Attributes.Add("class", "remove_strat"); delete.Text = " X"; mainTextCell.Controls.Add(delete); //making the new table mainTextCell.Controls.Add(new LiteralControl("<br />")); lastTable = newtable; newtable = new HtmlTable(); newtable.ID = "StratBox" + count.ToString() + "Table"; mainTextCell.Controls.Add(newtable); HtmlTableRow stratTableRow = new HtmlTableRow(); stratTableRow.ID = "StratBox" + count.ToString() + "BusBox0Row"; newtable.Rows.Add(stratTableRow); HtmlTableCell stratCell = new HtmlTableCell(); stratTableRow.Cells.Add(stratCell); /* * Loading Business Values */ #region Business Values int valcount = 0; // the table that the visual business values are in HtmlTable StratVisTable = new HtmlTable(); StratVisTable.ID = p.GetName() + "VisualTable"; // the last business value we made HtmlInputText lastBusVal = new HtmlInputText(); // the table for projects HtmlTable BusTable = new HtmlTable(); float butheight = 3.4f; HtmlInputText nextText = new HtmlInputText(); foreach (BusinessValue b in p.GetBusinessValues()) { /* * Visual business values */ // adding on to the BusTotal of the strategy point textbox.Attributes.Add("BusTotal", (valcount + 2).ToString()); HtmlTableCell bc1 = new HtmlTableCell(); HtmlTableCell bc2 = new HtmlTableCell(); HtmlTableRow visRow = new HtmlTableRow(); // if valcount is 0 insert the business value as normal if (valcount == 0) { // making the visual cell HtmlTableCell sCell = new HtmlTableCell(); sCell.Attributes.Add("class", "NewCellVis"); sCell.Controls.Add(StratVisTable); row.Cells.Add(sCell); // making the visual row for value visRow.Attributes.Add("class", "RowVis"); visRow.ID = b.GetName() + "RowVis"; if (count == 1 && valcount == 0) { visRow.Attributes.Add("style", "border-top: 2pt solid; border-top-color: #D3D3D3;"); } StratVisTable.Rows.Add(visRow); bc1.ID = b.GetName() + "td"; bc1.Attributes.Add("class", "projtd"); visRow.Cells.Add(bc1); bc2 = new HtmlTableCell(); bc2.ID = p.GetName() + "BusVisual" + valcount.ToString(); bc2.Attributes.Add("class", "BusVis"); //setting text to correct value bc2.InnerText = b.GetDescription(); visRow.Cells.Add(bc2); } else { HtmlTableRow newPRow = new HtmlTableRow(); StratVisTable.Rows.Add(newPRow); newPRow.Attributes.Add("class", "RowVis"); newPRow.ID = b.GetName() + "RowVis"; bc1 = new HtmlTableCell(); bc1.ID = b.GetName() + "td"; bc1.Attributes.Add("class", "projtd"); newPRow.Cells.Add(bc1); bc2.ID = p.GetName() + "BusVisual" + valcount.ToString(); bc2.Attributes.Add("class", "BusVis"); //setting text to correct value bc2.InnerText = b.GetDescription(); newPRow.Cells.Add(bc2); //changing height of strategy point //currentheight = document.getElementById("StratBut" + String(CurrentStratCount)).style.height.split('em')[0]; //but.Attributes.g //document.getElementById("StratBut" + String(CurrentStratCount)).style.height = String(parseFloat(currentheight) + 3.27) + "em"; butheight = butheight + 3.27f; totalHeight = totalHeight + 5; but.Style.Add(HtmlTextWriterStyle.Height, butheight.ToString() + "em"); } /* * Loading info into edit panel */ //getting correct text box HtmlInputText bustextbox = new HtmlInputText(); if (count == 1 && valcount == 0) { bustextbox = StratBox0BusBox0; bustextbox.Attributes.Add("firstadd", "1"); } else { bustextbox = busVal; } //setting text to correct value bustextbox.Value = b.GetDescription(); //getting correct table if (count == 1) { BusTable = StratBox0Table; } else { BusTable = lastTable; } //increaing index to for next business value valcount++; //creating next business value text box HtmlTableRow NextRow = new HtmlTableRow(); NextRow.ID = "StratBox" + (count - 1).ToString() + "BusBox" + valcount.ToString() + "Row"; NextInputCell = new HtmlTableCell(); NextInputCell.ID = "StratBox" + (count - 1).ToString() + "BusBox" + valcount.ToString() + "Cell"; //adding new input box HtmlInputText NextBox = new HtmlInputText(); NextBox.Attributes.Add("class", "txtBus"); NextBox.Attributes.Add("ProjTotal", "1"); NextBox.ID = "StratBox" + (count - 1).ToString() + "BusBox" + valcount.ToString(); NextBox.Attributes.Add("placeholder", "Add Business Value"); NextBox.Attributes.Add("runat", "server"); NextBox.Attributes.Add("onkeyup", "addBus(event,this," + valcount.ToString() + ")"); // making it so you can't delete last text box if (valcount < p.GetBusinessValues().Count) { NextBox.Attributes.Add("firstadd", "1"); } BusTable.Rows.Add(NextRow); NextInputCell.Controls.Add(NextBox); //adding delete button delete = new HyperLink(); delete.ID = "StratBox" + (count - 1).ToString() + "BusBox" + valcount.ToString() + "Delete"; delete.Attributes.Add("class", "remove_bus"); delete.Text = " X"; NextInputCell.Controls.Add(delete); NextRow.Cells.Add(NextInputCell); /* * Loading Projects */ #region Loading Projects int projCount = 0; HtmlTableCell lastCell = new HtmlTableCell(); HtmlInputText newprojText = new HtmlInputText(); foreach (Project proj in b.GetProjects()) { //updating the project count for business value bustextbox.Attributes.Add("ProjTotal", (projCount + 2).ToString()); /* * Visual Projects */ bc1.InnerHtml = bc1.InnerHtml + "<div id=\"" + proj.GetName() + "But" + "\" ondblclick=\"showModal(this.id)\" onclick=\"Highlight(this.id)\" onmouseout =\"UnHighlight(this.id)\" class=\"proj1\" style=\"cursor: auto; left: " + proj.GetLeft().ToString() + "px; top: 0px; width: " + proj.GetWidth().ToString() + "px; background-color: " + color + ";\">" + "<span style='width:" +(proj.GetWidth()-15).ToString() + "px;' class='projLabel' id='" +proj.GetName()+"Label'>" + proj.GetDescription() + "</span>" + "</div>" + "<div class=\"space\" id=\"" + proj.GetName() + "space\"></div>"; /* * Updating edit info */ //finding correct text box HtmlInputText projTextBox = new HtmlInputText(); if (count == 1 && valcount == 1 && projCount == 0) { StratBox0BusBox0ProjBox0.Value = proj.GetDescription(); lastCell = StratBox0BusBox0Cell; if (StratBox0BusBox0ProjBox0.Value == "") { //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), StratBox0BusBox0ProjBox0.ID + "Hide", "showProj(" + StratBox0BusBox0ProjBox0.ID + ");", true); } } else if (valcount == 1 && projCount == 0) { projText.Value = proj.GetDescription(); lastCell = projText.Parent as HtmlTableCell; if ( projText.Value == "") { //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), projText.ID + "Hide", "showProj(" + projText.ID + ");", true); } } else if (projCount == 0) { nextText.Value = proj.GetDescription(); lastCell = nextText.Parent as HtmlTableCell; if (nextText.Value == "") { //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), nextText.ID + "show", "showProj(" + nextText.ID + ");", true); } } else { newprojText.Value = proj.GetDescription(); } //updaing size of strategy point if (projCount > 1) { //increase stratbut height //var currentheight = document.getElementById("StratBut" + String(CurrentStratCount)).style.height.split("em")[0]; //document.getElementById("StratBut" + String(CurrentStratCount)).style.height = String(parseFloat(currentheight) + 1.7) + "em"; butheight = butheight + 1.7f; totalHeight = totalHeight + 2.5; //but.Style.Add(HtmlTextWriterStyle.Height, "6em"); but.Style.Add(HtmlTextWriterStyle.Height, butheight.ToString() + "em"); //increase RowVis height //visRow visRow.Style.Add(HtmlTextWriterStyle.Height, ((projCount+1) * 2.5).ToString()+"em"); //RowVis = obj.id.split("ProjBox")[0] + "RowVis"; //currentheight = document.getElementById(RowVis).style.height; //document.getElementById(RowVis).style.height = (ProjTotal * 2.5).toString() + "em"; } //setting the last cell lastCell.ID = b.GetName() + "Cell"; //adding delete button delete = new HyperLink(); delete.ID = "StratBox" + (count - 1).ToString() + "BusBox" + (valcount - 1).ToString() + "ProjBox" + projCount.ToString() + "Delete"; delete.Attributes.Add("class", "remove_proj"); delete.Text = " X"; lastCell.Controls.Add(delete); //increasing the index of projects for next project projCount++; //creating next project text box newprojText = new HtmlInputText(); newprojText.Name = "DynmaicTextBox"; newprojText.ID = "StratBox" + (count - 1).ToString() + "BusBox" + (valcount - 1).ToString() + "ProjBox" + projCount.ToString(); newprojText.Attributes.Add("class", "txtProjDel"); newprojText.Attributes.Add("placeholder", "Add Project"); newprojText.Attributes.Add("runat", "server"); newprojText.Attributes.Add("onkeyup", "addProj(event,this," + projCount.ToString() + ")"); lastCell.Controls.Add(newprojText); //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), newprojText.ID + "Hide", "showProj(" + newprojText.ID + ");", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), proj.GetName()+"func", "enableDragbyId(" + proj.GetName() + ");", true); } #endregion //creating default project textbox for a business value nextText = new HtmlInputText(); nextText.Name = "DynmaicTextBox"; nextText.ID = "StratBox" + (count - 1).ToString() + "BusBox" + valcount.ToString() + "ProjBox0"; nextText.Attributes.Add("class", "txtProjDel"); nextText.Attributes.Add("placeholder", "Add Project"); nextText.Attributes.Add("runat", "server"); nextText.Attributes.Add("onkeyup", "addProj(event,this," + projCount.ToString() + ")"); NextInputCell.Controls.Add(nextText); busVal = NextBox; //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), nextText.ID + "Hide", "hideProj(" + nextText.ID + ");", true); } #endregion //creating default business value for strategy point busVal = new HtmlInputText(); busVal.Attributes.Add("class", "txtBus"); busVal.Attributes.Add("ProjTotal", "1"); busVal.ID = "StratBox" + count.ToString() + "BusBox0"; busVal.Attributes.Add("placeholder", "Add Business Value"); busVal.Attributes.Add("runat", "server"); //busVal.Attributes.Add("firstadd", "1"); busVal.Attributes.Add("onkeyup", "addBus(event,this," + count.ToString() + ")"); stratCell.Controls.Add(busVal); //default delete delete = new HyperLink(); delete.ID = "StratBox" + (count).ToString() + "BusBox0Delete"; delete.Attributes.Add("class", "remove_bus"); delete.Text = " X"; stratCell.Controls.Add(delete); //adding in default project for first business value projText = new HtmlInputText(); projText.Name = "DynmaicTextBox"; projText.ID = "StratBox" + count.ToString() + "BusBox0ProjBox0"; projText.Attributes.Add("class", "txtProjDel"); projText.Attributes.Add("placeholder", "Add Project"); projText.Attributes.Add("runat", "server"); projText.Attributes.Add("onkeyup", "addProj(event,this," + count.ToString() + ")"); stratCell.Controls.Add(projText); lastRow.Cells.Add(mainTextCell); HtmlTable sideTable = FindControl("sidebarTable") as HtmlTable; sideTable.Rows.Add(lastRow); //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), projText.ID + "Hide", "hideProj(" + projText.ID + ");", true); #endregion } //hiding the elements of the newest strategy point ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "StratBox" + (count).ToString() + "BusBox0Row", "hideStrat(StratBox" + (count).ToString() + "BusBox0Row);", true); /* * Loading in timeline */ TimeLine TL = roadmap.GetTimeline(); if(TL!= null) { int tickCount = 0; foreach (TickMark tick in TL.GetTicks()) { tickCount++; double translateAmount = 0; if (tick.GetName().Length < 2) { translateAmount = .2; } else { translateAmount = -1 * (tick.GetName().Length * .25 - .35); } containmentWrapper.InnerHtml += "<div ondblclick = \"deleteTime(this)\" class=\"timeline\" id=\"" + tick.GetName()+ "\" style=\"left: " + (tick.GetXPlacement()).ToString() + "px; top: -3px; \">" + "<p style='transform: translateX(" + translateAmount + "em)' class=\"timelineText\">" + tick.GetName() + "</p>"+ "</div>"; } } //enabling drag ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script2", "enableDrag();", true); //set total height ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "setTotalHeight", "setTotalHeight(" + totalHeight.ToString() + ");", true); }