Пример #1
0
        protected void dgrXepLoaiNhom_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "edit")
            {
                int id = ConvertUtility.ToInt32(e.CommandArgument);

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

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

                    XepLoaiNhomController.Delete(id);

                    lblStatusUpdate.Text = MiscUtility.MSG_UPDATE_SUCCESS;
                }
                catch (Exception ex)
                {
                    lblStatusUpdate.Text = ex.Message;
                }
            }
        }
Пример #2
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

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

            if (id > 0)
            {
                XepLoaiNhomInfo info = XepLoaiNhomController.GetInfo(id);

                if (info != null)
                {
                    dropNhom.SelectedValue    = info.IDNhomNhanVien.ToString();
                    dropXepLoai.SelectedValue = info.IDXepLoai.ToString();
                    txtMin.Text = info.Min.ToString();
                    txtMax.Text = info.Max.ToString();
                }
            }
            else
            {
                btnUpdate.Visible = false;
            }
            dgrXepLoaiNhom.DataSource = XepLoaiNhomController.GetAll();
            dgrXepLoaiNhom.DataBind();
        }
Пример #3
0
        protected void btnThemMoi_Click(object sender, EventArgs e)
        {
            XepLoaiNhomInfo info = new XepLoaiNhomInfo();

            info.IDNhomNhanVien = ConvertUtility.ToInt32(dropNhom.SelectedValue);
            info.IDXepLoai      = ConvertUtility.ToInt32(dropXepLoai.SelectedValue);
            info.Min            = ConvertUtility.ToInt32(txtMin.Text);
            info.Max            = ConvertUtility.ToInt32(txtMax.Text);

            XepLoaiNhomController.Insert(info);
        }
Пример #4
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            int id = ConvertUtility.ToInt32(Request.QueryString["id"]);

            XepLoaiNhomInfo info = new XepLoaiNhomInfo();

            info.ID             = id;
            info.IDNhomNhanVien = ConvertUtility.ToInt32(dropNhom.SelectedValue);
            info.IDXepLoai      = ConvertUtility.ToInt32(dropXepLoai.SelectedValue);
            info.Min            = ConvertUtility.ToInt32(txtMin.Text);
            info.Max            = ConvertUtility.ToInt32(txtMax.Text);

            XepLoaiNhomController.Update(info);
        }