Esempio n. 1
0
 /// <summary>
 /// Parent constructor
 /// </summary>
 /// <param name="year">year</param>
 /// <param name="periodNo">no</param>
 /// <param name="name">name</param>
 /// <param name="startDate">start</param>
 /// <param name="endDate">end</param>
 public MPeriod(MYear year, int periodNo, String name, DateTime?startDate, DateTime?endDate)
     : this(year.GetCtx(), 0, year.Get_TrxName())
 {
     SetClientOrg(year);
     SetC_Year_ID(year.GetC_Year_ID());
     SetPeriodNo(periodNo);
     SetName(name);
     SetStartDate(startDate);
     SetEndDate(endDate);
 }
Esempio n. 2
0
        /// <summary>
        /// Create (current) Calendar Year
        /// </summary>
        /// <param name="locale">locale</param>
        /// <returns>The Year</returns>
        //public MYear CreateYear(Locale locale)
        public MYear CreateYear(CultureInfo locale)
        {
            if (Get_ID() == 0)
            {
                return(null);
            }
            MYear year = new MYear(this);

            if (year.Save())
            {
                year.CreateStdPeriods(locale);
            }
            //
            return(year);
        }
Esempio n. 3
0
 /// <summary>
 /// Get Calendar of Period
 /// </summary>
 /// <returns>calendar</returns>
 public int GetC_Calendar_ID()
 {
     if (C_Calendar_ID == 0)
     {
         MYear year = MYear.Get(GetCtx(), GetC_Year_ID());
         if (year != null)
         {
             C_Calendar_ID = year.GetC_Calendar_ID();
         }
         else
         {
             log.Severe("@NotFound@ C_Year_ID=" + GetC_Year_ID());
         }
     }
     return(C_Calendar_ID);
 }
        /// <summary>
        /// Get Year
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="C_Year_ID"></param>
        /// <returns>year or null</returns>
        /// <date>07-march-2011</date>
        /// <writer>raghu</writer>
        public static MYear Get(Ctx ctx, int C_Year_ID)
        {
            MYear year = _years.Get(ctx, C_Year_ID);

            if (year != null)
            {
                return(year);
            }
            //
            String      sql = "SELECT * FROM C_Year WHERE C_Year_ID=" + C_Year_ID;
            IDataReader idr = null;

            try
            {
                idr = DB.ExecuteReader(sql, null);
                DataTable dt = new DataTable();
                dt.Load(idr);
                idr.Close();

                if (dt.Rows.Count > 0)  //	first only
                {
                    year = new MYear(ctx, dt.Rows[0], null);
                }
            }
            catch (Exception e)
            {
                s_log.Log(Level.SEVERE, sql, e);
            }
            finally
            {
                if (idr != null)
                {
                    idr.Close();
                    idr = null;
                }
            }
            return(year);
        }