/// <summary>
 /// 删除原料属性
 /// </summary>
 private void DeleteMaterialAttribute(HttpContext context)
 {
     //需要一个实体对象参数
     //1,创建要删除的对象
     Model.base_MaterialAttribute ma = new Model.base_MaterialAttribute()
     {
         ID = int.Parse(context.Request["ID"] + ""),//仓库ID
     };
     //2,将对象添加到EF管理容器中
     db.base_MaterialAttribute.Attach(ma);
     //3,修改对象的包装类对象标识为删除状态
     db.base_MaterialAttribute.Remove(ma);
     //4,更新到数据库
     int num = db.SaveChanges();
     context.Response.Write("{\"d\":" + num + "}");
 }
 /// <summary>
 /// 编辑原料属性
 /// </summary>
 private void EditMaterialAttribute(HttpContext context)
 {
     Model.base_MaterialAttribute ma = new Model.base_MaterialAttribute()
     {
         ID = int.Parse(context.Request["ID"] + ""),//原料属性ID
         AttributeName = context.Request["AttributeName"] + "",
         Status = 1,//状态
         LastUpdateBy = UserInfo.UserName,//编辑人
         LastUpdateTime = DateTime.Now//编辑时间
     };
     //先将实体附加到实体上下文中
     db.base_MaterialAttribute.Attach(ma);
     //手动修改实体的状态
     db.Entry(ma).State = EntityState.Modified;
     int num = db.SaveChanges();
     context.Response.Write("{\"d\":" + num + "}");
 }
 /// <summary>
 /// 添加物料属性
 /// </summary>
 private void AddMaterialAttribute(HttpContext context)
 {
     Model.base_MaterialAttribute ma = new Model.base_MaterialAttribute()
     {
         AttributeName = context.Request["AttributeName"] + "",//物料属性
         Status = 1,//状态
         AddBy = UserInfo.UserName,//添加人
         AddTime = DateTime.Now//添加时间
     };
     db.base_MaterialAttribute.Add(ma);
     int num = db.SaveChanges();
     context.Response.Write("{\"d\":" + num + "}");
 }