Ejemplo n.º 1
0
        public static void ImportProcedures(OleDbConnection con, AriClinicContext ctx)
        {
            // (0) Borra tipos previos
            ctx.Delete(ctx.ProcedureAssigneds);
            ctx.Delete(ctx.Procedures);
            ctx.SaveChanges();

            // (1) Dar de alta los diferentes diagnósticos
            string sql = "SELECT * FROM Procedimientos";
            cmd = new OleDbCommand(sql, con);
            da = new OleDbDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds, "ConProcedimientos");
            int nreg = ds.Tables["ConProcedimientos"].Rows.Count;
            int reg = 0;
            foreach (DataRow dr in ds.Tables["ConProcedimientos"].Rows)
            {
                reg++;

                Procedure proc = new Procedure();
                proc.OftId = (int)dr["IdProEs"];
                proc.Name = (string)dr["NomProEs"];
                ctx.Add(proc);
                ctx.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        public static void ImportProcedures(OleDbConnection con, AriClinicContext ctx)
        {
            // (0) Borra tipos previos
            ctx.Delete(ctx.ProcedureAssigneds);
            ctx.Delete(ctx.Procedures);
            ctx.SaveChanges();

            // (1) Dar de alta los diferentes diagnósticos
            string sql = "SELECT * FROM Procedimientos";
            cmd = new OleDbCommand(sql, con);
            da = new OleDbDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds, "ConProcedimientos");
            int nreg = ds.Tables["ConProcedimientos"].Rows.Count;
            int reg = 0;
            foreach (DataRow dr in ds.Tables["ConProcedimientos"].Rows)
            {
                DataRow localDr = dr;
                reg++;
                Console.WriteLine("Procedimientos {0:#####0} de {1:#####0} {2}", reg, nreg, (string)localDr["NomProEs"]);
                Procedure proc = (from p in ctx.Procedures
                                  where p.OftId == (int)localDr["IdProEs"]
                                  select p).FirstOrDefault<Procedure>();
                if (proc == null)
                {
                    proc = new Procedure();
                    ctx.Add(proc);
                }
                proc.OftId = (int)localDr["IdProEs"];
                proc.Name = (string)localDr["NomProEs"];
                ctx.SaveChanges();
            }
        }
Ejemplo n.º 3
0
 public static void AddAutomaticTicket(AnestheticServiceNote ansn, Procedure proc, AriClinicContext ctx, bool multi, IList<SaveCheck> lschk)
 {
     // Does this customer have a primary policy with that service?
     Policy pol = PrimaryPolicy(ansn.Customer);
     bool hRisk = ansn.Chk3;
     if (pol == null)
     {
         throw new AriCliException(1, "There isn't a primary policy for this customer");
     }
     // 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 anstk = new AnestheticTicket()
     {
         TicketDate = ansn.ServiceNoteDate,
         Description = String.Format("{0} ({1})", proc.Name, ins.Service.Name),
         Amount = ins.Price,
         Policy = pol,
         InsuranceService = ins,
         User = ansn.User,
         Clinic = ansn.Clinic,
         Professional = ansn.Professional,
         Surgeon = ansn.Surgeon,
         Procedure = proc,
         AnestheticServiceNote = ansn
     };
     if (ansn.Chk2)
     {
         anstk.Checked = true;
     }
     else
     {
         anstk.Checked = CntAriCli.IsItInChecks(anstk, lschk);
     }
     if (multi)
     {
         anstk.Amount = anstk.Amount / 2;
         anstk.Comments = "-50%";
     }
     if (hRisk)
         anstk.Amount = anstk.Amount * 1.5M; // high risk increase 50%
     ctx.Add(anstk);
     ctx.SaveChanges();
 }