Ejemplo n.º 1
0
            protected override bool DrawBackground(Graphics g, Rectangle bounds, int rowNum,
                                                   Brush backBrush, System.Data.DataRow dr)
            {
                Brush
                    background = backBrush;
                bool
                    bSelAll = false,
                    bSel    = (((SolidBrush)backBrush).Color != Owner.SelectionBackColor) ? false : true;

                AppC.OPR_STATE
                    stDet;


                if (bSel == false)
                {// вообще-то не выделена, но иногда надо выделить
                    switch (this.TableInd)
                    {
                    case NSI.BD_DIND:
                        if (MainF.drEasyEdit == dr)
                        {    // режим быстрого ввода
                            background = this.SelBackBrush;
                            bSelAll    = true;
                        }
                        else
                        {     // возможны и другие цвета
                            if ((null != this.AltSolidBrush) || (null != this.AltSolidBrushSpec))
                            { // If have alternating brush, row is odd and not selected...
                                if (System.DBNull.Value != dr["READYZ"])
                                {
                                    NSI.READINESS nState = (NSI.READINESS)dr["READYZ"];
                                    if (nState == NSI.READINESS.FULL_READY)
                                    {
                                        background = this.AltSolidBrush;                             // Then use alternating brush.
                                    }
                                    else
                                    {
                                        if (this.AltSolidBrushSpec != null)
                                        {
                                            //if (((System.DBNull.Value != dr["NP"]) && (((string)dr["NP"]).Length > 0)))
                                            //    background = this.AltSolidBrushSpec;                         // Then use alternating brush.
                                        }
                                    }
                                }
                                if (this.MappingName == "KOLM")
                                {
                                    background = this.AltSolidBrushSpec;                             // Then use alternating brush.
                                }
                            }
                        }
                        break;

                    case NSI.BD_DOUTD:
                        stDet = (AppC.OPR_STATE)dr["STATE"];
                        if ((null != this.AltSolidBrush) || (null != this.AltSolidBrushSpec))
                        {     // для ТТН
                            if ((stDet & AppC.OPR_STATE.OPR_READY) > 0)
                            { // готова к передаче
                                if ((this.MappingName == "KOLE") || (this.MappingName == "KOLM") || (this.MappingName == "SNM"))
                                {
                                    background = this.AltSolidBrush;
                                }
                            }
                            if ((stDet & AppC.OPR_STATE.OPR_TRANSFERED) > 0)
                            {    // готова к передаче
                                if ((this.MappingName == "SNM"))
                                {
                                    background = this.AltSolidBrushSpec;
                                }
                            }
                        }
                        break;
                    }



                    //if (this.TableInd == NSI.BD_DIND)
                    //{// колонка для заявок
                    //    if (MainF.drEasyEdit == dr)
                    //    {// режим быстрого ввода
                    //        background = this.SelBackBrush;
                    //        bSelAll = true;
                    //    }
                    //    else
                    //    {// возможны и другие цвета
                    //        if ((null != this.AltSolidBrush) || (null != this.AltSolidBrushSpec))
                    //        {                                                                   // If have alternating brush, row is odd and not selected...
                    //            if ((bSel == false) && (System.DBNull.Value != dr["READYZ"]))
                    //            {
                    //                NSI.READINESS nState = (NSI.READINESS)dr["READYZ"];
                    //                if (nState == NSI.READINESS.FULL_READY)
                    //                    background = this.AltSolidBrush;                         // Then use alternating brush.
                    //                else
                    //                {
                    //                    if (this.AltSolidBrushSpec != null)
                    //                    {
                    //                        if (((System.DBNull.Value != dr["NP"]) && ((int)dr["NP"] > 0)))
                    //                            background = this.AltSolidBrushSpec;                         // Then use alternating brush.
                    //                    }
                    //                }
                    //            }
                    //        }
                    //    }
                    //}
                }

                g.FillRectangle(background, bounds);
                return(bSelAll);
            }
