public ActionResult BindPlotlineToPlotline(int?id) { var plotlineOrg = db.Plotlines.Find(PageManager.CurrentPlotline.ID); Plotline plotline = null; if (id != null) { plotline = db.Plotlines.Find(id); if (plotlineOrg == null || plotline == null) { return(HttpNotFound()); } } plotlineOrg.DependentPlotlinesF.Add(plotline); plotline.DependentPlotlinesA.Add(plotlineOrg); db.SaveChanges(); pc.RemovePage("PickMany", "Plotlines"); var plotlines = db.Plotlines.Where(c => c.ProjectId == PageManager.CurrentProject.ID).ToList(); var pickablePlotlines = RemoveUsedPlotlinesP(plotlines, plotline); if (pickablePlotlines != null && pickablePlotlines.Any()) { return(RedirectToAction("PickForDP")); } else { return(RedirectToAction("Details", new { id = plotlineOrg.ID })); } }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Plotline plotline = db.Plotlines.Find(id); if (plotline == null) { return(HttpNotFound()); } Session["destinedController"] = "Plotlines"; if (PageManager.CurrentPlotline == null) { Session["destinedMethod"] = "Home"; } else { Session["destinedMethod"] = "Details"; } PageManager.CurrentPlotline = plotline; return(pc.AddEditPage("Plotlines", plotline, 2, new List <int>() { 2, 3 })); }
public ActionResult BindPlotlineToArc(int?id) { var arc = db.Arcs.Find(PageManager.CurrentArc.ID); Plotline plotline = null; if (id != null) { plotline = db.Plotlines.Find(id); if (arc == null || plotline == null) { return(HttpNotFound()); } } arc.MainPlotline = plotline; if (id != null) { arc.PlotlineId = plotline.ID; } else { arc.PlotlineId = null; } db.SaveChanges(); pc.RemovePage("PickOne", "Plotlines"); return(RedirectToAction("Details", "Arcs")); }
public ActionResult BindPlotlineToBook(int?id) { var book = db.Books.Find(PageManager.CurrentBook.ID); Plotline plotline = null; if (id != null) { plotline = db.Plotlines.Find(id); if (book == null || plotline == null) { return(HttpNotFound()); } } book.MainPlotline = plotline; if (id != null) { book.PlotlineId = plotline.ID; } else { book.PlotlineId = null; } db.SaveChanges(); pc.RemovePage("PickOne", "Plotlines"); return(RedirectToAction("Details", "Books")); }
public ActionResult DeleteConfirmed(int id) { pc.RemovePage("Delete", "Plotlines"); Plotline plotline = db.Plotlines.Find(id); Helper.RemovePlotReferences(plotline); db.Plotlines.Remove(plotline); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "Name,Summary")] Plotline plotline) { pc.RemovePage("Create", "Plotlines"); if (ModelState.IsValid) { plotline.ProjectId = PageManager.CurrentProject.ID; plotline.LastModified = DateTime.Now; db.Plotlines.Add(plotline); db.SaveChanges(); return(RedirectToAction("Details", new { id = plotline.ID })); } return(RedirectToAction("Create")); }
private List <Plotline> RemoveUsedPlotlinesP(List <Plotline> plotlines, Plotline plotline) { var pickablePlotlines = new List <Plotline>(); if (plotlines != null && plotlines.Any()) { plotlines.ForEach(p => { if (plotline.ID != p.ID && (plotline.DependentPlotlinesF == null || !plotline.DependentPlotlinesF.Any() || !plotline.DependentPlotlinesF.Contains(p)) && (plotline.DependentPlotlinesA == null || !plotline.DependentPlotlinesA.Any() || !plotline.DependentPlotlinesA.Contains(p))) { pickablePlotlines.Add(p); } }); } return(pickablePlotlines); }
public ActionResult Edit([Bind(Include = "ID,Name,Summary")] Plotline plotline) { pc.RemovePage("Edit", "Plotlines"); if (ModelState.IsValid) { db.Entry(plotline).State = EntityState.Modified; plotline.ProjectId = PageManager.CurrentProject.ID; plotline.LastModified = DateTime.Now; db.SaveChanges(); if ((string)Session["destinedMethod"] == "Details") { return(RedirectToAction("Details", new { id = plotline.ID })); } else { return(RedirectToAction((string)Session["destinedMethod"])); } } return(RedirectToAction("Edit", new { id = plotline.ID })); }
public ActionResult Details(int?id) { Plotline plotline = null; if (id == null) { plotline = db.Plotlines.Find(PageManager.CurrentPlotline.ID); } else { plotline = db.Plotlines.Find(id); } if (plotline == null) { return(HttpNotFound()); } PageManager.CurrentPlotline = plotline; pc.RemoveAllPages("Scenes"); pc.RemoveAllPages("Characters"); return(pc.AddDetailsPage("Plotlines", plotline, 4)); }
public ActionResult BindPlotlineToCharacter(int?id) { var character = db.Characters.Find(PageManager.CurrentCharacter.ID); Plotline plotline = null; if (id != null) { plotline = db.Plotlines.Find(id); if (character == null || plotline == null) { return(HttpNotFound()); } } character.Plotlines.Add(plotline); plotline.Characters.Add(character); db.SaveChanges(); pc.RemovePage("PickMany", "Plotlines"); return(RedirectToAction("PickForC")); }
public ActionResult CreateChild([Bind(Include = "Name,Summary")] Plotline plotline) { pc.RemovePage("CreateChild", "Plotlines"); if (ModelState.IsValid) { plotline.ProjectId = PageManager.CurrentProject.ID; plotline.LastModified = DateTime.Now; var character = db.Characters.Find(Session["currentCharacterId"]); plotline.Characters.Add(character); db.Plotlines.Add(plotline); db.SaveChanges(); db.Entry(character).State = EntityState.Modified; character.Plotlines.Add(plotline); db.SaveChanges(); return(RedirectToAction("Details", new { id = plotline.ID })); } return(RedirectToAction("CreateC")); }
public static ChartData1 getChartData2(string MachineID, string Parameters, string FromDate, int ToDate) { List <ChartData> chartDatasList = new List <ChartData>(); ChartData chartData = null; var filter = "{$and : [{ UpdatedTS: {$gte: ISODate('" + Util.GetDateTime(FromDate).ToString("yyyy-MM-ddTHH:mm:ssZ") + "')} },{ UpdatedTS: {$lte: ISODate('" + Util.GetDateTime(FromDate).AddHours(ToDate).ToString("yyyy-MM-ddTHH:mm:ssZ") + "')} }, {MachineID : {$in : " + MachineID + "}},{ParamterID : {$in :'P3', 'P4', 'P5', 'P6', 'P7, 'P8', 'P9','P10}}]}"; var dataset = _MongoDatabase.GetCollection <gvChartData>("PPT_AMGIOT_FlatData_Test").Find(filter).ToList(); SqlDataReader sdr = null; string cmdStr = String.Format("SELECT IDD, MachineID, ParameterID, ParameterValue, UpdatedtimeStamp, Part, Opn, ProgramNo, Qualifier, Column1, Column2 FROM ProcessParameterTransaction_BajajIoT where ParameterID in ('P13', 'P15', 'P20', 'P21', 'P22', 'P16', 'P14') order by UpdatedtimeStamp"); SqlConnection sqlConn = new SqlConnection(conString); sqlConn.Open(); SqlCommand command = new SqlCommand(cmdStr, sqlConn); command.CommandType = System.Data.CommandType.Text; try { sdr = command.ExecuteReader(); if (sdr.HasRows) { while (sdr.Read()) { chartData = new ChartData(); DateTime dt = DateTime.Now; // dt = (DateTime)(chartDatasList[i].Time); chartData.Time = (DateTime)(sdr["UpdatedtimeStamp"]); chartData.ParameterID = sdr["ParameterID"].ToString(); chartData.Value = sdr["ParameterValue"].ToString(); //if (sdr["ParameterValue"].ToString() != "") //{ // chartData.Value = Convert.ToDouble(sdr["ParameterValue"]); //} //else //{ // chartData.Value = 0; //} chartDatasList.Add(chartData); } } } catch (Exception ex) { //Logger.WriteErrorLog(ex.ToString()); } finally { if (sqlConn != null) { sqlConn.Close(); } } HttpContext.Current.Session["ChartData"] = chartDatasList; ChartData1 chartData1 = new ChartData1(); try { string[] data = new string[chartDatasList.Count]; double[] datad = null; List <Type> typeList = new List <Type>(); List <Plotline> plotlinesList = new List <Plotline>(); Type type = null; Plotline plotline = null; List <double[]> DataListData = new List <double[]>(); for (int i = 0; i < chartDatasList.Count; i++) { datad = new double[2]; datad[1] = double.Parse(chartDatasList[i].Value); //data[1] = (double) chartDatasList[i].Value; datad[0] = (double)(chartDatasList[i].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; //data[i] = chartDatasList[i].Time; DataListData.Add(datad); if (chartDatasList[i].ParameterID == "P13") { type = new Type(); type.x = (double)(chartDatasList[i].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; type.text = "Cycle Start"; type.title = "Cycle Start"; List <Styles> styles1 = new List <Styles>(); Styles style1 = new Styles(); style1.color = "green"; styles1.Add(style1); type.style = styles1; typeList.Add(type); plotline = new Plotline(); plotline.color = "green"; plotline.value = (double)(chartDatasList[i].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; plotline.width = 3; List <XLabel> labels = new List <XLabel>(); XLabel label = new XLabel(); label.text = "Cycle Start"; label.rotation = 90; List <Styles> styles = new List <Styles>(); Styles style = new Styles(); style.color = "white"; styles.Add(style); label.style = styles; labels.Add(label); plotline.label = labels; plotlinesList.Add(plotline); } if (chartDatasList[i].ParameterID == "P14") { type = new Type(); type.x = (double)(chartDatasList[i].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; type.text = "Cycle End"; type.title = "Cycle End"; typeList.Add(type); plotline = new Plotline(); plotline.color = "red"; plotline.value = (double)(chartDatasList[i].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; plotline.width = 3; List <XLabel> labels = new List <XLabel>(); XLabel label = new XLabel(); label.text = "Cycle End"; label.rotation = 90; List <Styles> styles = new List <Styles>(); Styles style = new Styles(); style.color = "white"; styles.Add(style); label.style = styles; labels.Add(label); plotline.label = labels; plotlinesList.Add(plotline); } } chartData1.data = DataListData; chartData1.type = typeList; chartData1.plotLines = plotlinesList; } catch (Exception ex) { } return(chartData1); }
public static ChartData1 getzoomChartData(double xvalue, double yvalue) { ChartData1 chartData = new ChartData1(); try { List <ChartData> chartDatasList = (List <ChartData>)HttpContext.Current.Session["ChartData"]; try { string[] data = new string[chartDatasList.Count]; double[] datad = null; List <Type> typeList = new List <Type>(); List <Plotline> plotlinesList = new List <Plotline>(); Type type = null; Plotline plotline = null; List <double[]> DataListData = new List <double[]>(); for (int i = 0; i < chartDatasList.Count; i++) { bool exists = false; if (double.Parse(chartDatasList[i].Value) == yvalue && (double)(chartDatasList[i].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds == xvalue) { int k = 0; for (int j = i; j < i + 6; j++) { datad = new double[2]; datad[1] = double.Parse(chartDatasList[j].Value); //data[1] = (double) chartDatasList[i].Value; datad[0] = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; //data[i] = chartDatasList[i].Time; DataListData.Add(datad); if (chartDatasList[j].ParameterID == "P13") { type = new Type(); type.x = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; type.text = "Cycle Start"; type.title = "Cycle Start"; List <Styles> styles1 = new List <Styles>(); Styles style1 = new Styles(); style1.color = "green"; styles1.Add(style1); type.style = styles1; typeList.Add(type); plotline = new Plotline(); plotline.color = "green"; plotline.value = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; plotline.width = 3; List <XLabel> labels = new List <XLabel>(); XLabel label = new XLabel(); label.text = "Cycle Start"; label.rotation = 90; List <Styles> styles = new List <Styles>(); Styles style = new Styles(); style.color = "white"; styles.Add(style); label.style = styles; labels.Add(label); plotline.label = labels; plotlinesList.Add(plotline); } if (chartDatasList[j].ParameterID == "P15") { type = new Type(); type.x = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; type.text = "Grinding Start"; type.title = "Grinding Start"; List <Styles> styles1 = new List <Styles>(); Styles style1 = new Styles(); style1.color = "blue"; styles1.Add(style1); type.style = styles1; typeList.Add(type); plotline = new Plotline(); plotline.color = "blue"; plotline.value = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; plotline.width = 3; List <XLabel> labels = new List <XLabel>(); XLabel label = new XLabel(); label.text = "Grinding Start"; label.rotation = 90; List <Styles> styles = new List <Styles>(); Styles style = new Styles(); style.color = "white"; styles.Add(style); label.style = styles; labels.Add(label); plotline.label = labels; plotlinesList.Add(plotline); } if (chartDatasList[j].ParameterID == "P20") { type = new Type(); type.x = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; type.text = "Roughing End"; type.title = "Roughing End"; List <Styles> styles1 = new List <Styles>(); Styles style1 = new Styles(); style1.color = "pink"; styles1.Add(style1); type.style = styles1; typeList.Add(type); plotline = new Plotline(); plotline.color = "pink"; plotline.value = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; plotline.width = 3; List <XLabel> labels = new List <XLabel>(); XLabel label = new XLabel(); label.text = "Roughing End"; label.rotation = 90; List <Styles> styles = new List <Styles>(); Styles style = new Styles(); style.color = "white"; styles.Add(style); label.style = styles; labels.Add(label); plotline.label = labels; plotlinesList.Add(plotline); } if (chartDatasList[j].ParameterID == "P21") { type = new Type(); type.x = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; type.text = "Semi-finish End"; type.title = "Semi-finish End"; List <Styles> styles1 = new List <Styles>(); Styles style1 = new Styles(); style1.color = "aqua"; styles1.Add(style1); type.style = styles1; typeList.Add(type); plotline = new Plotline(); plotline.color = "aqua"; plotline.value = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; plotline.width = 3; List <XLabel> labels = new List <XLabel>(); XLabel label = new XLabel(); label.text = "Semi-finish End"; label.rotation = 90; List <Styles> styles = new List <Styles>(); Styles style = new Styles(); style.color = "white"; styles.Add(style); label.style = styles; labels.Add(label); plotline.label = labels; plotlinesList.Add(plotline); } if (chartDatasList[j].ParameterID == "P22") { type = new Type(); type.x = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; type.text = "Finish End"; type.title = "Finish End"; List <Styles> styles1 = new List <Styles>(); Styles style1 = new Styles(); style1.color = "blueviolet"; styles1.Add(style1); type.style = styles1; typeList.Add(type); plotline = new Plotline(); plotline.color = "blueviolet"; plotline.value = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; plotline.width = 3; List <XLabel> labels = new List <XLabel>(); XLabel label = new XLabel(); label.text = "Finish End"; label.rotation = 90; List <Styles> styles = new List <Styles>(); Styles style = new Styles(); style.color = "white"; styles.Add(style); label.style = styles; labels.Add(label); plotline.label = labels; plotlinesList.Add(plotline); } if (chartDatasList[j].ParameterID == "P16") { type = new Type(); type.x = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; type.text = "Grinding End"; type.title = "Grinding End"; List <Styles> styles1 = new List <Styles>(); Styles style1 = new Styles(); style1.color = "blue"; styles1.Add(style1); type.style = styles1; typeList.Add(type); plotline = new Plotline(); plotline.color = "blue"; plotline.value = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; plotline.width = 3; List <XLabel> labels = new List <XLabel>(); XLabel label = new XLabel(); label.text = "Grinding End"; label.rotation = 90; List <Styles> styles = new List <Styles>(); Styles style = new Styles(); style.color = "white"; styles.Add(style); label.style = styles; labels.Add(label); plotline.label = labels; plotlinesList.Add(plotline); } if (chartDatasList[j].ParameterID == "P14") { type = new Type(); type.x = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; type.text = "Cycle End"; type.title = "Cycle End"; typeList.Add(type); plotline = new Plotline(); plotline.color = "red"; plotline.value = (double)(chartDatasList[j].Time - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds; plotline.width = 3; List <XLabel> labels = new List <XLabel>(); XLabel label = new XLabel(); label.text = "Cycle End"; label.rotation = 90; List <Styles> styles = new List <Styles>(); Styles style = new Styles(); style.color = "white"; styles.Add(style); label.style = styles; labels.Add(label); plotline.label = labels; plotlinesList.Add(plotline); break; } } chartData.data = DataListData; chartData.type = typeList; chartData.plotLines = plotlinesList; exists = true; } if (exists) { break; } } } catch (Exception ex) { } } catch (Exception ex) { } return(chartData); }