/// <summary>
 /// 添加评级信息
 /// </summary>
 /// <param name="context"></param>
 private void addLevel(HttpContext context)
 {
     int SuppliersID = Convert.ToInt32(context.Request["SuppliersID"]);
     var data = db.domain_EvaluationLevel.Where(w => w.SuppliersID == SuppliersID);
     if (data.Count() > 0)
     {
         context.Response.Write("{\"d\":111}");//此评级信息已存在
     }
     else
     {
         Model.domain_EvaluationLevel el = new Model.domain_EvaluationLevel()
        {
            SuppliersID = SuppliersID,
            CompanyName = context.Request["CompanyName"] + "",
            Level = context.Request["Level"] + "",
            AddBy = UserInfo.UserName,
            AddTime = DateTime.Now
        };
         db.domain_EvaluationLevel.Add(el);
         Model.base_Suppliers sup = db.base_Suppliers.Where(w => w.ID == SuppliersID).First();
         sup.AssessmentLevel = el.Level;
         int num = db.SaveChanges();
         if (num == 2)
         {
             num = 1;
             Model.domain_Log log = new Model.domain_Log()
                           {
                               DoID = SuppliersID,
                               DoType = 2,
                               DoContent = "添加 " + el.Level,
                               DoBy = UserInfo.UserName,
                               DoTime = DateTime.Now
                           };
             db.domain_Log.Add(log);
             db.SaveChanges();
         }
         context.Response.Write("{\"d\":" + num + "}");
     }
 }
        //获取供应商自己的等级
        private void getSelfLevle(HttpContext context)
        {
            //判断登录用户是否为供应商
            if (UserInfo.UserType == 9)
            {
                //获取登录用户的供应商列表
                List<Model.base_Suppliers> SuppliersList = db.base_Suppliers.Where(w =>
                    w.LoginUserID == UserInfo.UserId).ToList();
                if (SuppliersList.Count >= 0)
                {
                    //获取登录的供应商id
                    Model.base_Suppliers Suppliers = SuppliersList.First();
                    int SuppliersID = Suppliers.ID;
                    //获取供应商等级信息
                    Model.domain_EvaluationLevel el = db.domain_EvaluationLevel.Where(w =>
                        w.SuppliersID == SuppliersID).FirstOrDefault();

                    string logstr = "\"\"";

                    if (el != null)
                    {
                        //获取供应商评审记录
                        var domain_LogList = db.domain_Log.Where(w => w.DoID == SuppliersID).
                            OrderByDescending(o => o.DoTime).ToList().Select(s => new
                            {
                                DoTime = s.DoTime == null ? "" : DateTime.Parse(s.DoTime.ToString()).ToString("yyyy-mm-dd hh:mm:ss"),
                                s.DoContent
                            });
                        int count = domain_LogList.Count();
                        if (count > 0)
                        {
                            logstr = JsonConvert.SerializeObject(domain_LogList);//日志详情列表
                        }

                    }
                    else
                    {
                        el = new Model.domain_EvaluationLevel
                        {
                            AddBy = "",
                            CompanyName = "",
                            AddTime = DateTime.Now,
                            LastUpdateBy = "",
                            LastUpdateTime = DateTime.Now,
                            Level = "",
                            SuppliersID = SuppliersID
                        };
                    }

                    //序列化json字符串
                    string elstr = JsonConvert.SerializeObject(el);//详情
                    string result = "{\"LevelData\":" + elstr + ",\"logData\":" + logstr + "}";
                    context.Response.Write(result);
                }
                else
                {
                    context.Response.Write("");
                }
            }
            else
            {
                context.Response.Write("");
            }
        }