private void TreeAddParnetORChild(int parent_id) { var type = new Material_Type(); if (materialTypeList.Count > 0) { type.Id = materialTypeList[materialTypeList.Count - 1].Id; } type.Parent_Id = Convert.ToInt32(parent_id); var addType = new AddType(); addType.type = type; addType.ShowDialog(); if (addType.DialogResult == DialogResult.OK) { materialTypeList.Add(addType.type); TreeDataBind(materialTypeList); } }
private void MaterialTypeItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { switch (e.Item.Name) { case "MaterialType_Add_Parent_BarButtonItem": TreeAddParnetORChild(Convert.ToInt32(parent_Id)); break; case "MaterialType_Add_Child_BarButtonItem": TreeAddParnetORChild(Convert.ToInt32(material_Type_Id)); break; case "MaterialType_Delete_BarButtonItem": DeleteMaterialType(); break; case "MaterialType_Modify_BarButtonItem": var materialType = materialTypeList.Find(t => t.Id == Convert.ToInt32(material_Type_Id)); var modifyType = new AddType(); modifyType.Text = "修改物料类型"; modifyType.type = materialType; modifyType.ShowDialog(); if (modifyType.DialogResult == DialogResult.OK) { materialTypeList.Remove(materialType); materialTypeList.Add(modifyType.type); TreeDataBind(materialTypeList); } break; case "btnMaterialAdd": var addMaterial = new AddMaterialInfor(); var material = new Material(); material.Material_Type_Id = Convert.ToInt32(material_Type_Id); addMaterial.material = material; addMaterial.ShowDialog(); break; } }
private void TreeAddParnetORChild(int parent_id) { var type = new Material_Type(); if (materialTypeList.Count > 0) type.Id = materialTypeList[materialTypeList.Count - 1].Id; type.Parent_Id = Convert.ToInt32(parent_id); var addType = new AddType(); addType.type = type; addType.ShowDialog(); if (addType.DialogResult == DialogResult.OK) { materialTypeList.Add(addType.type); TreeDataBind(materialTypeList); } }