Ejemplo n.º 2
0
            protected override bool DrawBackground(Graphics g, Rectangle bounds, int rowNum,
                                                   Brush backBrush, System.Data.DataRow dr)
            {
                Brush background = backBrush;
                bool  bSelAll    = false,
                      bSel       = (((SolidBrush)backBrush).Color != Owner.SelectionBackColor) ? false : true;

                if (bSel == false)
                {// вообще-то не выделена, но иногда надо выделить
                    switch (this.TableInd)
                    {
                    case NSI.BD_DIND:
                        if (MainF.drEasyEdit == dr)
                        {    // режим быстрого ввода
                            background = this.SelBackBrush;
                            bSelAll    = true;
                        }
                        else
                        {     // возможны и другие цвета
                            if ((null != this.AltSolidBrush) || (null != this.AltSolidBrushSpec))
                            { // If have alternating brush, row is odd and not selected...
                                if (System.DBNull.Value != dr["READYZ"])
                                {
                                    NSI.READINESS nState = (NSI.READINESS)dr["READYZ"];
                                    if (nState == NSI.READINESS.FULL_READY)
                                    {
                                        background = this.AltSolidBrush;                             // Then use alternating brush.
                                    }
                                    else
                                    {
                                        if (this.AltSolidBrushSpec != null)
                                        {
                                            //if ((int)dr["COND"] == (int)NSI.SPECCOND.PARTY_SET)
                                            //    background = this.AltSolidBrushSpec;                         // Then use alternating brush.
                                            if ((((int)dr["COND"] & (int)NSI.SPECCOND.DATE_SET_EXACT) > 0) &&
                                                (this.MappingName == "DVR"))
                                            {
                                                background = this.AltSolidBrushSpec;                             // Then use alternating brush.
                                            }
                                        }
                                    }
                                }
                                if (this.MappingName == "KOLM")
                                {
                                    background = this.AltSolidBrushSpec;                             // Then use alternating brush.
                                }
                            }
                        }
                        break;

                    case NSI.BD_DOUTD:
                        if (null != this.AltSolidBrush)
                        {
                            //if (( (xF.xCDoc.nTypOp == AppC.TYPOP_PRMK)||(xF.xCDoc.nTypOp == AppC.TYPOP_MARK))


                            if ((xF.xCDoc.xDocP.nTypD == AppC.TYPD_OPR) &&
                                (this.MappingName == "SNM"))
                            {
                                if (((int)dr["STATE"] & (int)AppC.OPR_STATE.OPR_TRANSFERED) > 0)
                                {
                                    background = this.AltSolidBrush;
                                }
                            }
                            else
                            {
                                if (dr.GetChildRows(NSI.REL2BRK).Length > 0)
                                {
                                    //if (this.MappingName == "KOLE")
                                    background = this.AltSolidBrush;                    // Для строк с браком
                                }
                            }
                        }
                        if (null != this.AltSolidBrushSpec)
                        {
                            if (((int)dr["NPODDZ"] < 0) &&
                                (this.MappingName == "KOLE"))
                            {
                                background = this.AltSolidBrushSpec;
                            }
                        }
                        break;
                    }



                    //if (this.TableInd == NSI.BD_DIND)
                    //{// колонка для заявок
                    //    if (MainF.drEasyEdit == dr)
                    //    {// режим быстрого ввода
                    //        background = this.SelBackBrush;
                    //        bSelAll = true;
                    //    }
                    //    else
                    //    {// возможны и другие цвета
                    //        if ((null != this.AltSolidBrush) || (null != this.AltSolidBrushSpec))
                    //        {                                                                   // If have alternating brush, row is odd and not selected...
                    //            if ((bSel == false) && (System.DBNull.Value != dr["READYZ"]))
                    //            {
                    //                NSI.READINESS nState = (NSI.READINESS)dr["READYZ"];
                    //                if (nState == NSI.READINESS.FULL_READY)
                    //                    background = this.AltSolidBrush;                         // Then use alternating brush.
                    //                else
                    //                {
                    //                    if (this.AltSolidBrushSpec != null)
                    //                    {
                    //                        if (((System.DBNull.Value != dr["NP"]) && ((int)dr["NP"] > 0)))
                    //                            background = this.AltSolidBrushSpec;                         // Then use alternating brush.
                    //                    }
                    //                }
                    //            }
                    //        }
                    //    }
                    //}
                }

                g.FillRectangle(background, bounds);
                return(bSelAll);
            }