本文整理汇总了C#中AriCliModel.AriClinicContext.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# AriClinicContext.Delete方法的具体用法?C# AriClinicContext.Delete怎么用?C# AriClinicContext.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AriCliModel.AriClinicContext
的用法示例。
在下文中一共展示了AriClinicContext.Delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteVisit
public static void DeleteVisit(AriClinicContext ctx)
{
ctx.Delete(ctx.OphthalmologicVisits);
ctx.Delete(ctx.BaseVisits);
ctx.Delete(ctx.VisitReasons);
ctx.SaveChanges();
}
示例2: GeneralPaymentDelete
public static void GeneralPaymentDelete(GeneralPayment gp, AriClinicContext ctx)
{
foreach (Payment p in gp.Payments)
{
PaymentDelete(p, ctx);
}
ctx.Delete(gp);
ctx.SaveChanges();
}
示例3: DeleteExaminations
public static void DeleteExaminations(AriClinicContext ctx)
{
ctx.Delete(ctx.WithoutGlassesTests);
ctx.Delete(ctx.GlassesTests);
ctx.Delete(ctx.ContactLensesTests);
ctx.Delete(ctx.OpticalObjectiveExaminations);
ctx.Delete(ctx.PrescriptionGlasses);
ctx.Delete(ctx.Cycloplegias);
//
ctx.Delete(ctx.Biometries);
ctx.Delete(ctx.Topographies);
ctx.Delete(ctx.Paquimetries);
//
ctx.Delete(ctx.ExaminationAssigneds);
ctx.Delete(ctx.Examinations);
//
ctx.SaveChanges();
}
示例4: PaymentDelete
public static void PaymentDelete(Payment pay, AriClinicContext ctx)
{
// minus paid in ticket
if (pay.Ticket != null)
{
pay.Ticket.Paid = pay.Ticket.Paid - pay.Amount;
}
ctx.Delete(pay);
ctx.SaveChanges();
}
示例5: CreateAssociateTickets
public static void CreateAssociateTickets(AnestheticServiceNote asn, AriClinicContext ctx)
{
// Does this customer have a primary policy with that service?
Policy pol = PrimaryPolicy(asn.Customer);
if (pol == null)
{
throw new AriCliException(1, "There isn't a primary policy for this customer");
}
// Delete all tickets
ctx.Delete(asn.AnestheticTickets);
foreach (Procedure proc in asn.Procedures)
{
// Does this policy includes related (from procedure) services
InsuranceService ins = PolicyIncludesService(pol, proc.Service);
if (ins == null)
{
throw new AriCliException(3, "The insurance company have not the nomenclator service assigned");
}
// Everything seems ok, we can add anesthetic ticket
AnestheticTicket atck = new AnestheticTicket()
{
TicketDate = asn.ServiceNoteDate,
Description = String.Format("{0} ({1})", proc.Name, ins.Service.Name),
Amount = ins.Price,
Policy = pol,
InsuranceService = ins,
User = asn.User,
Clinic = asn.Clinic,
Professional = asn.Professional,
Surgeon = asn.Surgeon,
Procedure = proc,
AnestheticServiceNote = asn
};
ctx.Add(atck);
ctx.SaveChanges();
}
}
示例6: ImportAssurancePolicies
public static void ImportAssurancePolicies(OleDbConnection con, AriClinicContext ctx)
{
//(0) Borrar las aseguradoras y pólizas previas.
ctx.Delete(ctx.Policies);
ctx.Delete(ctx.Insurances);
ctx.Delete(ctx.InsuranceServices);
ctx.SaveChanges();
//(1) Por defecto creamos una aseguradora que es la clínica de Valencia.
Insurance insurance = (from i in ctx.Insurances
where i.Name == "MIESTETIC (Valencia)"
select i).FirstOrDefault<Insurance>();
if (insurance == null)
{
insurance = new Insurance();
insurance.Name = "MIESTETIC (Valencia)";
insurance.Internal = true;
ctx.Add(insurance);
}
//(2) Ahora leemos, de nuevo, todos los tipos de servicio porque en OFT
// ellos llevan los importes y en nuestro caso son los Insurance services
string sql = "SELECT * FROM ServMed";
cmd = new OleDbCommand(sql, con);
da = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "ConServicios");
int nreg = ds.Tables["ConServicios"].Rows.Count;
int reg = 0;
InsuranceService ins = null;
foreach (DataRow dr in ds.Tables["ConServicios"].Rows)
{
reg++;
Console.WriteLine("Servicions {0:#####0} de {1:#####0} {2}", reg, nreg, "SERVICIO");
int id = (int)dr["IdServMed"];
ins = (from i in ctx.InsuranceServices
where i.OftId == id
select i).FirstOrDefault<InsuranceService>();
if (ins == null)
{
ins = new InsuranceService();
ctx.Add(ins);
}
ins.Insurance = insurance;
ins.Service = (from s in ctx.Services
where s.OftId == id
select s).FirstOrDefault<Service>();
ins.Price = (decimal)dr["Importe"];
}
//(3) por último asignamos una póliza a todos los clientes que tenemos dados de alta.
foreach (Customer cus in ctx.Customers)
{
Customer localCus = cus;
Policy pol = (from p in ctx.Policies
where p.Customer.PersonId == localCus.PersonId &&
p.Insurance.InsuranceId == insurance.InsuranceId
select p).FirstOrDefault<Policy>();
if (pol == null)
{
pol = new Policy();
pol.Customer = localCus;
pol.Insurance = insurance;
ctx.Add(pol);
}
}
ctx.SaveChanges();
}
示例7: DeleteProcedures
public static void DeleteProcedures(AriClinicContext ctx)
{
ctx.Delete(ctx.ProcedureAssigneds);
ctx.Delete(ctx.Procedures);
ctx.SaveChanges();
}
示例8: ImportCategories
/// <summary>
/// Traspasa los datos que corresponden a servicios y categorias de servicio
/// </summary>
/// <param name="con">Conector a OFT</param>
/// <param name="ctx">Contexto de AriClinc</param>
public static void ImportCategories(OleDbConnection con, AriClinicContext ctx)
{
int id = 0;
// (0) Borrar los datos previos.
ctx.Delete(ctx.Services);
ctx.Delete(ctx.ServiceCategories);
ctx.SaveChanges();
// (1) Dar de alta las categorias de servicio
string sql = "SELECT * FROM TipServMed";
cmd = new OleDbCommand(sql, con);
da = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "ConServicios");
int nreg = ds.Tables["ConServicios"].Rows.Count;
int reg = 0;
ServiceCategory sc = null;
foreach (DataRow dr in ds.Tables["ConServicios"].Rows)
{
DataRow localDr = dr;
reg++;
Console.WriteLine("Categorias {0:#####0} de {1:#####0} {2}", reg, nreg, (string)localDr["NomTipServMed"]);
sc = (from scat in ctx.ServiceCategories
where scat.OftId == (int)localDr["IdTipServMed"]
select scat).FirstOrDefault<ServiceCategory>();
if (sc == null)
{
sc = new ServiceCategory();
ctx.Add(sc);
}
sc.Name = (string)localDr["NomTipServMed"];
sc.OftId = (int)localDr["IdTipservMed"];
ctx.SaveChanges();
}
// (2) Con las categorías dadas de alta damos de alta los
// servicios.
sql = "SELECT * FROM ServMed";
cmd = new OleDbCommand(sql, con);
da = new OleDbDataAdapter(cmd);
ds = new DataSet();
da.Fill(ds, "ConServ2");
nreg = ds.Tables["ConServ2"].Rows.Count;
reg = 0;
Service s = null;
foreach (DataRow dr in ds.Tables["ConServ2"].Rows)
{
reg++;
s = (from sr in ctx.Services
where sr.OftId == (int)dr["IdServMed"]
select sr).FirstOrDefault<Service>();
if (s == null)
{
s = new Service();
ctx.Add(s);
}
s.Name = (string)dr["NomServMed"];
id = (int)dr["IdTipServMed"];
s.ServiceCategory = (from scat in ctx.ServiceCategories
where scat.OftId == id
select scat).FirstOrDefault<ServiceCategory>();
s.OftId = (int)dr["IdServMed"];
}
ctx.SaveChanges();
}
示例9: DeleteDiagnostics
public static void DeleteDiagnostics(AriClinicContext ctx)
{
ctx.Delete(ctx.DiagnosticAssigneds);
ctx.Delete(ctx.Diagnostics);
ctx.SaveChanges();
}
示例10: ImportDiagnosticsAssigned
public static void ImportDiagnosticsAssigned(OleDbConnection con, AriClinicContext ctx)
{
// (0) Borra tipos previos
ctx.Delete(ctx.DiagnosticAssigneds);
ctx.SaveChanges();
// (1) Dar de alta los diferentes diagnósticos
string sql = "SELECT * FROM HistDiag";
cmd = new OleDbCommand(sql, con);
da = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "ConDiagnosticos");
int nreg = ds.Tables["ConDiagnosticos"].Rows.Count;
int reg = 0;
foreach (DataRow dr in ds.Tables["ConDiagnosticos"].Rows)
{
reg++;
Console.WriteLine("Diagnósticos asignados {0:#####0} de {1:#####0} {2}", reg, nreg, "DG ASIGNADOS");
int id = (int)dr["IdDiag"];
Diagnostic diag = (from d in ctx.Diagnostics
where d.OftId == id
select d).FirstOrDefault<Diagnostic>();
id = (int)dr["NumHis"];
Patient patient = (from p in ctx.Patients
where p.OftId == id
select p).FirstOrDefault<Patient>();
DiagnosticAssigned das = (from d in ctx.DiagnosticAssigneds
where d.Patient.PersonId == patient.PersonId
&& d.Diagnostic.DiagnosticId == diag.DiagnosticId
&& d.DiagnosticDate == (DateTime)dr["Fecha"]
select d).FirstOrDefault<DiagnosticAssigned>();
if (das == null)
{
das = new DiagnosticAssigned();
ctx.Add(das);
}
das.Patient = patient;
das.Diagnostic = diag;
if ((int)dr["TipoProc"] == 1)
{
id = (int)dr["ExtProc"];
das.BaseVisit = (from v in ctx.BaseVisits
where v.OftRefVisita == id
select v).FirstOrDefault<BaseVisit>();
}
das.DiagnosticDate = (DateTime)dr["Fecha"];
das.Comments = (string)dr["Observa"];
ctx.SaveChanges();
}
}
示例11: DeleteDrugTreatments
public static void DeleteDrugTreatments(AriClinicContext ctx)
{
ctx.Delete(ctx.Treatments);
ctx.Delete(ctx.Drugs);
ctx.SaveChanges();
}
示例12: DeleteEmailsAddressAndTelephones
public static void DeleteEmailsAddressAndTelephones(AriClinicContext ctx)
{
ctx.Delete(ctx.Emails); // eliminar correos electrónicos
ctx.Delete(ctx.Telephones); // eliminar teléfonos.
ctx.Delete(ctx.Addresses); // eliminar las direcciones.
ctx.SaveChanges();
}
示例13: DeleteLabTest
public static void DeleteLabTest(AriClinicContext ctx)
{
ctx.Delete(ctx.LabTestAssigneds);
ctx.Delete(ctx.LabTests);
ctx.SaveChanges();
}
示例14: ImportTreatment
public static void ImportTreatment(OleDbConnection con, AriClinicContext ctx)
{
// (0) Borra tipos previos
ctx.Delete(ctx.Treatments);
ctx.SaveChanges();
// (1) Dar de alta los diferentes diagnósticos
string sql = "SELECT * FROM HistFarm";
cmd = new OleDbCommand(sql, con);
da = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "ConFarmacos");
int nreg = ds.Tables["ConFarmacos"].Rows.Count;
int reg = 0;
foreach (DataRow dr in ds.Tables["ConFarmacos"].Rows)
{
reg++;
Console.WriteLine("Tratamientos {0:#####0} de {1:#####0} {2}", reg, nreg, "TREATMENT");
int id = (int)dr["IdFarm"];
Drug dia = (from d in ctx.Drugs
where d.OftId == id
select d).FirstOrDefault<Drug>();
id = (int)dr["NumHis"];
Patient patient = (from p in ctx.Patients
where p.OftId == id
select p).FirstOrDefault<Patient>();
DateTime treatmentDate = (DateTime)dr["Fecha"];
Treatment t = (from tr in ctx.Treatments
where tr.Patient.PersonId == patient.PersonId
&& tr.Drug.DrugId == dia.DrugId
&& tr.TreatmentDate == treatmentDate
select tr).FirstOrDefault<Treatment>();
if (t == null)
{
t = new Treatment();
ctx.Add(t);
}
t.Patient = patient;
t.Drug = dia;
if ((int)dr["TipoProc"] == 1)
{
id = (int)dr["ExtProc"];
t.BaseVisit = (from v in ctx.BaseVisits
where v.OftRefVisita == id
select v).FirstOrDefault<BaseVisit>();
}
t.TreatmentDate = treatmentDate;
t.Recommend = (string)dr["Posologia"];
t.Quantity = (int)(float)dr["Cantidad"];
ctx.SaveChanges();
}
}
示例15: DeletePatientRelated
public static void DeletePatientRelated(AriClinicContext ctx)
{
ctx.Delete(ctx.Emails); // eliminar correos electrónicos
ctx.Delete(ctx.Telephones); // eliminar teléfonos.
ctx.Delete(ctx.Policies); // eliminar las pólizas.
ctx.Delete(ctx.Customers); // eliminar los clientes.
ctx.Delete(ctx.Patients); // por último, los pacientes.
ctx.Delete(ctx.Addresses); // eliminar direcciones.
ctx.SaveChanges();
}