protected void Filter_Click(object sender, EventArgs e)
 {
     try
     {
         string strWhere = " 1=1 ";
         if (Common.StringClass.Check(ddlFilterCinema.SelectedValue))
         {
             strWhere += " and CinId = '" + ddlFilterCinema.SelectedValue + "' ";
         }
         if (Common.StringClass.Check(ddlFilterFilm.SelectedValue))
         {
             strWhere += " and FilId = '" + ddlFilterFilm.SelectedValue + "' ";
         }
         if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
         {
             strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' ";
         }
         grdShowTimes.CurrentPageIndex = 0;
         grdShowTimes.DataSource       = ShowTimesService.ShowTimes_GetByTop("", strWhere, "");
         grdShowTimes.DataBind();
         if (grdShowTimes.PageCount <= 1)
         {
             grdShowTimes.PagerStyle.Visible = false;
         }
         else
         {
             grdShowTimes.PagerStyle.Visible = true;
         }
     }
     catch (Exception ex)
     {
         WebMsgBox.Show(ex.Message);
     }
 }
 protected void grdShowTimes_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     try
     {
         string       strCa    = e.CommandArgument.ToString();
         string       strWhere = " 1=1 ";
         DataGridItem item     = default(DataGridItem);
         if (e.CommandName == "Edit")
         {
             _insert = false;
             DataTable dt = ShowTimesService.ShowTimes_GetById(strCa);
             ddlCinId_Update.SelectedValue = dt.Rows[0]["CinId"].ToString();
             ddlFilId_Update.SelectedValue = dt.Rows[0]["FilId"].ToString();
             txtId.Value       = dt.Rows[0]["ShoId"].ToString();
             txtShowTime.Text  = dt.Rows[0]["ShowTime"].ToString();
             txtPrice.Text     = dt.Rows[0]["Price"].ToString();
             txtTime.Text      = dt.Rows[0]["Time"].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")
         {
             ShowTimesService.ShowTimes_Delete(strCa);
             BindGrid();
         }
         if (e.CommandName == "Status")
         {
             string strA = "";
             string str  = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             ShowTimesService.ShowTimes_Update_Status(strCa, strA);
             BindGrid();
         }
         if (e.CommandName == "ascPrice")
         {
             if (Common.StringClass.Check(ddlFilterCinema.SelectedValue))
             {
                 strWhere += " and CinId = '" + ddlFilterCinema.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(ddlFilterFilm.SelectedValue))
             {
                 strWhere += " and FilId = '" + ddlFilterFilm.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' ";
             }
             grdShowTimes.DataSource = ShowTimesService.ShowTimes_GetByTop("", strWhere, "Price");
             grdShowTimes.DataBind();
             if (grdShowTimes.PageCount <= 1)
             {
                 grdShowTimes.PagerStyle.Visible = false;
             }
         }
         if (e.CommandName == "sortdesc")
         {
             if (Common.StringClass.Check(ddlFilterCinema.SelectedValue))
             {
                 strWhere += " and CinId = '" + ddlFilterCinema.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(ddlFilterFilm.SelectedValue))
             {
                 strWhere += " and FilId = '" + ddlFilterFilm.SelectedValue + "' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' ";
             }
             grdShowTimes.DataSource = ShowTimesService.ShowTimes_GetByTop("", strWhere, "NameF");
             grdShowTimes.DataBind();
             if (grdShowTimes.PageCount <= 1)
             {
                 grdShowTimes.PagerStyle.Visible = false;
             }
         }
     }
     catch (Exception ex)
     {
         WebMsgBox.Show(ex.Message);
     }
 }