Example #1
0
		///<summary>We want to find the first day of the oldest quarter less than or equal to one year old from the latest entered valid key.  validKeys must be sorted ascending.</summary>
		public static DateTime FindStartDate(List<EhrQuarterlyKey> validKeys) {
			//No need to check RemotingRole; no call to db.
			if(validKeys.Count<1) {
				return new DateTime(DateTime.Today.Year,1,1);
			}
			EhrQuarterlyKey ehrKey=validKeys[validKeys.Count-1];
			DateTime latestReportDate=GetLastDayOfQuarter(ehrKey);
			DateTime earliestStartDate=latestReportDate.AddYears(-1).AddDays(1);
			for(int i=validKeys.Count-1;i>-1;i--) {
				ehrKey=validKeys[i];
				if(i==0) {
					break;
				}
				int expectedPrevQuarter=validKeys[i].QuarterValue-1; 
				if(validKeys[i].QuarterValue==1) {
					expectedPrevQuarter=4;
				}
				int prevQuarter=validKeys[i-1].QuarterValue;
				int expectedYear=validKeys[i].YearValue;
				if(validKeys[i].QuarterValue==1) {
					expectedYear=validKeys[i].YearValue-1;
				}
				int prevQuarter_Year=validKeys[i-1].YearValue;
				if(expectedPrevQuarter!=prevQuarter || expectedYear!=prevQuarter_Year) {//There is an quarterly key gap, so we ignore any older quarterly keys.
					break;
				}
				DateTime prevQuarterFirstDay=GetFirstDayOfQuarter(validKeys[i-1]);
				if(prevQuarterFirstDay<earliestStartDate) {
					break;
				}
			}
			return GetFirstDayOfQuarter(ehrKey);
		}
Example #2
0
		///<summary></summary>
		public static long Insert(EhrQuarterlyKey ehrQuarterlyKey){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
				ehrQuarterlyKey.EhrQuarterlyKeyNum=Meth.GetLong(MethodBase.GetCurrentMethod(),ehrQuarterlyKey);
				return ehrQuarterlyKey.EhrQuarterlyKeyNum;
			}
			return Crud.EhrQuarterlyKeyCrud.Insert(ehrQuarterlyKey);
		}
Example #3
0
		///<summary></summary>
		public static void Update(EhrQuarterlyKey ehrQuarterlyKey){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
				Meth.GetVoid(MethodBase.GetCurrentMethod(),ehrQuarterlyKey);
				return;
			}
			Crud.EhrQuarterlyKeyCrud.Update(ehrQuarterlyKey);
		}
Example #4
0
		private void butAdd_Click(object sender,EventArgs e) {
			FormEhrQuarterlyKeyEdit formE=new FormEhrQuarterlyKeyEdit();
			EhrQuarterlyKey keycur=new EhrQuarterlyKey();
			keycur.IsNew=true;
			formE.KeyCur=keycur;
			formE.ShowDialog();
			FillGrid();
		}
Example #5
0
 ///<summary></summary>
 public static void Update(EhrQuarterlyKey ehrQuarterlyKey)
 {
     if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
         Meth.GetVoid(MethodBase.GetCurrentMethod(),ehrQuarterlyKey);
         return;
     }
     Crud.EhrQuarterlyKeyCrud.Update(ehrQuarterlyKey);
 }
Example #6
0
 ///<summary></summary>
 public static long Insert(EhrQuarterlyKey ehrQuarterlyKey)
 {
     if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){
         ehrQuarterlyKey.EhrQuarterlyKeyNum=Meth.GetLong(MethodBase.GetCurrentMethod(),ehrQuarterlyKey);
         return ehrQuarterlyKey.EhrQuarterlyKeyNum;
     }
     return Crud.EhrQuarterlyKeyCrud.Insert(ehrQuarterlyKey);
 }
Example #7
0
		public static DateTime GetLastDayOfQuarter(EhrQuarterlyKey ehrKey) {
			//No need to check RemotingRole; no call to db.
			return GetLastDayOfQuarter(new DateTime(ehrKey.YearValue+2000,ehrKey.QuarterValue*3,1));
		}
Example #8
0
		public static DateTime GetLastDayOfQuarter(EhrQuarterlyKey ehrKey) {
			//No need to check RemotingRole; no call to db.
			return GetLastDayOfQuarter(new DateTime(ehrKey.YearValue+2000,ehrKey.QuarterValue*3,1));
		}