public List <YearType> SearchLike(YearType yearType)
        {
            List <YearType> listYearType = new List <YearType>();


            SqlParameter[] parametersYearType = new SqlParameter[]
            {
                new SqlParameter("@YearTypeID", yearType.YearTypeID),
                new SqlParameter("@Title", yearType.Title),
            };
            using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("YearType_SearchLike", CommandType.StoredProcedure, parametersYearType))
            {
                if (table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        YearType tmpYearType = new YearType();
                        tmpYearType.YearTypeID = (row["YearTypeID"] != DBNull.Value) ? Convert.ToInt32(row["YearTypeID"]) : 0;
                        tmpYearType.Title      = row["Title"].ToString();

                        listYearType.Add(tmpYearType);
                    }
                }
            }

            return(listYearType);
        }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label   lblYearTypeID = GridView1.Rows[e.RowIndex].FindControl("lblYearTypeID") as Label;
        TextBox txtTitle      = GridView1.Rows[e.RowIndex].FindControl("txtTitle") as TextBox;


        if (lblYearTypeID != null && txtTitle != null)
        {
            YearType yearType = new YearType();

            yearType.YearTypeID = Convert.ToInt32(lblYearTypeID.Text.Trim());
            yearType.Title      = txtTitle.Text;

            //Let us now update the database
            if (yearTypeHandler.Update(yearType) == true)
            {
                lblResult.Text = "Record Updated Successfully";
            }
            else
            {
                lblResult.Text = "Failed to Update record";
            }

            //end the editing and bind with updated records.
            GridView1.EditIndex = -1;
            BindData();
        }
    }
示例#3
0
        /// <summary>
        /// Gibt die Summe der Ein- oder Ausgabe zurück
        /// </summary>
        /// <param name="isRevenue">Ob es sich um eine Ein- oder Ausgabe handelt</param>
        /// <param name="type">Gegenwart oder Vergangenheit</param>
        /// <returns>Die Summe der Beträge</returns>
        public static double GetSum(bool isRevenue, YearType type = YearType.Current)
        {
            var date = DateTime.Now;

            if (type == YearType.Past)
            {
                date = date.AddYears(-1);
            }

            var startDate = new DateTime(date.Year, 1, 1);
            var endDate   = new DateTime(date.Year, 12, 31);

            using (var db = new TafelModelContainer())
            {
                var cashClosures = db.CashClosures
                                   .Where(cc => cc.ClosureDate >= startDate &&
                                          cc.ClosureDate <= endDate);
                if (cashClosures.Any())
                {
                    if (isRevenue)
                    {
                        return(cashClosures.Sum(cc => cc.Revenue));
                    }
                    else
                    {
                        return(cashClosures.Sum(cc => cc.Expense));
                    }
                }
                return(0);
            }
        }
 public bool Exists(YearType yearType)
 {
     SqlParameter[] parametersYearType = new SqlParameter[]
     {
         new SqlParameter("@YearTypeID", yearType.YearTypeID)
     };
     return(SqlDBHelper.ExecuteScalar("YearType_Exists", CommandType.StoredProcedure, parametersYearType) > 0);
 }
