Example #1
0
		///<summary></summary>
		public static long Insert(Employer Cur) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Cur.EmployerNum=Meth.GetLong(MethodBase.GetCurrentMethod(),Cur);
				return Cur.EmployerNum;
			}
			return Crud.EmployerCrud.Insert(Cur);
		}
Example #2
0
		/*
		 * Not using this because it turned out to be more efficient to refresh the whole
		 * list if an empnum could not be found.
		///<summary>Just refreshes Cur from the db with info for one employer.</summary>
		public static void Refresh(int employerNum){
			Cur=new Employer();//just in case no rows are returned
			if(employerNum==0) return;
			string command="SELECT * FROM employer WHERE EmployerNum = '"+employerNum+"'";
			DataTable table=Db.GetTable(command);;
			for(int i=0;i<table.Rows.Count;i++){//almost always just 1 row, but sometimes 0
				Cur.EmployerNum   =PIn.PInt   (table.Rows[i][0].ToString());
				Cur.EmpName       =PIn.PString(table.Rows[i][1].ToString());
			}
		}*/

		///<summary></summary>
		public static void Update(Employer Cur){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),Cur);
				return;
			}
			Crud.EmployerCrud.Update(Cur);
		}
Example #3
0
		private void FormTrojanCollect_Load(object sender,EventArgs e) {
			patCur=Patients.GetPat(PatNum);
			guarCur=Patients.GetPat(patCur.Guarantor);
			if(guarCur.EmployerNum==0){
				empCur=null;
			}
			else{
				empCur=Employers.GetEmployer(guarCur.EmployerNum);
			}
			if(guarCur.LName.Length==0){
				MessageBox.Show("Missing guarantor last name.");
				DialogResult=DialogResult.Cancel;
				return;
			}
			if(guarCur.FName.Length==0) {
				MessageBox.Show("Missing guarantor first name.");
				DialogResult=DialogResult.Cancel;
				return;
			}
			if(!Regex.IsMatch(guarCur.SSN,@"^\d{9}$")) {
				MessageBox.Show("Guarantor SSN must be exactly 9 digits.");
				DialogResult=DialogResult.Cancel;
				return;
			}
			if(guarCur.Address.Length==0) {
				MessageBox.Show("Missing guarantor address.");
				DialogResult=DialogResult.Cancel;
				return;
			}
			if(guarCur.City.Length==0) {
				MessageBox.Show("Missing guarantor city.");
				DialogResult=DialogResult.Cancel;
				return;
			}
			if(guarCur.State.Length!=2) {
				MessageBox.Show("Guarantor state must be 2 characters.");
				DialogResult=DialogResult.Cancel;
				return;
			}
			if(guarCur.Zip.Length<5) {
				MessageBox.Show("Invalid guarantor zip.");
				DialogResult=DialogResult.Cancel;
				return;
			}
			labelGuarantor.Text=guarCur.GetNameFL();
			labelAddress.Text=guarCur.Address;
			if(guarCur.Address2!=""){
				labelAddress.Text+=", "+guarCur.Address2;
			}
			labelCityStZip.Text=guarCur.City+", "+guarCur.State+" "+guarCur.Zip;
			labelSSN.Text=guarCur.SSN.Substring(0,3)+"-"+guarCur.SSN.Substring(3,2)+"-"+guarCur.SSN.Substring(5,4);
			if(guarCur.Birthdate.Year<1880){
				labelDOB.Text="";
			}
			else{
				labelDOB.Text=guarCur.Birthdate.ToString("MM/dd/yyyy");
			}
			labelPhone.Text=Clip(guarCur.HmPhone,13);
			if(empCur==null){
				labelEmployer.Text="";
				labelEmpPhone.Text="";
			}
			else{
				labelEmployer.Text=empCur.EmpName;
				labelEmpPhone.Text=empCur.Phone;
			}
			labelPatient.Text=patCur.GetNameFL();
			DataTable table=TrojanQueries.GetMaxProcedureDate(guarCur.PatNum);
			DateTime lastProcDate;
			if(table.Rows.Count==0){
				lastProcDate=DateTime.MinValue;//this should never happen
			}
			else{
				lastProcDate=PIn.Date(table.Rows[0][0].ToString());
			}
			table=TrojanQueries.GetMaxPaymentDate(guarCur.PatNum);
			DateTime lastPayDate;
			if(table.Rows.Count==0) {
				lastPayDate=DateTime.MinValue;
			}
			else {
				lastPayDate=PIn.Date(table.Rows[0][0].ToString());
			}
			if(lastPayDate>lastProcDate){
				textDate.Text=lastPayDate.ToString("MM/dd/yyyy");
			}
			else{
				textDate.Text=lastProcDate.ToString("MM/dd/yyyy");
			}
			textAmount.Text=guarCur.BalTotal.ToString("F2");
			textPassword.Text=PrefC.GetString(PrefName.TrojanExpressCollectPassword);
		}
