コード例 #1
0
        public IActionResult ProEdit(TSProduct product, string actionType)
        {
            int?Pid = product.ProdSupId;

            if (actionType == "Update")
            {
                if (ModelState.IsValid)
                {
                    try{
                        _dbContext.TSProducts.Update(product);
                        _dbContext.SaveChanges();
                    }
                    catch {}
                }
                else
                {
                    CreateViewBags(Pid, product.ProdId);
                    return(View(product));
                }
            }

            var model = _dbContext.TSupliers
                        .SingleOrDefault(u => u.SupId.Equals(Pid));
            string sName = model.SupRasoc + " " + model.SupNif;

            ViewData["sName"] = sName;
            ViewData["SupId"] = Pid;


            CreateViewBags(Pid, 0);
            ViewData["panel"] = 2;
            return(RedirectToAction("Edit", new{ id = Pid, panel = 2, move = 0, prod = product.ProdId }));
        }
コード例 #2
0
 public IActionResult ProCreate(TSProduct product, int Pid, string actionType)
 {
     if (actionType == "Add")
     {
         if (ModelState.IsValid)
         {
             try{
                 _dbContext.TSProducts.Add(product);
                 _dbContext.SaveChanges();
             }
             catch { return(View("Error")); }
         }
         else
         {
             CreateViewBags(Pid, product.ProdId);
             return(View(product));
         }
     }
     CreateViewBags(Pid, 0);
     ViewData["panel"] = 2;
     return(RedirectToAction("Edit", new{ id = Pid, panel = 2, move = 0, prod = product.ProdId }));
 }
コード例 #3
0
	/// <summary>
	/// Display the time series. </summary>
	/// <param name="action"> Event action that initiated the display. </param>
	private void displayTSViewJFrame(string action)
	{
		string routine = "displayTSViewJFrame";

		// Initialize the display...

		PropList display_props = new PropList("ClimateStation");
		if (action.Equals(__BUTTON_GRAPH))
		{
			display_props.set("InitialView", "Graph");
		}
		else if (action.Equals(__BUTTON_TABLE))
		{
			display_props.set("InitialView", "Table");
		}
		else if (action.Equals(__BUTTON_SUMMARY))
		{
			display_props.set("InitialView", "Summary");
		}
		// display_props.set("HelpKey", "TSTool.ExportMenu");
		display_props.set("TotalWidth", "600");
		display_props.set("TotalHeight", "400");
		display_props.set("Title", "Demand");
		display_props.set("DisplayFont", "Courier");
		display_props.set("DisplaySize", "11");
		display_props.set("PrintFont", "Courier");
		display_props.set("PrintSize", "7");
		display_props.set("PageLength", "100");

		PropList props = new PropList("ClimateStation");

		IList<TS> tslist = new List<TS>();

		// Get the time series to display and set plot properties if graphing.
		// For now need to find in the lists because references to time series
		// are not implemented...

		IList<TS> v = null;
		TS ts = null;
		int sub = 0;
		int pos;
		StateCU_ClimateStation station = __stationsVector[__currentStationIndex];
		if (__precipitationCheckBox.isSelected())
		{
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<RTi.TS.TS> v0 = (java.util.List<RTi.TS.TS>)__dataset.getComponentForComponentType(StateCU_DataSet.COMP_PRECIPITATION_TS_MONTHLY).getData();
			IList<TS> v0 = (IList<TS>)__dataset.getComponentForComponentType(StateCU_DataSet.COMP_PRECIPITATION_TS_MONTHLY).getData();
			v = v0;
			pos = TSUtil.IndexOf(v, station.getID(), "Location", 1);
			if (pos >= 0)
			{
				ts = (TS)v[pos];
			}
			if (ts != null)
			{
				// Add a graph for precipitation...
				++sub;
				ts.setDataType("Precipitation");
				props.set("SubProduct " + sub + ".GraphType=Bar");
				props.set("SubProduct " + sub + ".SubTitleString=Monthly Precipitation");
				props.set("Data " + sub + ".1.TSID=" + ts.getIdentifierString());
				tslist.Add(ts);
			}
		}
		if (__temperatureCheckBox.isSelected())
		{
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<RTi.TS.TS> v0 = (java.util.List<RTi.TS.TS>)__dataset.getComponentForComponentType(StateCU_DataSet.COMP_TEMPERATURE_TS_MONTHLY_AVERAGE).getData();
			IList<TS> v0 = (IList<TS>)__dataset.getComponentForComponentType(StateCU_DataSet.COMP_TEMPERATURE_TS_MONTHLY_AVERAGE).getData();
			v = v0;
			pos = TSUtil.IndexOf(v, station.getID(), "Location", 1);
			if (pos >= 0)
			{
				ts = (TS)v[pos];
			}
			if (ts != null)
			{
				// Add a graph for temperature...
				++sub;
				ts.setDataType("Temperature");
				props.set("SubProduct " + sub + ".GraphType=Line");
				props.set("SubProduct " + sub + ".SubTitleString=Monthly Average Temperature");
				props.set("Data " + sub + ".1.TSID=" + ts.getIdentifierString());
				tslist.Add(ts);
			}
		}
		if (__frostDatesCheckBox.isSelected())
		{
			// REVISIT - no way to graph currently
		}

		// Display the time series...

		try
		{
			TSProduct tsproduct = new TSProduct(props, display_props);
			tsproduct.setTSList(tslist);
			new TSViewJFrame(tsproduct);
		}
		catch (Exception e)
		{
			Message.printWarning(1,routine,"Error displaying time series.");
			Message.printWarning(2, routine, e);
		}
	}