示例#5
0
        /// <summary>
        /// Statistics of issued and received invoices for given year.
        /// </summary>
        /// <param name="yearType">Type of year.</param>
        /// <returns><see cref="ApiResult{TData}"/> instance containing <see cref="InvoicingForYearGetModel"/>.</returns>
        public ApiResult <InvoicingForYearGetModel> InvoicingForYear(YearType yearType)
        {
            var queryParams = new Dictionary <string, string> {
                { nameof(YearType), yearType.ToString() }
            };

            return(Get <InvoicingForYearGetModel>($"{ResourceUrl}/InvoicingForYear", queryParams));
        }
        /// <summary>
        /// Statistics of issued and received invoices for given year.
        /// </summary>
        /// <param name="yearType">Type of year.</param>
        /// <param name="cancellationToken">Cancellation token.</param>
        /// <returns><see cref="ApiResult{TData}"/> instance containing <see cref="InvoicingForYearGetModel"/>.</returns>
        public Task <ApiResult <InvoicingForYearGetModel> > InvoicingForYearAsync(YearType yearType, CancellationToken cancellationToken = default)
        {
            var queryParams = new Dictionary <string, string> {
                { nameof(YearType), yearType.ToString() }
            };

            return(GetAsync <InvoicingForYearGetModel>($"{ResourceUrl}/InvoicingForYear", queryParams, cancellationToken));
        }
 public Int64 Insert(YearType yearType)
 {
     SqlParameter[] parametersYearType = new SqlParameter[]
     {
         new SqlParameter("@YearTypeID", yearType.YearTypeID),
         new SqlParameter("@Title", yearType.Title)
     };
     return(SqlDBHelper.ExecuteScalar("YearType_Insert", CommandType.StoredProcedure, parametersYearType));
 }
 public bool Update(YearType yearType)
 {
     SqlParameter[] parametersYearType = new SqlParameter[]
     {
         new SqlParameter("@YearTypeID", yearType.YearTypeID),
         new SqlParameter("@Title", yearType.Title)
     };
     return(SqlDBHelper.ExecuteNonQuery("YearType_Update", CommandType.StoredProcedure, parametersYearType));
 }
示例#9
0
        public Calendar(int year, YearType type)
        {
            init();

            if (type == YearType.ROCYEAR)
            {
                CurrentYear = DateTime.ParseExact(year.ToString(), "yyy", culture_TW);
            }
            else if (type == YearType.BCYEAR)
            {
                CurrentYear = new DateTime(year, 1, 1);
            }
        }
示例#10
0
    protected void btnYES_Click(object sender, EventArgs e)
    {
        YearType yearType = new YearType();

        yearType.YearTypeID = Convert.ToInt32(txtYearTypeID.Text);
        yearType.Title      = txtTitle.Text;

        YearTypeHandler yearTypeHandler = new YearTypeHandler();

        if (yearTypeHandler.Insert(yearType) > 0)
        {
            Response.Redirect("Z_YearTypeDefault.aspx");
        }
    }
示例#11
0
 private void yearComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         // Get the selected year.
         YearEnum yearEnum = (YearEnum)this.yearComboBox.SelectedItem;
         this.selectedYear      = YearType.ChooseYear(yearEnum);
         this.selectedIterator  = this.selectedYear.CreateIterator();
         this.labelYear.Content = this.selectedYear.ToString();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#12
0
        /// <summary>
        /// Gibt die Summe der Wertbeträge bei den Buchungen zurück
        /// </summary>
        /// <param name="isRevenue">Boolean Wert ob es sich um eine Ein- oder Ausgabe handelt</param>
        /// <param name="yearType">Typ ob es ein gegenwärtiger oder vergangener Wert ist</param>
        /// <returns>Summe aller Ein- oder Ausgaben</returns>
        public static double GetAmountSum(YearType yearType = YearType.Current)
        {
            using (TafelModelContainer db = new TafelModelContainer())
            {
                int year = (yearType == YearType.Current) ? DateTime.Now.Year : DateTime.Now.Year - 1;
                var startDate = new DateTime(year, 1, 1);
                var endDate = new DateTime(year, 12, 31);

                var additionalRecords = db.Bookings.Where(b => b.Date >= startDate
                                           && b.Date <= endDate);

                if (additionalRecords.Any())
                    return additionalRecords.Sum(ar => ar.Amount);
                return 0;
            }
        }
示例#13
0
        /// <summary>
        /// Gibt die Summe der Wertbeträge bei den Buchungen zurück
        /// </summary>
        /// <param name="isRevenue">Boolean Wert ob es sich um eine Ein- oder Ausgabe handelt</param>
        /// <param name="yearType">Typ ob es ein gegenwärtiger oder vergangener Wert ist</param>
        /// <returns>Summe aller Ein- oder Ausgaben</returns>
        public static double GetAmountSum(YearType yearType = YearType.Current)
        {
            using (TafelModelContainer db = new TafelModelContainer())
            {
                int year      = (yearType == YearType.Current) ? DateTime.Now.Year : DateTime.Now.Year - 1;
                var startDate = new DateTime(year, 1, 1);
                var endDate   = new DateTime(year, 12, 31);

                var additionalRecords = db.Bookings.Where(b => b.Date >= startDate &&
                                                          b.Date <= endDate);

                if (additionalRecords.Any())
                {
                    return(additionalRecords.Sum(ar => ar.Amount));
                }
                return(0);
            }
        }
