//更新或添加数据
        public ActionResult Add(string material_Id)
        {
            ViewBag.types    = _typeBll.GetEntities(p => p.Material_Type_Parent_Id == "000000");
            ViewBag.companys = _companyBll.GetEntities(p => true).Select(p => p.Company_Name);
            if (string.IsNullOrEmpty(material_Id))
            {
                ViewBag.IsUpdate = false;
                return(View());
            }

            ViewBag.IsUpdate = true;
            Material_Info materialInfo = _baseInfoBll.GetEntity(m => m.Material_Id == material_Id);
            Material_Type currentType  =
                _typeBll.GetEntity(m => m.Material_Type_Name == materialInfo.Material_Type_Name);

            ViewBag.brotherTypes =
                _typeBll.GetEntities(m => m.Material_Type_Parent_Id == currentType.Material_Type_Parent_Id);
            Material_Type parenType =
                _typeBll.Find(currentType.Material_Type_Parent_Id);

            ViewBag.parentTypes =
                _typeBll.GetEntities(m => m.Material_Type_Parent_Id == parenType.Material_Type_Parent_Id);
            ViewBag.parentName = parenType.Material_Type_Name;
            ViewBag.grandName  = _typeBll.Find(parenType.Material_Type_Parent_Id)
                                 .Material_Type_Name;
            if (materialInfo != null)
            {
                return(View(materialInfo));
            }
            return(View());
        }
Exemple #2
0
        public ActionResult Add(string Material_Type_Id)
        {
            List <Material_Type> topTypes    = _typeBll.GetEntities(m => m.Material_Type_Parent_Id == "000000");
            List <string>        topIds      = topTypes.Select(n => n.Material_Type_Id).ToList();
            List <Material_Type> centerTypes = _typeBll.GetEntities(m =>
                                                                    topIds.Contains(m.Material_Type_Parent_Id));

            ViewBag.topTypes    = topTypes;
            ViewBag.centerTypes = centerTypes;

            if (string.IsNullOrEmpty(Material_Type_Id))
            {
                ViewBag.IsUpdate = false;
                return(View());
            }
            ViewBag.IsUpdate = true;
            Material_Type materialType = _typeBll.Find(Material_Type_Id);

            if (materialType == null)
            {
                return(View());
            }
            ViewBag.parent = materialType.Material_Type_Parent_Id == "000000" ? "无" : _typeBll.Find(materialType.Material_Type_Parent_Id)
                             .Material_Type_Name;
            return(View(materialType));
        }
        public string GetMaterialsByType(string typeId)
        {
            string name = _typeBll.Find(typeId).Material_Type_Name;
            List <Material_Info> materialInfos = _baseInfoBll.GetEntities(m => m.Material_Type_Name == name);

            return(JsonConvert.SerializeObject(materialInfos));
        }
Exemple #4
0
        private void GetAllTypes(Stack <string> materType, string typeName)
        {
            Material_Type materialType = _typeBll.GetEntity(m => m.Material_Type_Name == typeName);

            if (materialType.Material_Type_Parent_Id != "000000")
            {
                string name = _typeBll.Find(materialType.Material_Type_Parent_Id).Material_Type_Name;
                materType.Push(name);
                GetAllTypes(materType, name);
            }
        }