Esempio n. 1
0
        private void DrawProcGraphics()
        {
            //this requires: ProcStatus, ProcCode, ToothNum, HideGraphics, Surf, and ToothRange.  All need to be raw database values.
            string[]   teeth;
            Color      cLight   = Color.White;
            Color      cDark    = Color.White;
            List <Def> listDefs = Defs.GetDefsForCategory(DefCat.ChartGraphicColors, true);

            for (int i = 0; i < ProcList.Count; i++)
            {
                if (ProcList[i]["HideGraphics"].ToString() == "1")
                {
                    continue;
                }
                if (ProcedureCodes.GetProcCode(ProcList[i]["ProcCode"].ToString()).PaintType == ToothPaintingType.Extraction && (
                        PIn.Long(ProcList[i]["ProcStatus"].ToString()) == (int)ProcStat.C ||
                        PIn.Long(ProcList[i]["ProcStatus"].ToString()) == (int)ProcStat.EC ||
                        PIn.Long(ProcList[i]["ProcStatus"].ToString()) == (int)ProcStat.EO
                        ))
                {
                    continue;                    //prevents the red X. Missing teeth already handled.
                }
                if (ProcedureCodes.GetProcCode(ProcList[i]["ProcCode"].ToString()).GraphicColor.ToArgb() == Color.FromArgb(0).ToArgb())
                {
                    switch ((ProcStat)PIn.Long(ProcList[i]["ProcStatus"].ToString()))
                    {
                    case ProcStat.C:
                        cDark  = listDefs[1].ItemColor;
                        cLight = listDefs[6].ItemColor;
                        break;

                    case ProcStat.TP:
                        cDark  = listDefs[0].ItemColor;
                        cLight = listDefs[5].ItemColor;
                        break;

                    case ProcStat.EC:
                        cDark  = listDefs[2].ItemColor;
                        cLight = listDefs[7].ItemColor;
                        break;

                    case ProcStat.EO:
                        cDark  = listDefs[3].ItemColor;
                        cLight = listDefs[8].ItemColor;
                        break;

                    case ProcStat.R:
                        cDark  = listDefs[4].ItemColor;
                        cLight = listDefs[9].ItemColor;
                        break;

                    case ProcStat.Cn:
                        cDark  = listDefs[16].ItemColor;
                        cLight = listDefs[17].ItemColor;
                        break;
                    }
                }
                else
                {
                    cDark  = ProcedureCodes.GetProcCode(ProcList[i]["ProcCode"].ToString()).GraphicColor;
                    cLight = ProcedureCodes.GetProcCode(ProcList[i]["ProcCode"].ToString()).GraphicColor;
                }
                switch (ProcedureCodes.GetProcCode(ProcList[i]["ProcCode"].ToString()).PaintType)
                {
                case ToothPaintingType.BridgeDark:
                    if (ToothInitials.ToothIsMissingOrHidden(ToothInitialList, ProcList[i]["ToothNum"].ToString()))
                    {
                        toothChart.SetPontic(ProcList[i]["ToothNum"].ToString(), cDark);
                    }
                    else
                    {
                        toothChart.SetCrown(ProcList[i]["ToothNum"].ToString(), cDark);
                    }
                    break;

                case ToothPaintingType.BridgeLight:
                    if (ToothInitials.ToothIsMissingOrHidden(ToothInitialList, ProcList[i]["ToothNum"].ToString()))
                    {
                        toothChart.SetPontic(ProcList[i]["ToothNum"].ToString(), cLight);
                    }
                    else
                    {
                        toothChart.SetCrown(ProcList[i]["ToothNum"].ToString(), cLight);
                    }
                    break;

                case ToothPaintingType.CrownDark:
                    toothChart.SetCrown(ProcList[i]["ToothNum"].ToString(), cDark);
                    break;

                case ToothPaintingType.CrownLight:
                    toothChart.SetCrown(ProcList[i]["ToothNum"].ToString(), cLight);
                    break;

                case ToothPaintingType.DentureDark:
                    if (ProcList[i]["Surf"].ToString() == "U")
                    {
                        teeth = new string[14];
                        for (int t = 0; t < 14; t++)
                        {
                            teeth[t] = (t + 2).ToString();
                        }
                    }
                    else if (ProcList[i]["Surf"].ToString() == "L")
                    {
                        teeth = new string[14];
                        for (int t = 0; t < 14; t++)
                        {
                            teeth[t] = (t + 18).ToString();
                        }
                    }
                    else
                    {
                        teeth = ProcList[i]["ToothRange"].ToString().Split(new char[] { ',' });
                    }
                    for (int t = 0; t < teeth.Length; t++)
                    {
                        if (ToothInitials.ToothIsMissingOrHidden(ToothInitialList, teeth[t]))
                        {
                            toothChart.SetPontic(teeth[t], cDark);
                        }
                        else
                        {
                            toothChart.SetCrown(teeth[t], cDark);
                        }
                    }
                    break;

                case ToothPaintingType.DentureLight:
                    if (ProcList[i]["Surf"].ToString() == "U")
                    {
                        teeth = new string[14];
                        for (int t = 0; t < 14; t++)
                        {
                            teeth[t] = (t + 2).ToString();
                        }
                    }
                    else if (ProcList[i]["Surf"].ToString() == "L")
                    {
                        teeth = new string[14];
                        for (int t = 0; t < 14; t++)
                        {
                            teeth[t] = (t + 18).ToString();
                        }
                    }
                    else
                    {
                        teeth = ProcList[i]["ToothRange"].ToString().Split(new char[] { ',' });
                    }
                    for (int t = 0; t < teeth.Length; t++)
                    {
                        if (ToothInitials.ToothIsMissingOrHidden(ToothInitialList, teeth[t]))
                        {
                            toothChart.SetPontic(teeth[t], cLight);
                        }
                        else
                        {
                            toothChart.SetCrown(teeth[t], cLight);
                        }
                    }
                    break;

                case ToothPaintingType.Extraction:
                    toothChart.SetBigX(ProcList[i]["ToothNum"].ToString(), cDark);
                    break;

                case ToothPaintingType.FillingDark:
                    toothChart.SetSurfaceColors(ProcList[i]["ToothNum"].ToString(), ProcList[i]["Surf"].ToString(), cDark);
                    break;

                case ToothPaintingType.FillingLight:
                    toothChart.SetSurfaceColors(ProcList[i]["ToothNum"].ToString(), ProcList[i]["Surf"].ToString(), cLight);
                    break;

                case ToothPaintingType.Implant:
                    toothChart.SetImplant(ProcList[i]["ToothNum"].ToString(), cDark);
                    break;

                case ToothPaintingType.PostBU:
                    toothChart.SetBU(ProcList[i]["ToothNum"].ToString(), cDark);
                    break;

                case ToothPaintingType.RCT:
                    toothChart.SetRCT(ProcList[i]["ToothNum"].ToString(), cDark);
                    break;

                case ToothPaintingType.Sealant:
                    toothChart.SetSealant(ProcList[i]["ToothNum"].ToString(), cDark);
                    break;

                case ToothPaintingType.Veneer:
                    toothChart.SetVeneer(ProcList[i]["ToothNum"].ToString(), cLight);
                    break;

                case ToothPaintingType.Watch:
                    toothChart.SetWatch(ProcList[i]["ToothNum"].ToString(), cDark);
                    break;
                }
            }
        }