///<summary>Inserts one PayorType into the database. Provides option to use the existing priKey.</summary> public static long Insert(PayorType payorType,bool useExistingPK){ if(!useExistingPK && PrefC.RandomKeys) { payorType.PayorTypeNum=ReplicationServers.GetKey("payortype","PayorTypeNum"); } string command="INSERT INTO payortype ("; if(useExistingPK || PrefC.RandomKeys) { command+="PayorTypeNum,"; } command+="PatNum,DateStart,SopCode,Note) VALUES("; if(useExistingPK || PrefC.RandomKeys) { command+=POut.Long(payorType.PayorTypeNum)+","; } command+= POut.Long (payorType.PatNum)+"," + POut.Date (payorType.DateStart)+"," +"'"+POut.String(payorType.SopCode)+"'," +"'"+POut.String(payorType.Note)+"')"; if(useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { payorType.PayorTypeNum=Db.NonQ(command,true); } return payorType.PayorTypeNum; }
///<summary>Updates one PayorType in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables. Returns true if an update occurred.</summary> public static bool Update(PayorType payorType, PayorType oldPayorType) { string command = ""; if (payorType.PatNum != oldPayorType.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(payorType.PatNum) + ""; } if (payorType.DateStart.Date != oldPayorType.DateStart.Date) { if (command != "") { command += ","; } command += "DateStart = " + POut.Date(payorType.DateStart) + ""; } if (payorType.SopCode != oldPayorType.SopCode) { if (command != "") { command += ","; } command += "SopCode = '" + POut.String(payorType.SopCode) + "'"; } if (payorType.Note != oldPayorType.Note) { if (command != "") { command += ","; } command += "Note = " + DbHelper.ParamChar + "paramNote"; } if (command == "") { return(false); } if (payorType.Note == null) { payorType.Note = ""; } OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(payorType.Note)); command = "UPDATE payortype SET " + command + " WHERE PayorTypeNum = " + POut.Long(payorType.PayorTypeNum); Db.NonQ(command, paramNote); return(true); }
///<summary>Converts a DataTable to a list of objects.</summary> public static List<PayorType> TableToList(DataTable table){ List<PayorType> retVal=new List<PayorType>(); PayorType payorType; for(int i=0;i<table.Rows.Count;i++) { payorType=new PayorType(); payorType.PayorTypeNum= PIn.Long (table.Rows[i]["PayorTypeNum"].ToString()); payorType.PatNum = PIn.Long (table.Rows[i]["PatNum"].ToString()); payorType.DateStart = PIn.Date (table.Rows[i]["DateStart"].ToString()); payorType.SopCode = PIn.String(table.Rows[i]["SopCode"].ToString()); payorType.Note = PIn.String(table.Rows[i]["Note"].ToString()); retVal.Add(payorType); } return retVal; }
///<summary>Inserts one PayorType into the database. Returns the new priKey. Doesn't use the cache.</summary> public static long InsertNoCache(PayorType payorType) { if (DataConnection.DBtype == DatabaseType.MySql) { return(InsertNoCache(payorType, false)); } else { if (DataConnection.DBtype == DatabaseType.Oracle) { payorType.PayorTypeNum = DbHelper.GetNextOracleKey("payortype", "PayorTypeNum"); //Cacheless method } return(InsertNoCache(payorType, true)); } }
private void butAdd_Click(object sender, EventArgs e) { PayorType payorType = new PayorType(); payorType.PatNum = PatCur.PatNum; payorType.DateStart = DateTime.Today; FormPayorTypeEdit FormPTE = new FormPayorTypeEdit(payorType); FormPTE.IsNew = true; FormPTE.ShowDialog(); if (FormPTE.DialogResult != DialogResult.OK) { return; } FillGrid(); }
///<summary>Converts a DataTable to a list of objects.</summary> public static List <PayorType> TableToList(DataTable table) { List <PayorType> retVal = new List <PayorType>(); PayorType payorType; foreach (DataRow row in table.Rows) { payorType = new PayorType(); payorType.PayorTypeNum = PIn.Long(row["PayorTypeNum"].ToString()); payorType.PatNum = PIn.Long(row["PatNum"].ToString()); payorType.DateStart = PIn.Date(row["DateStart"].ToString()); payorType.SopCode = PIn.String(row["SopCode"].ToString()); payorType.Note = PIn.String(row["Note"].ToString()); retVal.Add(payorType); } return(retVal); }
///<summary>Updates one PayorType in the database.</summary> public static void Update(PayorType payorType) { string command = "UPDATE payortype SET " + "PatNum = " + POut.Long(payorType.PatNum) + ", " + "DateStart = " + POut.Date(payorType.DateStart) + ", " + "SopCode = '" + POut.String(payorType.SopCode) + "', " + "Note = " + DbHelper.ParamChar + "paramNote " + "WHERE PayorTypeNum = " + POut.Long(payorType.PayorTypeNum); if (payorType.Note == null) { payorType.Note = ""; } OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(payorType.Note)); Db.NonQ(command, paramNote); }
///<summary>Converts a DataTable to a list of objects.</summary> public static List <PayorType> TableToList(DataTable table) { List <PayorType> retVal = new List <PayorType>(); PayorType payorType; for (int i = 0; i < table.Rows.Count; i++) { payorType = new PayorType(); payorType.PayorTypeNum = PIn.Long(table.Rows[i]["PayorTypeNum"].ToString()); payorType.PatNum = PIn.Long(table.Rows[i]["PatNum"].ToString()); payorType.DateStart = PIn.Date(table.Rows[i]["DateStart"].ToString()); payorType.SopCode = PIn.String(table.Rows[i]["SopCode"].ToString()); payorType.Note = PIn.String(table.Rows[i]["Note"].ToString()); retVal.Add(payorType); } return(retVal); }
///<summary>Updates one PayorType in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables.</summary> public static void Update(PayorType payorType, PayorType oldPayorType) { string command = ""; if (payorType.PatNum != oldPayorType.PatNum) { if (command != "") { command += ","; } command += "PatNum = " + POut.Long(payorType.PatNum) + ""; } if (payorType.DateStart != oldPayorType.DateStart) { if (command != "") { command += ","; } command += "DateStart = " + POut.Date(payorType.DateStart) + ""; } if (payorType.SopCode != oldPayorType.SopCode) { if (command != "") { command += ","; } command += "SopCode = '" + POut.String(payorType.SopCode) + "'"; } if (payorType.Note != oldPayorType.Note) { if (command != "") { command += ","; } command += "Note = '" + POut.String(payorType.Note) + "'"; } if (command == "") { return; } command = "UPDATE payortype SET " + command + " WHERE PayorTypeNum = " + POut.Long(payorType.PayorTypeNum); Db.NonQ(command); }
///<summary>Returns true if Update(PayorType,PayorType) would make changes to the database. ///Does not make any changes to the database and can be called before remoting role is checked.</summary> public static bool UpdateComparison(PayorType payorType, PayorType oldPayorType) { if (payorType.PatNum != oldPayorType.PatNum) { return(true); } if (payorType.DateStart.Date != oldPayorType.DateStart.Date) { return(true); } if (payorType.SopCode != oldPayorType.SopCode) { return(true); } if (payorType.Note != oldPayorType.Note) { return(true); } return(false); }
///<summary>Inserts one PayorType into the database. Provides option to use the existing priKey. Doesn't use the cache.</summary> public static long InsertNoCache(PayorType payorType, bool useExistingPK) { bool isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys); string command = "INSERT INTO payortype ("; if (!useExistingPK && isRandomKeys) { payorType.PayorTypeNum = ReplicationServers.GetKeyNoCache("payortype", "PayorTypeNum"); } if (isRandomKeys || useExistingPK) { command += "PayorTypeNum,"; } command += "PatNum,DateStart,SopCode,Note) VALUES("; if (isRandomKeys || useExistingPK) { command += POut.Long(payorType.PayorTypeNum) + ","; } command += POut.Long(payorType.PatNum) + "," + POut.Date(payorType.DateStart) + "," + "'" + POut.String(payorType.SopCode) + "'," + DbHelper.ParamChar + "paramNote)"; if (payorType.Note == null) { payorType.Note = ""; } OdSqlParameter paramNote = new OdSqlParameter("paramNote", OdDbType.Text, POut.StringParam(payorType.Note)); if (useExistingPK || isRandomKeys) { Db.NonQ(command, paramNote); } else { payorType.PayorTypeNum = Db.NonQ(command, true, "PayorTypeNum", "payorType", paramNote); } return(payorType.PayorTypeNum); }
///<summary>Inserts one PayorType into the database. Returns the new priKey.</summary> public static long Insert(PayorType payorType){ if(DataConnection.DBtype==DatabaseType.Oracle) { payorType.PayorTypeNum=DbHelper.GetNextOracleKey("payortype","PayorTypeNum"); int loopcount=0; while(loopcount<100){ try { return Insert(payorType,true); } catch(Oracle.DataAccess.Client.OracleException ex){ if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){ payorType.PayorTypeNum++; loopcount++; } else{ throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return Insert(payorType,false); } }
/// <summary> /// Removes the type of the payor. /// </summary> /// <param name="payorType">Type of the payor.</param> public virtual void RemovePayorType(PayorType payorType) { Check.IsNotNull(payorType, "Payor Type is required."); _payorTypes.Remove(payorType); NotifyItemRemoved(() => PayorTypes, payorType); }
private int _selectedIndex; //used to keep track of the selected index in the comboSopCode drop down box since we are setting the text differently than the contents of the drop down list public FormPayorTypeEdit(PayorType payorType) { InitializeComponent(); Lan.F(this); PayorTypeCur = payorType; }
/// <summary> /// Revises the type of the payor. /// </summary> /// <param name="payorType">Type of the payor.</param> public virtual void RevisePayorType(PayorType payorType) { Check.IsNotNull(payorType, () => PayorType); PayorType = payorType; }
///<summary>Inserts one PayorType into the database. Returns the new priKey.</summary> public static long Insert(PayorType payorType) { return(Insert(payorType, false)); }
///<summary>Updates one PayorType in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables. Returns true if an update occurred.</summary> public static bool Update(PayorType payorType,PayorType oldPayorType){ string command=""; if(payorType.PatNum != oldPayorType.PatNum) { if(command!=""){ command+=",";} command+="PatNum = "+POut.Long(payorType.PatNum)+""; } if(payorType.DateStart != oldPayorType.DateStart) { if(command!=""){ command+=",";} command+="DateStart = "+POut.Date(payorType.DateStart)+""; } if(payorType.SopCode != oldPayorType.SopCode) { if(command!=""){ command+=",";} command+="SopCode = '"+POut.String(payorType.SopCode)+"'"; } if(payorType.Note != oldPayorType.Note) { if(command!=""){ command+=",";} command+="Note = '"+POut.String(payorType.Note)+"'"; } if(command==""){ return false; } command="UPDATE payortype SET "+command +" WHERE PayorTypeNum = "+POut.Long(payorType.PayorTypeNum); Db.NonQ(command); return true; }
///<summary>Updates one PayorType in the database.</summary> public static void Update(PayorType payorType){ string command="UPDATE payortype SET " +"PatNum = "+POut.Long (payorType.PatNum)+", " +"DateStart = "+POut.Date (payorType.DateStart)+", " +"SopCode = '"+POut.String(payorType.SopCode)+"', " +"Note = '"+POut.String(payorType.Note)+"' " +"WHERE PayorTypeNum = "+POut.Long(payorType.PayorTypeNum); Db.NonQ(command); }
/// <summary> /// Processes the single aggregate. /// </summary> /// <param name="dto">The dto.</param> /// <param name="payorType">Type of the payor.</param> /// <returns>A Boolean flag.</returns> protected override bool ProcessSingleAggregate(PayorTypeDto dto, PayorType payorType) { payorType.ReviseName(dto.Name); payorType.ReviseBillingForm(dto.BillingForm); payorType.ReviseSubmitterIdentifier(dto.SubmitterIdentifier); payorType.ReviseBillingFtpAddress(string.IsNullOrWhiteSpace(dto.FtpAddress) ? null : new Ftp(dto.FtpAddress)); if (!string.IsNullOrWhiteSpace(dto.InterchangeReceiverNumber) || !string.IsNullOrWhiteSpace(dto.InterchangeSenderNumber) || !string.IsNullOrWhiteSpace(dto.CompositeDelimiter) || !string.IsNullOrWhiteSpace(dto.ElementDelimiter) || !string.IsNullOrWhiteSpace(dto.SegmentDelimiter) || !string.IsNullOrWhiteSpace(dto.RepetitionDelimiter)) { payorType.ReviseHealthCareClaim837Setup( new HealthCareClaim837Setup( dto.InterchangeReceiverNumber, dto.InterchangeSenderNumber, new X12Delimiters( dto.CompositeDelimiter, dto.ElementDelimiter, dto.SegmentDelimiter, dto.RepetitionDelimiter))); } else { payorType.ReviseHealthCareClaim837Setup(null); } var stateProvinceLookup = _mappingHelper.MapLookupField <StateProvince> (dto.StateProvince); if (!string.IsNullOrWhiteSpace(dto.FirstStreetAddress) || !string.IsNullOrWhiteSpace(dto.SecondStreetAddress) || !string.IsNullOrWhiteSpace(dto.CityName) || stateProvinceLookup != null) { var address = new AddressBuilder() .WithFirstStreetAddress(dto.FirstStreetAddress) .WithSecondStreetAddress(dto.SecondStreetAddress) .WithCityName(dto.CityName) .WithStateProvince(stateProvinceLookup) .WithPostalCode( string.IsNullOrWhiteSpace(dto.PostalCode) ? null : new PostalCode(dto.PostalCode)) .Build(); payorType.ReviseBillingAddress(address); } else { payorType.ReviseBillingAddress(null); } payorType.ReviseBillingPhone( string.IsNullOrWhiteSpace(dto.PhoneNumber) && string.IsNullOrWhiteSpace(dto.PhoneExtensionNumber) ? null : new Phone(dto.PhoneNumber, dto.PhoneExtensionNumber)); return(true); }