///<summary></summary> public static void Update(PayPeriod pp) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),pp); return; } Crud.PayPeriodCrud.Update(pp); }
///<summary></summary> public static long Insert(PayPeriod pp) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { pp.PayPeriodNum=Meth.GetLong(MethodBase.GetCurrentMethod(),pp); return pp.PayPeriodNum; } return Crud.PayPeriodCrud.Insert(pp); }
/// <summary>Returns existing payperiod if it exists, otherwise inserts and returns a new payperiod. Throws exception if payperiod overlaps existing payperiod.</summary> public static PayPeriod CreateTwoWeekPayPeriodIfNotExists(DateTime start){ PayPeriod ppNew=new PayPeriod(); ppNew.DateStart=start; ppNew.DateStop=start.AddDays(13); ppNew.DatePaycheck=start.AddDays(16); //check for identical or overlapping pay periods PayPeriods.RefreshCache(); foreach(PayPeriod ppInDb in PayPeriods.List) { if(ppInDb.DateStart == ppNew.DateStart && ppInDb.DateStop == ppNew.DateStop && ppInDb.DatePaycheck == ppNew.DatePaycheck){ //identical pay period already exists. return ppInDb; } //if(pp.DateStart == payP.DateStart && pp.DateStop == payP.DateStop && pp.DatePaycheck != payP.DatePaycheck) { // //identical pay period already exists, just with a different pay check date. // //This is a seperate check because it may be important in the future. // continue; //} if(ppInDb.DateStop > ppNew.DateStart && ppInDb.DateStart < ppNew.DateStop) { //pay periods overlap throw new Exception("Error inserting pay period. New Pay period overlaps existing pay period.\r\n"); } } PayPeriods.Insert(ppNew); return ppNew; }
///<summary></summary> public static void Delete(PayPeriod pp) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),pp); return; } string command= "DELETE FROM payperiod WHERE PayPeriodNum = "+POut.Long(pp.PayPeriodNum); Db.NonQ(command); }
///<summary></summary> public FormPayPeriodEdit(PayPeriod payPeriodCur) { // // Required for Windows Form Designer support // PayPeriodCur=payPeriodCur; InitializeComponent(); Lan.F(this); }
private void butAdd_Click(object sender, System.EventArgs e) { PayPeriod payPeriodCur=new PayPeriod(); if(PayPeriods.List.Length==0){ payPeriodCur.DateStart=DateTime.Today; } else{ payPeriodCur.DateStart=PayPeriods.List[PayPeriods.List.Length-1].DateStop.AddDays(1); } payPeriodCur.DateStop=payPeriodCur.DateStart.AddDays(14); payPeriodCur.DatePaycheck=payPeriodCur.DateStop.AddDays(4); FormPayPeriodEdit FormP=new FormPayPeriodEdit(payPeriodCur); FormP.IsNew=true; FormP.ShowDialog(); if(FormP.DialogResult==DialogResult.Cancel){ return; } FillGrid(); changed=true; }
private void butAdd_Click(object sender, System.EventArgs e) { PayPeriod payPeriodCur=new PayPeriod(); if(PayPeriods.List.Length==0){ payPeriodCur.DateStart=DateTime.Today; } else{ payPeriodCur.DateStart=PayPeriods.List[PayPeriods.List.Length-1].DateStop.AddDays(1); } payPeriodCur.DateStop=payPeriodCur.DateStart.AddDays(13);//payPeriodCur.DateStop is inclusive, this is effectively a 14 day default pay period. This only affects default date of newly created pay periods. payPeriodCur.DatePaycheck=payPeriodCur.DateStop.AddDays(4); FormPayPeriodEdit FormP=new FormPayPeriodEdit(payPeriodCur); FormP.IsNew=true; FormP.ShowDialog(); if(FormP.DialogResult==DialogResult.Cancel){ return; } FillGrid(); changed=true; }