Example #4
0
		///<summary>There MUST not be any dependencies before calling this or there will be invalid foreign keys.  This is only called from FormEmployers after proper validation.</summary>
		public static void Delete(Employer Cur){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),Cur);
				return;
			}
			string command="DELETE from employer WHERE EmployerNum = '"+Cur.EmployerNum.ToString()+"'";
			Db.NonQ(command);
		}
Example #5
0
		///<summary>Gets an employerNum from the database based on the supplied name.  If that empName does not exist, then a new employer is created, and the employerNum for the new employer is returned.</summary>
		public static long GetEmployerNum(string empName) {
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				return Meth.GetLong(MethodBase.GetCurrentMethod(),empName);
			}
			if(empName==""){
				return 0;
			}
			string command="SELECT EmployerNum FROM employer" 
				+" WHERE EmpName = '"+POut.String(empName)+"'";
			DataTable table=Db.GetTable(command);
			if(table.Rows.Count>0){
				return PIn.Long(table.Rows[0][0].ToString());
			}
			Employer Cur=new Employer();
			Cur.EmpName=empName;
			Insert(Cur);
			//MessageBox.Show(Cur.EmployerNum.ToString());
			return Cur.EmployerNum;
		}
Example #6
0
		///<summary>Returns a list of insplans that are dependent on the Cur employer. The list includes carriage returns for easy display.  Used before deleting an employer to make sure employer is not in use.</summary>
		public static string DependentInsPlans(Employer Cur){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				return Meth.GetString(MethodBase.GetCurrentMethod(),Cur);
			}
			string command="SELECT carrier.CarrierName,CONCAT(CONCAT(patient.LName,', '),patient.FName) "
				+"FROM insplan "
				+"LEFT JOIN inssub ON insplan.PlanNum=inssub.PlanNum "
				+"LEFT JOIN patient ON inssub.Subscriber=patient.PatNum "
				+"LEFT JOIN carrier ON insplan.CarrierNum=carrier.CarrierNum "
				+"WHERE insplan.EmployerNum = "+POut.Long(Cur.EmployerNum);
			DataTable table=Db.GetTable(command);
			string retStr="";
			for(int i=0;i<table.Rows.Count;i++){
				if(i>0){
					retStr+="\r\n";//return, newline for multiple names.
				}
				retStr+=PIn.String(table.Rows[i][1].ToString())+": "+PIn.String(table.Rows[i][0].ToString());
			}
			return retStr;
		}
Example #7
0
		///<summary>Returns a list of patients that are dependent on the Cur employer. The list includes carriage returns for easy display.  Used before deleting an employer to make sure employer is not in use.</summary>
		public static string DependentPatients(Employer Cur){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				return Meth.GetString(MethodBase.GetCurrentMethod(),Cur);
			}
			string command="SELECT CONCAT(CONCAT(LName,', '),FName) FROM patient" 
				+" WHERE EmployerNum = '"+POut.Long(Cur.EmployerNum)+"'";
			DataTable table=Db.GetTable(command);
			string retStr="";
			for(int i=0;i<table.Rows.Count;i++){
				if(i>0){
					retStr+="\r\n";//return, newline for multiple names.
				}
				retStr+=PIn.String(table.Rows[i][0].ToString());
			}
			return retStr;
		}
Example #8
0
		private int CompareEmployers(Employer emp1,Employer emp2) {
			return emp1.EmpName.CompareTo(emp2.EmpName);
		}