示例#14
0
        public FuzzyDate(YearType type, int year)
        {
            switch (type)
            {
            case YearType.Start:
                startDate = new DateTime(year, 1, 1);
                endDate   = new DateTime(year, 4, 30);
                break;

            case YearType.Halfway:
                startDate = new DateTime(year, 5, 1);
                endDate   = new DateTime(year, 8, 31);
                break;

            case YearType.End:
                startDate = new DateTime(year, 9, 1);
                endDate   = new DateTime(year, 12, 31);
                break;
            }
        }
示例#15
0
        // ----------------------------------------------------------------------
        public TimeCalendar( TimeCalendarConfig config )
        {
            if ( config.StartOffset < TimeSpan.Zero )
            {
                throw new ArgumentOutOfRangeException( "config" );
            }
            if ( config.EndOffset > TimeSpan.Zero )
            {
                throw new ArgumentOutOfRangeException( "config" );
            }

            culture = config.Culture ?? Thread.CurrentThread.CurrentCulture;
            yearType = config.YearType.HasValue ? config.YearType.Value : YearType.SystemYear;
            startOffset = config.StartOffset.HasValue ? config.StartOffset.Value : DefaultStartOffset;
            endOffset = config.EndOffset.HasValue ? config.EndOffset.Value : DefaultEndOffset;
            yearBaseMonth = config.YearBaseMonth.HasValue ? config.YearBaseMonth.Value : TimeSpec.CalendarYearStartMonth;
            yearWeekType = config.YearWeekType.HasValue ? config.YearWeekType.Value : YearWeekType.Calendar;
            dayNameType = config.DayNameType.HasValue ? config.DayNameType.Value : CalendarNameType.Full;
            monthNameType = config.MonthNameType.HasValue ? config.MonthNameType.Value : CalendarNameType.Full;
        }
        public YearType GetDetails(int yearTypeID)
        {
            YearType yearType = new YearType();

            SqlParameter[] parametersYearType = new SqlParameter[]
            {
                new SqlParameter("@YearTypeID", yearTypeID)
            };
            using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("YearType_GetDetails", CommandType.StoredProcedure, parametersYearType))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];

                    yearType.YearTypeID = (row["YearTypeID"] != DBNull.Value) ? Convert.ToInt32(row["YearTypeID"]) : 0;
                    yearType.Title      = row["Title"].ToString();
                }
            }

            return(yearType);
        }
        public List <YearType> GetListAll()
        {
            List <YearType> listYearType = null;

            using (DataTable table = SqlDBHelper.ExecuteSelectCommand("YearType_GetListAll", CommandType.StoredProcedure))
            {
                if (table.Rows.Count > 0)
                {
                    listYearType = new List <YearType>();

                    foreach (DataRow row in table.Rows)
                    {
                        YearType yearType = new YearType();
                        yearType.YearTypeID = (row["YearTypeID"] != DBNull.Value) ? Convert.ToInt32(row["YearTypeID"]) : 0;
                        yearType.Title      = row["Title"].ToString();
                        listYearType.Add(yearType);
                    }
                }
            }

            return(listYearType);
        }
示例#18
0
        /// <summary>
        /// Indique si l'année spécifiée est du type spécifié
        /// </summary>
        /// <param name="year">Année</param>
        /// <param name="yearType">Type d'année à vérifier</param>
        /// <returns></returns>
        public static bool IsYearType(int year, YearType yearType)
        {
            switch (yearType)
            {
            case YearType.none:
                return(true);

            case YearType.even:
                return((year % 2) == 0);

            case YearType.odd:
                return((year % 2) == 1);

            // The rule applies in U.S. Presidential election years
            case YearType.uspres:
                return((year % 4) == 0);

            // The rule applies in years other than U.S. Presidential election years
            case YearType.nonpres:
            case YearType.nonuspres:
                return((year % 4) != 0);
            }
            return(false);
        }
