コード例 #1
0
        public static DateTime ProximaFechaCalibracion(int CodInstrumento, string Estado, DateTime Fecha)
        {
            DateTime FechaP = new DateTime(1900, 01, 01);

            DataTable DT = NInstrumento.Buscar(CodInstrumento);

            string InstruFrecu = Estado == "Nuevo" ? Convert.ToString(DT.Rows[0][3]) : Convert.ToString(DT.Rows[0][4]);

            DT = NFrecuencia.Buscar(InstruFrecu);

            string sFrecu = Convert.ToString(DT.Rows[0][2]);
            int    nFrecu = Convert.ToInt32(DT.Rows[0][3]);

            if (sFrecu == "D")
            {
                FechaP = Fecha.AddDays(nFrecu);
            }
            else if (sFrecu == "M")
            {
                FechaP = Fecha.AddMonths(nFrecu);
            }

            FechaP = (int)FechaP.DayOfWeek == 0 ? FechaP.AddDays(1) :
                     (int)FechaP.DayOfWeek == 7 ? FechaP.AddDays(2) :
                     FechaP;

            return(FechaP);
        }