예제 #1
0
        protected void lbtDeleteB_Click(object sender, EventArgs e)
        {
            try
            {
                DataGridItem item = default(DataGridItem);
                for (int i = 0; i < grdFilm.Items.Count; i++)
                {
                    item = grdFilm.Items[i];
                    if (item.ItemType == ListItemType.AlternatingItem | item.ItemType == ListItemType.Item)
                    {
                        if (((CheckBox)item.FindControl("ChkSelect")).Checked)
                        {
                            string strId = item.Cells[1].Text;
                            var    dt    = new DataTable();
                            FilmService.Film_Delete(strId);
                        }
                    }
                }

                grdFilm.CurrentPageIndex = 0;
                LoadFilterNewsNameAutocomplete();
                BindGrid();
            }
            catch (Exception ex)
            {
                WebMsgBox.Show(ex.Message);
            }
        }
예제 #2
0
 protected void grdFilm_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     try
     {
         string strCa    = e.CommandArgument.ToString();
         string strWhere = " 1=1 ";
         if (e.CommandName == "Edit")
         {
             _insert = false;
             DataTable dt = FilmService.Film_GetById(strCa);
             ddlCouId_Update.SelectedValue = dt.Rows[0]["CouId"].ToString();
             ddlTypId_Update.SelectedValue = dt.Rows[0]["TypId"].ToString();
             txtId.Value                = dt.Rows[0]["FilId"].ToString();
             txtName.Text               = dt.Rows[0]["NameF"].ToString();
             txtDirector.Text           = dt.Rows[0]["Director"].ToString();
             txtActor.Text              = dt.Rows[0]["Actor"].ToString();
             txtDuration.Text           = dt.Rows[0]["Duration"].ToString();
             imgImage.ImageUrl          = dt.Rows[0]["Picture"].ToString();
             imgImageBig.ImageUrl       = dt.Rows[0]["PictureBig"].ToString();
             txtPicture.Text            = dt.Rows[0]["Picture"].ToString();
             txtPictureBig.Text         = dt.Rows[0]["PictureBig"].ToString();
             FCKeditorDescription.Value = dt.Rows[0]["Description"].ToString();
             FCKeditorDetail.Value      = dt.Rows[0]["Detail"].ToString();
             chkActive.Checked          = dt.Rows[0]["Status"].ToString() == "1" || dt.Rows[0]["Status"].ToString() == "True";
             pnUpdate.Visible           = true;
             pnView.Visible             = false;
         }
         if (e.CommandName == "Delete")
         {
             FilmService.Film_Delete(strCa);
             BindGrid();
         }
         if (e.CommandName == "Status")
         {
             string strA = "";
             string str  = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             FilmService.Film_Update_Status(strCa, strA);
             BindGrid();
         }
         if (e.CommandName == "ascFilm")
         {
             if (Common.StringClass.Check(ddlFilterypeFilm.SelectedValue))
             {
                 strWhere += " and TypId = '" + ddlFilterypeFilm.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(ddlFilterCountry.SelectedValue))
             {
                 strWhere += " and CouId = '" + ddlFilterCountry.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and NameF like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' ";
             }
             grdFilm.DataSource = FilmService.Film_GetByTop("", strWhere, "NameF");
             grdFilm.DataBind();
             if (grdFilm.PageCount <= 1)
             {
                 grdFilm.PagerStyle.Visible = false;
             }
         }
         if (e.CommandName == "descFilm")
         {
             if (Common.StringClass.Check(ddlFilterypeFilm.SelectedValue))
             {
                 strWhere += " and TypId = '" + ddlFilterypeFilm.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(ddlFilterCountry.SelectedValue))
             {
                 strWhere += " and CouId = '" + ddlFilterCountry.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and NameF like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' ";
             }
             grdFilm.DataSource = FilmService.Film_GetByTop("", strWhere, "NameF desc");
             grdFilm.DataBind();
             if (grdFilm.PageCount <= 1)
             {
                 grdFilm.PagerStyle.Visible = false;
             }
         }
     }
     catch (Exception ex)
     {
         WebMsgBox.Show(ex.Message);
     }
 }