Ejemplo n.º 1
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel(channel_id, DTEnums.ActionEnum.Delete.ToString()); //检查权限
     BLL.guidaudio bll = new BLL.guidaudio();
     Model.guidaudio model_audio = null;
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             model_audio = bll.GetGuidAudioModel(id);
             if (model_audio != null)
             {
                 if (File.Exists(Server.MapPath(model_audio.audio_path)))
                 {
                     //如果存在则删除
                     File.Delete(Server.MapPath(model_audio.audio_path));
                 }
             }
             bll.Delete(id);
         }
     }
     JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}",
     this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success");
 }
Ejemplo n.º 2
0
        private void ShowInfo(int _id)
        {
            BLL.guidaudio bll = new BLL.guidaudio();
            Model.guidaudio model = bll.GetGuidAudioModel(_id);

            txtTitle.Text = model.audio_name;
            txtImgUrl.Text = model.img_url;
            if (model.is_top == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            txtSortId.Text = model.sort_id.ToString();
        }
Ejemplo n.º 3
0
 //设置操作
 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     ChkAdminLevel(channel_id, DTEnums.ActionEnum.Edit.ToString()); //检查权限
     int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);
     BLL.guidaudio bll = new BLL.guidaudio();
     Model.guidaudio model = bll.GetGuidAudioModel(id);
     switch (e.CommandName.ToLower())
     {
         case "ibtntop":
             if (model.is_top == 1)
                 bll.UpdateField(id, "is_top=0");
             else
                 bll.UpdateField(id, "is_top=1");
             break;
         case "ibtnred":
             if (model.is_red == 1)
                 bll.UpdateField(id, "is_red=0");
             else
                 bll.UpdateField(id, "is_red=1");
             break;
     }
     this.RptBind("id>0" + CombSqlTxt(this.channel_id, this.category_id, this.keywords, this.property), "sort_id asc,add_time desc");
 }
Ejemplo n.º 4
0
        private bool DoEdit(int _id)
        {
            bool result = true;
            BLL.guidaudio bll = new BLL.guidaudio();
            Model.guidaudio model = bll.GetGuidAudioModel(_id);

            model.channel_id = this.channel_id;
            model.audio_name = txtTitle.Text.Trim();
            model.img_url = txtImgUrl.Text.Trim();
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.is_red = 0;
            model.is_top = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_top = 1;
            }
            if (cblItem.Items[1].Selected == true)
            {
                model.is_red = 1;
            }
            if (!bll.Update(model))
            {
                result = false;
            }
            return result;
        }