コード例 #1
0
        public ActionResult Index()
        {
            var webCategory = WebsiteBLL.GetwebCategory();
            var sbc         = string.Empty;

            if (webCategory != null && webCategory.Rows.Count > 0)
            {
                foreach (DataRow dr in webCategory.Rows)
                {
                    sbc += "<option value='" + dr["webCategoryCode"] + "'>" + dr["webCategoryName"] + "</option>";
                }
            }
            ViewBag.webCategoryid = sbc;
            return(View());
        }
コード例 #2
0
        public ActionResult AddWebSite()
        {
            var id = Request["id"];

            ViewBag.webGroupId = Request["Gid"];
            var webPlatform = WebsiteBLL.GetwebPlatform();
            var webCategory = WebsiteBLL.GetwebCategory();

            if (id != null)
            {
                var dt = WebsiteBLL.GetWebsiteByid(id);
                if (dt != null && dt.Rows.Count > 0)
                {
                    var keyNames = string.Join(",", dt.AsEnumerable().Select(d => d.Field <string>("keyName")).ToArray());
                    var keyUrls  = string.Join(",", dt.AsEnumerable().Select(d => d.Field <string>("keyUrl")).ToArray());
                    var webData  = dt.Rows[0];
                    ViewBag.webName       = webData["webName"];
                    ViewBag.loginName     = webData["loginName"];
                    ViewBag.loginPassword = webData["loginPassword"];
                    ViewBag.webHost       = webData["webHost"];
                    ViewBag.categoryCode  = webData["categoryCode"];
                    ViewBag.categoryName  = webData["categoryName"];
                    ViewBag.id            = webData["id"];
                    ViewBag.webAdminUrl   = webData["webAdminUrl"];
                    ViewBag.WordKey       = keyNames;
                    ViewBag.WordUrl       = keyUrls;
                    ViewBag.webGroupId    = webData["webGroupId"];
                    ViewBag.webImgPath    = webData["webImgPath"];
                    var wu = string.Empty;
                    if (keyNames != "")
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            wu += "<tr><td>" + dr["keyName"] + "</td><td>" + dr["keyUrl"] + "</td><td><a href='#' onclick='DeleteWebKey(this)'>删除</a></td></tr>";
                        }
                        ViewBag.keylist = wu;
                    }
                    var sb = string.Empty;
                    if (webPlatform != null && webPlatform.Rows.Count > 0)
                    {
                        foreach (DataRow dr in webPlatform.Rows)
                        {
                            if (dr["id"].ToString() == webData["webPlatformId"].ToString())
                            {
                                sb += "<option value='" + dr["id"] + "' selected='selected'>" + dr["webPlatformName"] + "</option>";
                                continue;
                            }
                            sb += "<option value='" + dr["id"] + "'>" + dr["webPlatformName"] + "</option>";
                        }
                    }
                    ViewBag.webPlatformId = sb;
                    var sbc = string.Empty;
                    if (webCategory != null && webCategory.Rows.Count > 0)
                    {
                        foreach (DataRow dr in webCategory.Rows)
                        {
                            if (dr["id"].ToString() == webData["webCategoryId"].ToString())
                            {
                                sbc += "<option value='" + dr["id"] + "' selected='selected'>" + dr["webCategoryName"] + "</option>";
                                continue;
                            }
                            sbc += "<option value='" + dr["id"] + "'>" + dr["webCategoryName"] + "</option>";
                        }
                    }
                    ViewBag.webCategoryid = sbc;
                }
            }
            else
            {
                var sb = string.Empty;
                if (webPlatform != null && webPlatform.Rows.Count > 0)
                {
                    foreach (DataRow dr in webPlatform.Rows)
                    {
                        sb += "<option value='" + dr["id"] + "'>" + dr["webPlatformName"] + "</option>";
                    }
                }
                ViewBag.webPlatformId = sb;
                var sbc = string.Empty;
                if (webCategory != null && webCategory.Rows.Count > 0)
                {
                    foreach (DataRow dr in webCategory.Rows)
                    {
                        sbc += "<option value='" + dr["id"] + "'>" + dr["webCategoryName"] + "</option>";
                    }
                }
                ViewBag.webCategoryid = sbc;
            }
            return(View());
        }