示例#1
0
 protected void Filter_Click(object sender, EventArgs e)
 {
     try
     {
         string strWhere = " 1=1 ";
         if (Common.StringClass.Check(txtFilterName.Text))
         {
             strWhere += " and NameT like N'%" + txtFilterName.Text + "%' ";
         }
         if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
         {
             strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' ";
         }
         grdTypeFilm.CurrentPageIndex = 0;
         grdTypeFilm.DataSource       = TypeFilmService.TypeFilm_GetByTop("", strWhere, "");
         grdTypeFilm.DataBind();
         if (grdTypeFilm.PageCount <= 1)
         {
             grdTypeFilm.PagerStyle.Visible = false;
         }
         else
         {
             grdTypeFilm.PagerStyle.Visible = true;
         }
     }
     catch (Exception ex)
     {
         WebMsgBox.Show(ex.Message);
     }
 }
示例#2
0
        protected void lbtDeleteB_Click(object sender, EventArgs e)
        {
            try
            {
                DataGridItem item = default(DataGridItem);
                for (int i = 0; i < grdTypeFilm.Items.Count; i++)
                {
                    item = grdTypeFilm.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();
                            TypeFilmService.TypeFilm_Delete(strId);
                        }
                    }
                }

                grdTypeFilm.CurrentPageIndex = 0;
                LoadFilterNewsNameAutocomplete();
                BindGrid();
            }
            catch (Exception ex)
            {
                WebMsgBox.Show(ex.Message);
            }
        }
示例#3
0
 private void BindGrid()
 {
     try
     {
         grdTypeFilm.DataSource = TypeFilmService.TypeFilm_GetByAll();
         grdTypeFilm.DataBind();
     }
     catch (Exception ex)
     {
         WebMsgBox.Show(ex.Message);
     }
 }
示例#4
0
        private void LoadFilterTypeFilmDropDownList()
        {
            ddlFilterypeFilm.Items.Clear();
            ddlFilterypeFilm.Items.Add(new ListItem(" -- View all -- ", ""));
            var dt = new DataTable();

            dt = TypeFilmService.TypeFilm_GetByAll();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ddlFilterypeFilm.Items.Add(new ListItem(Common.StringClass.ShowNameLevel(dt.Rows[i]["NameT"].ToString(), "0"), dt.Rows[i]["TypId"].ToString()));
            }
            ddlFilterypeFilm.DataBind();
        }
示例#5
0
        private void ViewTypeFilm()
        {
            ddlTypId_Update.Items.Clear();
            ddlTypId_Update.Items.Add(new ListItem("=== Choose TypeFilm ===", "0"));
            var dt = new DataTable();

            dt = TypeFilmService.TypeFilm_GetByAll();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ddlTypId_Update.Items.Add(new ListItem(Common.StringClass.ShowNameLevel(dt.Rows[i]["NameT"].ToString(), ""), dt.Rows[i]["TypId"].ToString()));
            }
            ddlTypId_Update.DataBind();
            dt.Rows.Clear();
        }
示例#6
0
 private void LoadFilterNewsNameAutocomplete()
 {
     try
     {
         string strName = "";
         var    dt      = new DataTable();
         dt = TypeFilmService.TypeFilm_GetByAll();
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             strName += dt.Rows[i]["NameT"].ToString() + "|";
         }
         ListTypeFilm = Common.StringClass.Check(strName) && strName.Substring(strName.Length - 1).Contains("|")
                        ? strName.Substring(0, strName.Length - 1)
                        : strName;
     }
     catch (Exception ex)
     {
         WebMsgBox.Show(ex.Message);
     }
 }
示例#7
0
        protected void lbtUpdateB_Click(object sender, EventArgs e)
        {
            #region [TestInput]
            if (txtName.Text.Trim().Equals(""))
            {
                WebMsgBox.Show("Name not null !");
                txtName.Focus();
                return;
            }
            #endregion

            try
            {
                var obj = new TypeFilmInfo();
                obj.TypId  = txtId.Value;
                obj.NameT  = txtName.Text;
                obj.Status = chkActive.Checked ? "1" : "0";
                if (_insert == true)
                {
                    TypeFilmService.TypeFilm_Insert(obj);
                }
                else
                {
                    TypeFilmService.TypeFilm_Update(obj);
                }
                BindGrid();
                LoadFilterNewsNameAutocomplete();
                pnView.Visible   = true;
                pnUpdate.Visible = false;
                _insert          = false;
            }
            catch (Exception ex)
            {
                WebMsgBox.Show(ex.Message);
            }
        }
示例#8
0
 protected void grdTypeFilm_ItemCommand(object source, DataGridCommandEventArgs e)
 {
     try
     {
         string strCa    = e.CommandArgument.ToString();
         string strWhere = " 1=1 ";
         if (e.CommandName == "Edit")
         {
             _insert = false;
             DataTable dt = TypeFilmService.TypeFilm_GetById(strCa);
             txtId.Value       = dt.Rows[0]["TypId"].ToString();
             txtName.Text      = dt.Rows[0]["NameT"].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")
         {
             TypeFilmService.TypeFilm_Delete(strCa);
             BindGrid();
         }
         if (e.CommandName == "Status")
         {
             string strA = "";
             string str  = e.Item.Cells[2].Text;
             strA = str == "1" ? "0" : "1";
             TypeFilmService.TypeFilm_Update_Status(strCa, strA);
             BindGrid();
         }
         if (e.CommandName == "ascTypeFilm")
         {
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and NameT like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' ";
             }
             grdTypeFilm.DataSource = TypeFilmService.TypeFilm_GetByTop("", strWhere, "NameT");
             grdTypeFilm.DataBind();
             if (grdTypeFilm.PageCount <= 1)
             {
                 grdTypeFilm.PagerStyle.Visible = false;
             }
         }
         if (e.CommandName == "descTypeFilm")
         {
             if (Common.StringClass.Check(txtFilterName.Text))
             {
                 strWhere += " and NameT like N'%" + txtFilterName.Text + "%' ";
             }
             if (Common.StringClass.Check(ddlFilterActive.SelectedValue))
             {
                 strWhere += " and Status = '" + ddlFilterActive.SelectedValue + "' ";
             }
             grdTypeFilm.DataSource = TypeFilmService.TypeFilm_GetByTop("", strWhere, "NameT desc");
             grdTypeFilm.DataBind();
             if (grdTypeFilm.PageCount <= 1)
             {
                 grdTypeFilm.PagerStyle.Visible = false;
             }
         }
     }
     catch (Exception ex)
     {
         WebMsgBox.Show(ex.Message);
     }
 }