Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var id = Request.QueryString["id"];

            if (!IsPostBack)
            {
                var ctx = new DataContext();
                var dt  = ctx.ExecuteDataTable("Select * from Content Where State<>255 And ID=" + id);
                if (dt != null && dt.Rows.Count > 0)
                {
                    Content = dt.ToList <Model.Content>()[0];
                }
                img_1.ImgUrls = Content.ImageUrls;

                //加载栏目
                var bllChannels = new BLL.Channel();
                var channels    = bllChannels.GetChannels(ctx);

                ddlChannel.Items.Add(new ListItem("==请选择==", "0"));
                foreach (var channel in channels)
                {
                    var item = new ListItem(channel.Name, channel.ID.ToString());
                    item.Attributes.Add("contentType", channel.ContentType.ToString());
                    item.Attributes.Add("class", "channel");
                    item.Attributes.Add("type", channel.Type.ToString());

                    if (Content.ChannelID == channel.ID)
                    {
                        item.Attributes.Add("Selected", "Selected");
                    }
                    ddlChannel.Items.Add(item);
                }
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var bll = new BLL.Channel();

            Channels = bll.GetChannels(ctx) ?? new List <Model.Channel>();

            var tb = bll.Select(ctx, new Model.Config()
            {
                State = 0, Code = "Logo"
            });

            if (tb != null && tb.Rows.Count > 0)
            {
                LogoConfig = tb.ToList <Model.Config>()[0];
            }

            var gcs = bll.Select(ctx, new GlobeConfig()
            {
                Code = "Copyright"
            }).ToList <Model.GlobeConfig>();

            if (gcs != null && gcs.Count > 0)
            {
                this.Copyright = gcs[0].Text;
            }
        }
Exemple #3
0
        protected void submitbtn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.channelname.Text))
            {
                string myScript = @"alertMsg('渠道名称不能为空!','error.gif');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                return;
            }
            #region 删除
            //if (this.channeltype.SelectedValue=="0")
            //{
            //    string myScript = @"alertMsg('请选择行业分类!','error.gif');";
            //    Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //    return;
            //}
            //if (this.channeltype.SelectedValue == "1")
            //{
            //    if (string.IsNullOrEmpty(this.txtWebName.Text))
            //    {
            //        string myScript = @"alertMsg('网站名称不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    }
            //    if (string.IsNullOrEmpty(this.txtWebUrl.Text))
            //    {
            //        string myScript = @"alertMsg('网站地址不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    }
            //}
            //else if (this.channeltype.SelectedValue == "5")
            //{
            //    if (string.IsNullOrEmpty(this.txtWebName.Text))
            //    {
            //        string myScript = @"alertMsg('软件名称不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    }
            //    if (string.IsNullOrEmpty(this.txtWebUrl.Text))
            //    {
            //        string myScript = @"alertMsg('软件下载连接不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    }
            //}
            //else if (this.channeltype.SelectedValue == "10")
            //{
            //    if (string.IsNullOrEmpty(this.txtWebName.Text))
            //    {
            //        string myScript = @"alertMsg('应用商店名称不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    }
            //    if (string.IsNullOrEmpty(this.txtWebUrl.Text))
            //    {
            //        string myScript = @"alertMsg('应用商店下载连接不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    }
            //}
            //else if (this.channeltype.SelectedValue == "12")
            //{
            //    if (string.IsNullOrEmpty(this.txtWebName.Text))
            //    {
            //        string myScript = @"alertMsg('网站名称不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    }
            //    if (string.IsNullOrEmpty(this.txtWebUrl.Text))
            //    {
            //        string myScript = @"alertMsg('网站地址不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    }
            //}
            //else if (this.channeltype.SelectedValue == "16")
            //{
            //    if (string.IsNullOrEmpty(this.txtWebName.Text))
            //    {
            //        string myScript = @"alertMsg('APP名称不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    }
            //    if (string.IsNullOrEmpty(this.txtWebUrl.Text))
            //    {
            //        string myScript = @"alertMsg('APP下载连接不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    }
            //}
            //else if (this.channeltype.SelectedValue == "19")
            //{
            //    if (string.IsNullOrEmpty(this.txtWebName.Text))
            //    {
            //        string myScript = @"alertMsg('自身资源说明不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    }

            //}
            //else if (this.channeltype.SelectedValue == "19")
            //{
            //    if (string.IsNullOrEmpty(this.txtWebName.Text))
            //    {
            //        string myScript = @"alertMsg('自身资源说明不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    }

            //}
            //else if (this.channeltype.SelectedValue == "21")
            //{
            //    if (string.IsNullOrEmpty(this.txtWebName.Text))
            //    {
            //        string myScript = @"alertMsg('自身资源说明不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    }

            //}
            //else if (this.channeltype.SelectedValue == "23")
            //{
            //    if (string.IsNullOrEmpty(this.txtWebName.Text))
            //    {
            //        string myScript = @"alertMsg('名称不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    } 
            //    if (string.IsNullOrEmpty(this.txtWebUrl.Text))
            //    {
            //        string myScript = @"alertMsg('覆盖AP数量不能为空!','error.gif');";
            //        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            //        return;
            //    }

            //}
            #endregion
            //批量删除
            string ClassList="";
            int n = 0;
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("lb_id")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id");
                if (cb.Checked)
                {
                    ClassList += id.ToString();
                    n++;
                }
            }
            if (n == 0)
            {
                string myScript = @"alertMsg('请选择产品!','error.gif');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                return;
            }
            else if (n>1)
            {
                string myScript = @"alertMsg('只能选择一种商品推广!','error.gif');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                return;
            }
            try
            {
                modeluser = blluser.GetModelByName(Request.Cookies["UserPage_UID"].Value.ToString());
                Model.Channel cModel = new Model.Channel();
                BLL.Channel cbll = new BLL.Channel();
                cModel.Title = channelname.Text;
                cModel.CatalogID = "";//channeltype.SelectedValue;
                cModel.Name = "";//txtWebName.Text;
                cModel.Url = "";//txtWebUrl.Text;
                cModel.ParentId = int.Parse(ClassList);
                cModel.Status = 1;
                cModel.UserID = modeluser.ID;
                cModel.Bak1 = "game" + ClassList + "_" + DateTime.Now.ToString("MMdd");
                int num=cbll.Add(cModel);
                if (num>0)
                {
                    Model.Log modLog = new Model.Log();
                    modLog.UserId = num;
                    modLog.UserName = channelname.Text;
                    InsertLog(modLog);
                    string myScript = @"alertRedirectMsg('渠道添加成功!','success.gif','Channel.aspx');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                }
            }
            catch
            {
                string myScript = @"alertMsg('渠道添加失败!','error.gif');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                return;
            }
        }