public void SaveHspTest() { var serviceName = "Inpatient"; HSP hsp = new HSP("1234", true) { Name = "michael", ServicesOffered = new List <string>() { serviceName }, Address = "Address", BankName = "Name", Personnel = "Contact", RoutingNum = 123456, AccountNum = 123456 }; HSP dbHsp = null; mgr.SaveHsp(hsp); if (hsp.Id > 0) { dbHsp = mgr.GrabHspById(hsp.Id); } // zero is default value for int, so make sure the id is updated Assert.IsTrue(hsp.Id > 0); Assert.IsNotNull(dbHsp); Assert.AreEqual(hsp.Name, dbHsp.Name); Assert.AreEqual(dbHsp.ServicesOffered[0], serviceName); }
private void Online(string IP) { try { int HONLCLIENT = -1, HONLCONNECTION = -1; int ret = 0; double info1 = 0; byte[] baTempInfo = new byte[1024]; double outValue = -1; ret = HSP._CD_eGateHighSpeedPort_Init(IP, 5, (int)HSP.CONNECTIONTYPE.Online, 100, ref HONLCLIENT, ref HONLCONNECTION); HSP._CD_eGateHighSpeedPort_ReadOnline_Single(HONLCONNECTION, ReadChannel, ref outValue); //Global.GenData[ReadChannel + 26] = ((rand1.Next(((int)outValue - 1), ((int)outValue + 1)))).ToString("000.0000"); //outValue.ToString("##0.0"); Global.GenData[ReadChannel + 25] = outValue.ToString("000.00000"); // (Global.RandomNumberBetween((outValue + 0.00000), (outValue - 0.00000))).ToString("000.0000"); // outValue.ToString("000.000"); // if (ReadChannel < 20) { ReadChannel++; } else { ReadChannel = 1; } } catch (Exception ex) { return; } }
public void findBillTest() { PlanController plnCtrl = new PlanController(1, "me@me", true); DbMgr dbmgr = DbMgr.Instance; DateTime date = DateTime.Now; var hsp = new HSP("1234", true); var service = new Service { Category = "Hospital", Name = "Inpatient", PercentCoverage = 0.9, RequiredCopayment = 400.0, InNetMax = new Tuple <double, Service.MaxPayRate>( 2000, Service.MaxPayRate.Day ) }; int enrolleeId = 1; String email = "me@me"; double totalBillAmount = 1000; double enrolleeBillAmount = 460; var bill = new Bill(date, hsp.Id, dbmgr.GetPlanByPrimary(enrolleeId).ElementAt(0).PlanNum, service.Id, enrolleeId, email, totalBillAmount, enrolleeBillAmount); plnCtrl.addBill(bill); var retBill = dbmgr.GetBillsById(0); Assert.AreEqual((double)1000, retBill.ElementAt(0).totalBillAmount); Assert.AreEqual((double)460, retBill.ElementAt(0).enrolleeBillAmount); Assert.AreEqual("Inpatient", dbmgr.GetServiceById(retBill.ElementAt(0).serviceId).Name); Assert.AreEqual(date.Date, retBill.ElementAt(0).date.Date); Assert.AreEqual(hsp, dbmgr.GrabHspById(retBill.ElementAt(0).hspId)); }
public void SaveBillTest() { HSP hsp = new HSP("1234", true) { Name = "zach", ServicesOffered = new List <string>() { "Inpatient" }, Address = "Address", BankName = "Name", Personnel = "Contact", RoutingNum = 123456, AccountNum = 123456 }; mgr.SaveHsp(hsp); var newDude = new PrimaryEnrollee("1234") { MailingAddr = "805 N Guest", BillingAddr = "805 N Guest", Email = "*****@*****.**", FirstName = "Guest", LastName = "Guest", HomePhone = "1234567890", MobilePhone = "1234567890", SSN = "123456788" }; var services = mgr.GetServicesByPlan("Basic"); var plan = mgr.GetPlanByType("Basic"); var ePlan = new EnrolleePlan(newDude, plan); var myId = mgr.SaveEnrollee(newDude); ePlan.PrimaryEnrollee = newDude.Id; var planNum = (int)mgr.SaveEnrolleePlan(ePlan); var bill = new Bill( DateTime.Now, hsp.Id, planNum, services.ElementAt(0).Id, newDude.Id, newDude.Email, 1000, 500 ); bill.IsPrimary = true; mgr.addBill(bill); Bill dbBill = null; dbBill = mgr.GetBillsById(newDude.Id).ElementAt(0); Assert.IsNotNull(dbBill); Assert.AreEqual(dbBill.Id, bill.Id); Assert.AreEqual(dbBill.enrolleeEmail, bill.enrolleeEmail); }
/// <summary> /// Creates a new instance of HSP and saves it into the database /// </summary> /// <param name="name"></param> /// <param name="services"></param> /// <param name="address"></param> /// <param name="phone"></param> /// <param name="pin"></param> /// <param name="netowrkStatus"></param> /// <param name="info"></param> // ReSharper disable once InconsistentNaming public int CreateHSP( string name, List <string> services, string address, string phone, string pin, bool netowrkStatus, BankInfo?info) { var phoneCheck = CheckPersonelPhone(phone); if (!phoneCheck) { throw new ArgumentException("The provided phone number should be a valid US phone number"); } this.Hsp = new HSP(pin, netowrkStatus) { Name = name, ServicesOffered = services, Address = address, Personnel = phone, RoutingNum = info.Value.Routing, AccountNum = info.Value.Account, BankName = info.Value.Name }; this._mgr.SaveHsp(this.Hsp); return(this.Hsp.Id); }
/// <summary> /// This is the default constructor for the Billing GUI. /// </summary> /// <param name="billControl"></param> public Billing(BillController billControl, HSP hsp) { this.hsp = hsp; this.billControl = billControl; billControl.setHSP(hsp); InitializeComponent(); this.errMsg.Hide(); }
/// <summary> /// Find the HSP corresponding to the companyName and try to log it in /// returns null if the login fails /// </summary> /// <param name="companyName"></param> /// <param name="pin"></param> /// <returns></returns> public HSP Login(string companyName, string pin) { HSP hsp = Mgr.GrabHspByName(companyName); // we could have not recieved an HSP back, so we need to use the // null conditional operator bool?isLogged = hsp?.Login(companyName, pin); // isLogged could be null so we need to compare it with true return((isLogged == true) ? hsp : null); }
public bool CheckHSP(String hspName) { if (Mgr.GrabHspByName(hspName) == null) { return(false); } else { hsp = Mgr.GrabHspByName(hspName); return(true); } }
public void AddCharge(DateTime date, HSP hsp, int planNum, Service service, int enrolleeId, String enrolleeEmail, double totalBillAmount, double enrolleeBillAmount) { this.planCtrl = new PlanController((int)PrimaryEnrollee, enrolleeEmail, true); var bill = new Bill(date, hsp.Id, planNum, service.Id, enrolleeId, enrolleeEmail, totalBillAmount, enrolleeBillAmount); Charges.Add(bill); APDRemainder -= enrolleeBillAmount; if (APDRemainder < 0) { APDRemainder = 0; } PYMBRemainder -= (totalBillAmount - enrolleeBillAmount); if (OPMIRemainder != 0 && OPMFRemainder != 0) { if (OPMIRemainder < enrolleeBillAmount) { TotalCost += OPMIRemainder; } else if (OPMFRemainder < enrolleeBillAmount) { TotalCost += OPMFRemainder; } else { TotalCost += (enrolleeBillAmount); } } OPMIRemainder -= (totalBillAmount - enrolleeBillAmount); if (OPMIRemainder < 0) { OPMIRemainder = 0; } OPMFRemainder -= (totalBillAmount - enrolleeBillAmount); if (OPMFRemainder < 0) { OPMFRemainder = 0; } planCtrl.addBill(bill); }
private void Init_Gantner() { int HONLCLIENT = -1, HONLCONNECTION = -1; int ret = 0; int ChannelCount = 0; double info1 = 0; byte[] baTempInfo = new byte[1024]; string strTempString = ""; double outValue = 0; string IP = "192.168.1.28"; //******************* ret = HSP._CD_eGateHighSpeedPort_Init(IP, 5, (int)HSP.CONNECTIONTYPE.Online, 100, ref HONLCLIENT, ref HONLCONNECTION); ret = HSP._CD_eGateHighSpeedPort_GetDeviceInfo(HONLCONNECTION, (int)HSP.DEVICEINFO.Address, 0, ref info1, baTempInfo); ConvertZeroTerminatedByteArray2String(out strTempString, baTempInfo); ret = HSP._CD_eGateHighSpeedPort_GetDeviceInfo(HONLCONNECTION, (int)HSP.DEVICEINFO.Type, 0, ref info1, baTempInfo); ConvertZeroTerminatedByteArray2String(out strTempString, baTempInfo); ret = HSP._CD_eGateHighSpeedPort_GetDeviceInfo(HONLCONNECTION, (int)HSP.DEVICEINFO.SampleRate, 0, ref info1, null); HSP._CD_eGateHighSpeedPort_GetNumberOfChannels(HONLCONNECTION, (int)HSP.DATADIRECTION.InputOutput, ref ChannelCount); }
public RGB Convert(HSP input) { const double Pr = 0.299; const double Pg = 0.587; const double Pb = 0.114; double h = input.H / 360.0, s = input.S / 100.0, p = input.P; double r, g, b, part, minOverMax = 1.0 - s; if (minOverMax > 0.0) { // R > G > B if (h < 1.0 / 6.0) { h = 6.0 * (h - 0.0 / 6.0); part = 1.0 + h * (1.0 / minOverMax - 1.0); b = p / Math.Sqrt(Pr / minOverMax / minOverMax + Pg * part * part + Pb); r = (b) / minOverMax; g = (b) + h * ((r) - (b)); } // G > R > B else if (h < 2.0 / 6.0) { h = 6.0 * (-h + 2.0 / 6.0); part = 1.0 + h * (1.0 / minOverMax - 1.0); b = p / Math.Sqrt(Pg / minOverMax / minOverMax + Pr * part * part + Pb); g = (b) / minOverMax; r = (b) + h * ((g) - (b)); } // G > B > R else if (h < 3.0 / 6.0) { h = 6.0 * (h - 2.0 / 6.0); part = 1.0 + h * (1.0 / minOverMax - 1.0); r = p / Math.Sqrt(Pg / minOverMax / minOverMax + Pb * part * part + Pr); g = (r) / minOverMax; b = (r) + h * ((g) - (r)); } // B > G > R else if (h < 4.0 / 6.0) { h = 6.0 * (-h + 4.0 / 6.0); part = 1.0 + h * (1.0 / minOverMax - 1.0); r = p / Math.Sqrt(Pb / minOverMax / minOverMax + Pg * part * part + Pr); b = (r) / minOverMax; g = (r) + h * ((b) - (r)); } // B > R > G else if (h < 5.0 / 6.0) { h = 6.0 * (h - 4.0 / 6.0); part = 1.0 + h * (1.0 / minOverMax - 1.0); g = p / Math.Sqrt(Pb / minOverMax / minOverMax + Pr * part * part + Pg); b = (g) / minOverMax; r = (g) + h * ((b) - (g)); } // R > B > G else { h = 6.0 * (-h + 6.0 / 6.0); part = 1.0 + h * (1.0 / minOverMax - 1.0); g = p / Math.Sqrt(Pr / minOverMax / minOverMax + Pb * part * part + Pg); r = (g) / minOverMax; b = (g) + h * ((r) - (g)); } } else { // R > G > B if (h < 1.0 / 6.0) { h = 6.0 * (h - 0.0 / 6.0); r = Math.Sqrt(p * p / (Pr + Pg * h * h)); g = (r) * h; b = 0.0; } // G > R > B else if (h < 2.0 / 6.0) { h = 6.0 * (-h + 2.0 / 6.0); g = Math.Sqrt(p * p / (Pg + Pr * h * h)); r = (g) * h; b = 0.0; } // G > B > R else if (h < 3.0 / 6.0) { h = 6.0 * (h - 2.0 / 6.0); g = Math.Sqrt(p * p / (Pg + Pb * h * h)); b = (g) * h; r = 0.0; } // B > G > R else if (h < 4.0 / 6.0) { h = 6.0 * (-h + 4.0 / 6.0); b = Math.Sqrt(p * p / (Pb + Pg * h * h)); g = (b) * h; r = 0.0; } // B > R > G else if (h < 5.0 / 6.0) { h = 6.0 * (h - 4.0 / 6.0); b = Math.Sqrt(p * p / (Pb + Pr * h * h)); r = (b) * h; g = 0.0; } // R > B > G else { h = 6.0 * (-h + 6.0 / 6.0); r = Math.Sqrt(p * p / (Pr + Pb * h * h)); b = (r) * h; g = 0.0; } } return(new RGB(new Vector(r.Round() / 255.0, g.Round() / 255.0, b.Round() / 255.0).Coerce(0, 1))); }
public void setHSP(HSP hsp) { this.hsp = hsp; }