using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CY.BLL.Sys; using CY.Model; namespace CY.WebForm.Pages.sysInquiry { public partial class PrintType : System.Web.UI.UserControl { SysInquiry_PrintingTypeBLL _printingTypeBLL = new SysInquiry_PrintingTypeBLL(); public string PrintTypeListStr; public string OnClick = string.Empty; public string UserType = string.Empty; public Guid FirmId = Guid.Empty; public void SetPrintTypeListStr() { IList parentList = null; if (UserType == "1") { parentList = _printingTypeBLL.SelectParentModelListBySpecial(); } else if (UserType == "2") { parentList = _printingTypeBLL.SelectParentModelListByAfterConsumption(FirmId); } else if (UserType == "3") { parentList = _printingTypeBLL.SelectParentModelListByAfterSet(FirmId); } IEnumerable childList = null; PrintTypeListStr = "[{ id: -1, parentId: 0, name: \"印刷类型\" }"; if (parentList != null&&parentList.Count>0) { foreach (SysInquiry_PrintingType parent in parentList) { PrintTypeListStr += " ,{id:" + parent.KeyId + ",parentId:-1,name:\"" + parent.PrintName + "\"}"; if (UserType == "1") { childList = _printingTypeBLL.SelectUsedModlesBySpecial(parent.KeyId); } else if (UserType == "2") { childList = _printingTypeBLL.SelectUsedModlesByAfterConsumption(parent.KeyId, FirmId); } else if (UserType == "3") { childList = _printingTypeBLL.SelectUsedModlesByAfterSet(parent.KeyId, FirmId); } if (childList != null && childList.Count() > 0) { foreach (SysInquiry_PrintingType child in childList) { PrintTypeListStr += " ,{id:" + child.KeyId + ",parentId:" + parent.KeyId + ",name:\"" + child.PrintName + "\"}"; } } } } PrintTypeListStr += "]"; } protected void Page_Load(object sender, EventArgs e) { SetPrintTypeListStr(); } } }