Beispiel #1
0
		///<summary>Returns number of subscribers affected.  Can throw an exception if user clicks cancel in a note box.</summary>
		private static int ProcessTrojanPlan(string trojanPlan,bool updateBenefits,bool updateNoteAutomatic){
			TrojanObject troj=ProcessTextToObject(trojanPlan);
			Carrier carrier=new Carrier();
			carrier.Phone=troj.ELIGPHONE;
			carrier.ElectID=troj.PAYERID;
			carrier.CarrierName=troj.MAILTO;
			carrier.Address=troj.MAILTOST;
			carrier.City=troj.MAILCITYONLY;
			carrier.State=troj.MAILSTATEONLY;
			carrier.Zip=troj.MAILZIPONLY;
			carrier.NoSendElect=false;//regardless of what Trojan says.  Nobody sends paper anymore.
			if(carrier.CarrierName==null || carrier.CarrierName=="") {
				//if, for some reason, carrier is absent from the file, we can't do a thing with it.
				return 0;
			}
			carrier=Carriers.GetIndentical(carrier);
			//now, save this all to the database.
			troj.CarrierNum=carrier.CarrierNum;
			InsPlan plan=TrojanQueries.GetPlanWithTrojanID(troj.TROJANID);
			if(plan==null) {
				return 0;
			}
			TrojanQueries.UpdatePlan(troj,plan.PlanNum,updateBenefits);
			plan=InsPlans.RefreshOne(plan.PlanNum);
			if(updateNoteAutomatic) {
				if(plan.PlanNote!=troj.PlanNote) {
					plan.PlanNote=troj.PlanNote;
					InsPlans.Update(plan);
				}
			}
			else {
				//let user pick note
				if(plan.PlanNote!=troj.PlanNote) {
					string[] notes=new string[2];
					notes[0]=plan.PlanNote;
					notes[1]=troj.PlanNote;
					FormNotePick FormN=new FormNotePick(notes);
					FormN.ShowDialog();
					if(FormN.DialogResult==DialogResult.OK) {
						if(plan.PlanNote!=FormN.SelectedNote) {
							plan.PlanNote=FormN.SelectedNote;
							InsPlans.Update(plan);
						}
					}
				}
			}
			return 1;
		}