Exemplo n.º 1
0
        protected void dgrChucDanh_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "edit")
            {
                int id = ConvertUtility.ToInt32(e.CommandArgument);

                Response.Redirect(AppEnv.AdminUrlParams("dinhnghia") + "&id=" + id);
            }

            if (e.CommandName == "delete")
            {
                try
                {
                    int id = ConvertUtility.ToInt32(e.CommandArgument);

                    DinhNghiaController.Delete(id);

                    lblStatusUpdate.Text = MiscUtility.MSG_UPDATE_SUCCESS;
                }
                catch (Exception ex)
                {
                    lblStatusUpdate.Text = ex.Message;
                }
            }
        }
Exemplo n.º 2
0
        protected void btnThemMoi_Click(object sender, EventArgs e)
        {
            DinhNghiaInfo info = new DinhNghiaInfo();

            info.Ten  = txtTen.Text.Trim();
            info.MoTa = txtMoTa.Text;
            info.Code = dropTypeOf.SelectedValue;
            DinhNghiaController.Insert(info);
        }
Exemplo n.º 3
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            int id = ConvertUtility.ToInt32(Request.QueryString["id"]);

            DinhNghiaInfo info = new DinhNghiaInfo();

            info.ID   = id;
            info.Ten  = txtTen.Text.Trim();
            info.MoTa = txtMoTa.Text;
            info.Code = dropTypeOf.SelectedValue;
            DinhNghiaController.Update(info);
        }
Exemplo n.º 4
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            int id = ConvertUtility.ToInt32(Request.QueryString["id"]);

            if (id > 0)
            {
                DinhNghiaInfo info = DinhNghiaController.GetInfo(id);

                if (info != null)
                {
                    txtTen.Text              = info.Ten.ToString();
                    txtMoTa.Text             = info.MoTa;
                    dropTypeOf.SelectedValue = info.Code.ToString();
                }
            }
            else
            {
                btnUpdate.Visible = false;
            }
            dgrChucDanh.DataSource = DinhNghiaController.GetAll(dropTypeOf.SelectedValue);
            dgrChucDanh.DataBind();
        }