Ejemplo n.º 1
0
 protected void Filter_Click(object sender, EventArgs e)
 {
     try
     {
         string strWhere = " 1=1 ";
         if (Common.StringClass.Check(txtFilterName.Text))
         {
             strWhere += " and NameCi like N'%" + txtFilterName.Text + "%' ";
         }
         if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
         {
             strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' ";
         }
         grdCinema.CurrentPageIndex = 0;
         grdCinema.DataSource       = CinemaService.Cinema_GetByTop("", strWhere, "");
         grdCinema.DataBind();
         if (grdCinema.PageCount <= 1)
         {
             grdCinema.PagerStyle.Visible = false;
         }
         else
         {
             grdCinema.PagerStyle.Visible = true;
         }
     }
     catch (Exception ex)
     {
         WebMsgBox.Show(ex.Message);
     }
 }
Ejemplo n.º 2
0
 private void LoadCinema()
 {
     try
     {
         rptCinema.DataSource = CinemaService.Cinema_GetByTop("", "Status=1", "");
         rptCinema.DataBind();
     }
     catch (Exception ex)
     {
         WebMsgBox.Show(ex.Message);
     }
 }
Ejemplo n.º 3
0
 protected void grdCinema_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     try
     {
         string strCa    = e.CommandArgument.ToString();
         string strWhere = " 1=1 ";
         if (e.CommandName == "Edit")
         {
             _insert = false;
             DataTable dt = CinemaService.Cinema_GetById(strCa);
             txtId.Value       = dt.Rows[0]["CinId"].ToString();
             txtName.Text      = dt.Rows[0]["NameCi"].ToString();
             txtAddress.Text   = dt.Rows[0]["Address"].ToString();
             txtSeats.Text     = dt.Rows[0]["Seats"].ToString();
             txtPhone.Text     = dt.Rows[0]["Phone"].ToString();
             txImage.Text      = dt.Rows[0]["Image"].ToString();
             imgImage.ImageUrl = dt.Rows[0]["Image"].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")
         {
             CinemaService.Cinema_Delete(strCa);
             BindGrid();
         }
         if (e.CommandName == "Status")
         {
             string strA = "";
             string str  = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             CinemaService.Cinema_Update_Status(strCa, strA);
             BindGrid();
         }
         if (e.CommandName == "ascCinema")
         {
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and NameCi like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' ";
             }
             grdCinema.DataSource = CinemaService.Cinema_GetByTop("", strWhere, "NameCi");
             grdCinema.DataBind();
             if (grdCinema.PageCount <= 1)
             {
                 grdCinema.PagerStyle.Visible = false;
             }
         }
         if (e.CommandName == "descCinema")
         {
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and NameCi like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' ";
             }
             grdCinema.DataSource = CinemaService.Cinema_GetByTop("", strWhere, "NameCi desc");
             grdCinema.DataBind();
             if (grdCinema.PageCount <= 1)
             {
                 grdCinema.PagerStyle.Visible = false;
             }
         }
     }
     catch (Exception ex)
     {
         WebMsgBox.Show(ex.Message);
     }
 }