示例#1
0
        public static int getStatusNextStep(int index, List <tbl_QuyTrinh> listQyTrinh)
        {
            tbl_QuyTrinh cuurenQuyTrinh = listQyTrinh[index];
            tbl_QuyTrinh prevQuyTrinh   = null;
            int          indexQTFlowOne = -1;

            if (index > 0)
            {
                for (int jj = index - 1; jj >= 0; jj--)
                {
                    if (listQyTrinh[jj].SongSong == 0)
                    {
                        prevQuyTrinh = listQyTrinh[jj];
                        break;
                    }
                    else
                    {
                        indexQTFlowOne = jj;
                    }
                }
            }
            if (prevQuyTrinh == null)
            {
                return(2);
            }
            else
            {
                if (prevQuyTrinh.TrangThai == 2)
                {
                    bool checkSuccess = true;
                    if (indexQTFlowOne == -1)
                    {
                        return(2);
                    }
                    else
                    {
                        for (int i = indexQTFlowOne; i < index; i++)
                        {
                            tbl_QuyTrinh itemTrinh = listQyTrinh[i];
                            if (itemTrinh.TrangThai != 2)
                            {
                                checkSuccess = false;
                                break;
                            }
                        }
                        if (checkSuccess || cuurenQuyTrinh.SongSong == 1)
                        {
                            return(2);
                        }
                        else
                        {
                            return(1);
                        }
                    }
                }
                else
                {
                    if (indexQTFlowOne == -1)
                    {
                        return(1);
                    }
                    else
                    {
                        if (cuurenQuyTrinh.SongSong == 1)
                        {
                            return(2);
                        }
                    }
                }
            }


            return(1);
        }
示例#2
0
        public static tbl_QuyTrinh QuyTrinhByID(int idflow)
        {
            tbl_QuyTrinh flow = db.tbl_QuyTrinh.Find(idflow);

            return(flow);
        }