示例#19
0
 /// <summary>
 /// Set the system efficiency for a particular month.
 /// The efficiencies are specified with month 0 being January. </summary>
 /// <param name="index"> month index (0=January). </param>
 /// <param name="diveff"> monthly efficiency </param>
 /// <param name="yeartype"> The year type for the diversion stations file (consistent with
 /// the control file for a full data set). </param>
 public virtual void setDiveff(int index, double diveff, YearType yeartype)
 { // Adjust the index if necessary based on the year type...
     if (yeartype == null)
     {
         // Assume calendar.
     }
     else if (yeartype == YearType.WATER)
     {
         index = TimeUtil.convertCalendarMonthToCustomMonth((index + 1), 10) - 1;
     }
     else if (yeartype == YearType.NOV_TO_OCT)
     {
         index = TimeUtil.convertCalendarMonthToCustomMonth((index + 1), 11) - 1;
     }
     if (_diveff[index] != diveff)
     {
         _diveff[index] = diveff;
         setDirty(true);
         if (!_isClone && _dataset != null)
         {
             _dataset.setDirty(StateMod_DataSet.COMP_DIVERSION_STATIONS, true);
         }
     }
 }
示例#20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string yearTypeID = Request.QueryString["yearTypeID"] as string;

        if (yearTypeID == null)
        {
            Response.Redirect("Z_YearTypeDefault.aspx");
        }

        try
        {
            yearTypeYearTypeID = Convert.ToInt32(yearTypeID.Trim());
            yearTypeHandler    = new YearTypeHandler();

            YearType yearType = yearTypeHandler.GetDetails(yearTypeYearTypeID);

            lblYearTypeID.Text = yearType.YearTypeID.ToString();
            lblTitle.Text      = yearType.Title.ToString();
        }
        catch (Exception)
        {
            Response.Redirect("Z_YearTypeDefault.aspx");
        }
    }
示例#21
0
 /// <summary>
 /// Elément de syntax pour gérer le type d'année pris en charge.
 /// </summary>
 /// <param name="year">Type de l'année.</param>
 /// <returns>L'élément de syntax <see cref="InYear"/> pour ajouter d'autres comportements.</returns>
 public InYear In(YearType year) => new InYear(this, year);
示例#22
0
 /// <summary>
 /// Indique si l'année spécifiée est du type spécifié
 /// </summary>
 /// <param name="year">Année</param>
 /// <param name="yearType">Type d'année à vérifier</param>
 /// <returns></returns>
 public static bool IsYearType(int year, YearType yearType)
 {
     switch (yearType) {
         case YearType.none:
             return true;
         case YearType.even:
             return (year % 2) == 0;
         case YearType.odd:
             return (year % 2) == 1;
         // The rule applies in U.S. Presidential election years
         case YearType.uspres:
             return (year % 4) == 0;
         // The rule applies in years other than U.S. Presidential election years
         case YearType.nonpres:
         case YearType.nonuspres:
             return (year % 4) != 0;
     }
     return false;
 }
示例#23
0
 /// <summary>
 /// Initialise une nouvelle instance de la classe <see cref="InYear"/>.
 /// </summary>
 /// <param name="parent">Elément de syntax parent.</param>
 /// <param name="year">Type de l'année.</param>
 public InYear(ExpressionElement parent, YearType year) : base(parent) => Year = year;
