/////---预定为30--/////
        /// <summary>
        /// 添加的数据ID
        /// </summary>
        /// <param name="ids">步调,增加为1 减少为-1</param>
        /// <returns></returns>
        public static bool BackListMode(int ids, int ints)
        {
            Expression <Func <Blacklist, bool> > p = n => n.Blacklist_ID == ids;
            Action <Blacklist> ap = s =>
            {
                if (ints == 1)
                {
                    if (s.Blacklist_UpgradeCount == null)
                    {
                        s.Blacklist_UpgradeCount = 1;
                    }
                    else
                    {
                        if (s.Blacklist_UpgradeCount == 30)
                        {
                            s.Blacklist_UpgradeCount = 0;
                            DataTable table = LinQBaseDao.Query("select * from dbo.Dictionary where Dictionary.Dictionary_ID=(select Blacklist_Dictionary_ID from dbo.Blacklist where Blacklist_ID=" + s.Blacklist_Dictionary_ID + ")").Tables[0];
                            s.Blacklist_Dictionary_ID = Convert.ToInt32(LinQBaseDao.Query("select Dictionary_ID from dbo.Dictionary where Menu_OtherID=" + Convert.ToInt32(table.Rows[0]["Menu_OtherID"]) + 1).Tables[0].Rows[1]["Dictionary_ID"]);
                        }
                        else
                        {
                            s.Blacklist_UpgradeCount += 1;
                        }
                    }
                }
                if (ints == -1)
                {
                    if (s.Blacklist_DowngradeCount == null)
                    {
                        s.Blacklist_DowngradeCount = 1;
                    }
                    else
                    if (s.Blacklist_UpgradeCount == 30)
                    {
                        s.Blacklist_DowngradeCount = 0;
                        DataTable table = LinQBaseDao.Query("select * from dbo.Dictionary where Dictionary.Dictionary_ID=(select Blacklist_Dictionary_ID from dbo.Blacklist where Blacklist_ID=" + s.Blacklist_Dictionary_ID + ")").Tables[0];
                        if (Convert.ToInt32(table.Rows[0]["Menu_OtherID"]) + (-1) == 0)
                        {
                            return;
                        }
                        s.Blacklist_Dictionary_ID = Convert.ToInt32(LinQBaseDao.Query("select Dictionary_ID from dbo.Dictionary where Menu_OtherID=" + Convert.ToInt32(table.Rows[0]["Menu_OtherID"]) + (-1)).Tables[0].Rows[1]["Dictionary_ID"]);
                    }
                    else
                    {
                        s.Blacklist_UpgradeCount += 1;
                    }
                }
            };

            if (BlacklistDAL.Update(p, ap))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 黑名单升级与降级
        /// </summary>
        /// <param name="Id">车辆ID、驾驶员ID、公司ID</param>
        /// <param name="type">黑名单类型:1代表车,2代表驾驶员,3代表公司</param>
        /// <param name="isbool">true为升级,false为降级</param>
        /// <returns></returns>
        public static bool ISBacklist(int Id, int type, bool isbool)
        {
            bool retust = true;

            try
            {
                string strsql = "";
                if (type == 1)
                {
                    strsql = "select * from Blacklist where Blacklist_CarInfo_ID=" + Id;
                }
                else if (type == 2)
                {
                    strsql = "select * from Blacklist where Blacklist_StaffInfo_ID=" + Id;
                }
                else
                {
                    strsql = "select * from Blacklist where Blacklist_CustomerInfo_ID=" + Id;
                }
                DataTable dt = LinQBaseDao.Query(strsql).Tables[0];
                if (dt.Rows.Count < 0)
                {
                    return(retust = false);
                }
                int    blacklistid = Convert.ToInt32(dt.Rows[0]["Blacklist_ID"].ToString());
                string strDicid    = dt.Rows[0]["Blacklist_Dictionary_ID"].ToString();
                int    upcount     = Convert.ToInt32(dt.Rows[0]["Blacklist_UpgradeCount"].ToString());   //升级次数
                int    downcount   = Convert.ToInt32(dt.Rows[0]["Blacklist_DowngradeCount"].ToString()); //降级次数

                DataTable dtdic        = LinQBaseDao.Query("select * from Dictionary where Dictionary_ID=" + strDicid).Tables[0];
                int       DicSpareint1 = Convert.ToInt32(dtdic.Rows[0]["Dictionary_Spare_int1"].ToString()); //升级上限次数
                int       DicSpareint2 = Convert.ToInt32(dtdic.Rows[0]["Dictionary_Spare_int2"].ToString()); //降级上限次数
                int       dicsort      = Convert.ToInt32(dtdic.Rows[0]["Dictionary_Sort"].ToString());
                string    otherid      = dtdic.Rows[0]["Dictionary_OtherID"].ToString();


                //升级
                if (isbool)
                {
                    upcount += 1;
                    if (upcount >= DicSpareint1)
                    {
                        int strsort = Convert.ToInt32(LinQBaseDao.GetSingle("select Dictionary_Sort from Dictionary where Dictionary_OtherID = " + otherid + "order by Dictionary_Sort desc").ToString());
                        if (dicsort > strsort)
                        {
                            string strstate = LinQBaseDao.GetSingle("select Dictionary_Sort from Dictionary where Dictionary_OtherID =" + otherid + " and Dictionary_Sort=" + strsort + 1).ToString();
                            Expression <Func <Blacklist, bool> > p = n => n.Blacklist_ID == blacklistid;
                            Action <Blacklist> ap = s =>
                            {
                                s.Blacklist_State         = strstate;
                                s.Blacklist_Dictionary_ID = 5;
                                s.Blacklist_UpgradeCount  = upcount - DicSpareint1;
                            };
                            if (BlacklistDAL.Update(p, ap))
                            {
                                return(retust = true);
                            }
                            return(retust = false);
                        }
                        return(retust = false);
                    }
                    else
                    {
                        Expression <Func <Blacklist, bool> > p = n => n.Blacklist_ID == blacklistid;
                        Action <Blacklist> ap = s =>
                        {
                            s.Blacklist_UpgradeCount = upcount;
                        };
                        BlacklistDAL.Update(p, ap);
                        return(retust = false);
                    }
                }
                else
                {
                    downcount += 1;
                    //降级
                    if (downcount >= DicSpareint2)
                    {
                        int strsort = Convert.ToInt32(LinQBaseDao.GetSingle("select Dictionary_Sort from Dictionary where Dictionary_OtherID =" + otherid + " order by Dictionary_Sort desc").ToString());
                        if (dicsort > strsort)
                        {
                            string strstate = LinQBaseDao.GetSingle("select Dictionary_Sort from Dictionary where Dictionary_OtherID =" + otherid + " and Dictionary_Sort=" + strsort + -1).ToString();
                            Expression <Func <Blacklist, bool> > p = n => n.Blacklist_ID == blacklistid;
                            Action <Blacklist> ap = s =>
                            {
                                s.Blacklist_State         = strstate;
                                s.Blacklist_Dictionary_ID = downcount - DicSpareint2;
                            };
                            if (BlacklistDAL.Update(p, ap))
                            {
                                return(retust = true);
                            }
                            return(retust = false);
                        }
                        return(retust = false);
                    }
                    else
                    {
                        Expression <Func <Blacklist, bool> > p = n => n.Blacklist_ID == blacklistid;
                        Action <Blacklist> ap = s =>
                        {
                            s.Blacklist_UpgradeCount = upcount;
                        };
                        BlacklistDAL.Update(p, ap);
                        return(retust = false);
                    }
                }
            }
            catch
            {
                return(retust = false);
            }
        }