示例#24
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void saveComponent(RTi.Util.IO.DataSetComponent comp, String oldFilename,String newFilename, java.util.List<String> comments) throws Exception
        private void saveComponent(DataSetComponent comp, string oldFilename, string newFilename, IList <string> comments)
        {
            bool   daily = false;
            int    type  = comp.getComponentType();
            object data  = comp.getData();
            string name  = null;

            switch (type)
            {
            ////////////////////////////////////////////////////////
            // StateMod_* classes
            case StateMod_DataSet.COMP_CONTROL:
                StateMod_DataSet.writeStateModControlFile(__dataset, oldFilename, newFilename, comments);
                name = "Control";
                break;

            case StateMod_DataSet.COMP_DELAY_TABLES_DAILY:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_DelayTable> delayTablesDaily = (java.util.List<StateMod_DelayTable>)data;
                IList <StateMod_DelayTable> delayTablesDaily = (IList <StateMod_DelayTable>)data;
                StateMod_DelayTable.writeStateModFile(oldFilename, newFilename, delayTablesDaily, comments, __dataset.getInterv(), -1);
                name = "Delay Tables Daily";
                break;

            case StateMod_DataSet.COMP_DELAY_TABLES_MONTHLY:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_DelayTable> delayTablesMonthly = (java.util.List<StateMod_DelayTable>)data;
                IList <StateMod_DelayTable> delayTablesMonthly = (IList <StateMod_DelayTable>)data;
                StateMod_DelayTable.writeStateModFile(oldFilename, newFilename, delayTablesMonthly, comments, __dataset.getInterv(), -1);
                name = "Delay Tables Monthly";
                break;

            case StateMod_DataSet.COMP_DIVERSION_STATIONS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Diversion> diversionStations = (java.util.List<StateMod_Diversion>)data;
                IList <StateMod_Diversion> diversionStations = (IList <StateMod_Diversion>)data;
                StateMod_Diversion.writeStateModFile(oldFilename, newFilename, diversionStations, comments, daily);
                name = "Diversion";
                break;

            case StateMod_DataSet.COMP_DIVERSION_RIGHTS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_DiversionRight> diversionRights = (java.util.List<StateMod_DiversionRight>)data;
                IList <StateMod_DiversionRight> diversionRights = (IList <StateMod_DiversionRight>)data;
                StateMod_DiversionRight.writeStateModFile(oldFilename, newFilename, diversionRights, comments, daily);
                name = "Diversion Rights";
                break;

            case StateMod_DataSet.COMP_INSTREAM_STATIONS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_InstreamFlow> instreamFlow = (java.util.List<StateMod_InstreamFlow>)data;
                IList <StateMod_InstreamFlow> instreamFlow = (IList <StateMod_InstreamFlow>)data;
                StateMod_InstreamFlow.writeStateModFile(oldFilename, newFilename, instreamFlow, comments, daily);
                name = "Instream";
                break;

            case StateMod_DataSet.COMP_INSTREAM_RIGHTS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_InstreamFlowRight> instreamFlowRights = (java.util.List<StateMod_InstreamFlowRight>)data;
                IList <StateMod_InstreamFlowRight> instreamFlowRights = (IList <StateMod_InstreamFlowRight>)data;
                StateMod_InstreamFlowRight.writeStateModFile(oldFilename, newFilename, instreamFlowRights, comments);
                name = "Instream Rights";
                break;

            case StateMod_DataSet.COMP_OPERATION_RIGHTS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_OperationalRight> operationalRights = (java.util.List<StateMod_OperationalRight>)data;
                IList <StateMod_OperationalRight> operationalRights = (IList <StateMod_OperationalRight>)data;
                // 2 is the file version (introduced for StateMod version 12 change)
                StateMod_OperationalRight.writeStateModFile(oldFilename, newFilename, 2, operationalRights, comments, __dataset);
                name = "Operational Rights";
                break;

            case StateMod_DataSet.COMP_PLANS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Plan> planStations = (java.util.List<StateMod_Plan>)data;
                IList <StateMod_Plan> planStations = (IList <StateMod_Plan>)data;
                StateMod_Plan.writeStateModFile(oldFilename, newFilename, planStations, comments);
                name = "Plan";
                break;

            case StateMod_DataSet.COMP_RESERVOIR_STATIONS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Reservoir> reservoirStations = (java.util.List<StateMod_Reservoir>)data;
                IList <StateMod_Reservoir> reservoirStations = (IList <StateMod_Reservoir>)data;
                StateMod_Reservoir.writeStateModFile(oldFilename, newFilename, reservoirStations, comments, daily);
                name = "Reservoir";
                break;

            case StateMod_DataSet.COMP_RESERVOIR_RIGHTS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_ReservoirRight> reservoirRights = (java.util.List<StateMod_ReservoirRight>)data;
                IList <StateMod_ReservoirRight> reservoirRights = (IList <StateMod_ReservoirRight>)data;
                StateMod_ReservoirRight.writeStateModFile(oldFilename, newFilename, reservoirRights, comments);
                name = "Reservoir Rights";
                break;

            case StateMod_DataSet.COMP_RESPONSE:
                StateMod_DataSet.writeStateModFile(__dataset, oldFilename, newFilename, comments);
                name = "Response";
                break;

            case StateMod_DataSet.COMP_RIVER_NETWORK:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_RiverNetworkNode> riverNodes = (java.util.List<StateMod_RiverNetworkNode>)data;
                IList <StateMod_RiverNetworkNode> riverNodes = (IList <StateMod_RiverNetworkNode>)data;
                StateMod_RiverNetworkNode.writeStateModFile(oldFilename, newFilename, riverNodes, comments, true);
                name = "River Network";
                break;

            case StateMod_DataSet.COMP_STREAMESTIMATE_STATIONS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamEstimate> streamEstimateStations = (java.util.List<StateMod_StreamEstimate>)data;
                IList <StateMod_StreamEstimate> streamEstimateStations = (IList <StateMod_StreamEstimate>)data;
                StateMod_StreamEstimate.writeStateModFile(oldFilename, newFilename, streamEstimateStations, comments, daily);
                name = "Stream Estimate";
                break;

            case StateMod_DataSet.COMP_STREAMESTIMATE_COEFFICIENTS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamEstimate_Coefficients> streamEstimateCoefficients = (java.util.List<StateMod_StreamEstimate_Coefficients>)data;
                IList <StateMod_StreamEstimate_Coefficients> streamEstimateCoefficients = (IList <StateMod_StreamEstimate_Coefficients>)data;
                StateMod_StreamEstimate_Coefficients.writeStateModFile(oldFilename, newFilename, streamEstimateCoefficients, comments);
                name = "Stream Estimate Coefficients";
                break;

            case StateMod_DataSet.COMP_STREAMGAGE_STATIONS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_StreamGage> streamGageStations = (java.util.List<StateMod_StreamGage>)data;
                IList <StateMod_StreamGage> streamGageStations = (IList <StateMod_StreamGage>)data;
                StateMod_StreamGage.writeStateModFile(oldFilename, newFilename, streamGageStations, comments, daily);
                name = "Streamgage Stations";
                break;

            case StateMod_DataSet.COMP_WELL_STATIONS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_Well> wellStations = (java.util.List<StateMod_Well>)data;
                IList <StateMod_Well> wellStations = (IList <StateMod_Well>)data;
                StateMod_Well.writeStateModFile(oldFilename, newFilename, wellStations, comments);
                name = "Well";
                break;

            case StateMod_DataSet.COMP_WELL_RIGHTS:
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<StateMod_WellRight> wellRights = (java.util.List<StateMod_WellRight>)data;
                IList <StateMod_WellRight> wellRights = (IList <StateMod_WellRight>)data;
                StateMod_WellRight.writeStateModFile(oldFilename, newFilename, wellRights, comments, (PropList)null);
                name = "Well Rights";
                break;

            //////////////////////////////////////////////////////
            // StateMod Time Series
            case StateMod_DataSet.COMP_CONSUMPTIVE_WATER_REQUIREMENT_TS_DAILY:
            case StateMod_DataSet.COMP_CONSUMPTIVE_WATER_REQUIREMENT_TS_MONTHLY:
            case StateMod_DataSet.COMP_DEMAND_TS_DAILY:
            case StateMod_DataSet.COMP_DEMAND_TS_AVERAGE_MONTHLY:
            case StateMod_DataSet.COMP_DEMAND_TS_MONTHLY:
            case StateMod_DataSet.COMP_DEMAND_TS_OVERRIDE_MONTHLY:
            case StateMod_DataSet.COMP_DIVERSION_TS_DAILY:
            case StateMod_DataSet.COMP_DIVERSION_TS_MONTHLY:
            case StateMod_DataSet.COMP_EVAPORATION_TS_MONTHLY:
            case StateMod_DataSet.COMP_INSTREAM_DEMAND_TS_AVERAGE_MONTHLY:
            case StateMod_DataSet.COMP_INSTREAM_DEMAND_TS_DAILY:
            case StateMod_DataSet.COMP_INSTREAM_DEMAND_TS_MONTHLY:
            case StateMod_DataSet.COMP_PRECIPITATION_TS_MONTHLY:
            case StateMod_DataSet.COMP_RESERVOIR_CONTENT_TS_DAILY:
            case StateMod_DataSet.COMP_RESERVOIR_CONTENT_TS_MONTHLY:
            case StateMod_DataSet.COMP_RESERVOIR_TARGET_TS_DAILY:
            case StateMod_DataSet.COMP_RESERVOIR_TARGET_TS_MONTHLY:
            case StateMod_DataSet.COMP_STREAMESTIMATE_NATURAL_FLOW_TS_DAILY:
            case StateMod_DataSet.COMP_STREAMESTIMATE_NATURAL_FLOW_TS_MONTHLY:
            case StateMod_DataSet.COMP_STREAMGAGE_NATURAL_FLOW_TS_DAILY:
            case StateMod_DataSet.COMP_STREAMGAGE_NATURAL_FLOW_TS_MONTHLY:
            case StateMod_DataSet.COMP_STREAMGAGE_HISTORICAL_TS_DAILY:
            case StateMod_DataSet.COMP_STREAMGAGE_HISTORICAL_TS_MONTHLY:
            case StateMod_DataSet.COMP_WELL_DEMAND_TS_DAILY:
            case StateMod_DataSet.COMP_WELL_DEMAND_TS_MONTHLY:
            case StateMod_DataSet.COMP_WELL_PUMPING_TS_DAILY:
            case StateMod_DataSet.COMP_WELL_PUMPING_TS_MONTHLY:
                double   missing  = -999.0;
                YearType yearType = null;
                if (__dataset.getCyrl() == YearType.CALENDAR)
                {
                    yearType = YearType.CALENDAR;
                }
                else if (__dataset.getCyrl() == YearType.WATER)
                {
                    yearType = YearType.WATER;
                }
                else if (__dataset.getCyrl() == YearType.NOV_TO_OCT)
                {
                    yearType = YearType.NOV_TO_OCT;
                }
                int precision = 2;

                // Do the following to avoid warnings
                IList <TS> tslist = null;
                if (data != null)
                {
//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> tslist0 = (java.util.List<RTi.TS.TS>)data;
                    IList <TS> tslist0 = (IList <TS>)data;
                    if (tslist0.Count > 0)
                    {
                        TS ts = tslist0[0];
                        missing = ts.getMissing();
                    }
                    tslist = tslist0;
                }

                StateMod_TS.writeTimeSeriesList(oldFilename, newFilename, comments, tslist, null, null, yearType, missing, precision);
                name = "TS (" + type + ")";
                break;

            default:
                name = "(something: " + type + ")";
                break;
            }
            comp.setDirty(false);
            Message.printStatus(1, "", "Component '" + name + "' written");
        }
示例#25
0
        /// <summary>
        /// Gibt die Summe der Ein- oder Ausgabe zurück
        /// </summary>
        /// <param name="isRevenue">Ob es sich um eine Ein- oder Ausgabe handelt</param>
        /// <param name="type">Gegenwart oder Vergangenheit</param>
        /// <returns>Die Summe der Beträge</returns>
        public static double GetSum(bool isRevenue, YearType type = YearType.Current)
        {
            var date = DateTime.Now;
            if (type == YearType.Past)
            {
                date = date.AddYears(-1);
            }

            var startDate = new DateTime(date.Year, 1, 1);
            var endDate = new DateTime(date.Year, 12, 31);

            using (var db = new TafelModelContainer())
            {
                var cashClosures = db.CashClosures
                    .Where(cc => cc.ClosureDate >= startDate
                        && cc.ClosureDate <= endDate);
                if (cashClosures.Any())
                {
                    if (isRevenue)
                        return cashClosures.Sum(cc => cc.Revenue);
                    else
                        return cashClosures.Sum(cc => cc.Expense);
                }
                return 0;
            }
        }