Esempio n. 1
0
        protected void btDelete_Click(object sender, EventArgs e)
        {
            if (!UserRightImpl.CheckRightAdminnistrator().UserDelete)
            {
                Response.Redirect(Utility.UrlRoot + Config.PathNotRight, false);
                return;
            }
            try
            {
                int         i   = 0;
                SupportImpl obj = new SupportImpl();
                foreach (GridViewRow row in grvView.Rows)
                {
                    var status = (CheckBox)row.Cells[2].FindControl("StatusCheck");

                    if (status.Checked)
                    {
                        int ID = int.Parse(grvView.DataKeys[i].Value.ToString());
                        obj.Delete(ID);
                    }

                    i++;
                }
            }
            catch
            {
                Response.Redirect(Utility.UrlRoot + Config.PathError, false);
                return;
            }
            BindGird();
            //        BindGird(int.Parse(ddlNewType.Text), 0);
        }
Esempio n. 2
0
        private void EditData()
        {
            try
            {
                SupportImpl obj  = new SupportImpl();
                SupportInfo item = obj.GetInfo(int.Parse(Request.QueryString["ID"]));

                if (item == null)
                {
                    Response.Redirect(Utility.UrlRoot + Config.PathError, false);
                    return;
                }
                else
                {
                    txtName.Text   = item.s_Name;
                    txtEmail.Text  = item.s_Email;
                    txtMobile.Text = item.s_Mobile;
                    txtSkype.Text  = item.s_Skype;
                    txtYahoo.Text  = item.s_Yahoo;
                }
            }
            catch
            {
                Response.Redirect(Utility.UrlRoot + Config.PathError, false);
                return;
            }
        }
Esempio n. 3
0
        private void BindGird()
        {
            try
            {
                var obj = new SupportImpl();
                List <SupportInfo> dt = obj.getListSupportInfo(5);

                //dt.DefaultView.Sort = sortString;

                grvView.DataSource = dt;
                grvView.DataBind();

                ltThongBao.Text = "<font color='red'>Có " + dt.Count + " thông tin được tìm thấy.</font>";
            }
            catch
            {
                Response.Redirect(Utility.UrlRoot + Config.PathError, false);
                return;
            }
        }
Esempio n. 4
0
        protected void btSubmit_Click(object sender, EventArgs e)
        {
            if (!UserRightImpl.CheckRightAdminnistrator().UserEdit)
            {
                Response.Redirect(Utility.UrlRoot + Config.PathNotRight, false);
                return;
            }

            try
            {
                int userID = 0;

                SupportImpl obj = new SupportImpl();
                if (Request.QueryString["ID"] != null && Request.QueryString["ID"] != string.Empty)
                {
                    try
                    {
                        userID = int.Parse(Request.QueryString["ID"]);

                        SupportInfo item = obj.GetInfo(userID);

                        if (item == null)
                        {
                            Response.Redirect(Utility.UrlRoot + Config.PathError, false);
                            return;
                        }
                        else
                        {
                            item.s_Name   = txtName.Text;
                            item.s_Email  = txtEmail.Text;
                            item.s_Mobile = txtMobile.Text;
                            item.s_Skype  = txtSkype.Text;
                            item.s_Yahoo  = txtYahoo.Text;
                            obj.Update(item);
                            //Delete cache
                            CacheController.GetListSupport_Delete();
                        }
                    }
                    catch
                    {
                        Response.Redirect(Utility.UrlRoot + Config.PathError, false);
                        return;
                    }
                }
                else
                {
                    SupportInfo item = new SupportInfo();
                    item.s_Name   = txtName.Text;
                    item.s_Email  = txtEmail.Text;
                    item.s_Mobile = txtMobile.Text;
                    item.s_Skype  = txtSkype.Text;
                    item.s_Yahoo  = txtYahoo.Text;

                    obj.Insert(item);
                    //Delete cache
                    CacheController.GetListSupport_Delete();
                }
                Response.Redirect("support_manager.aspx", false);
            }
            catch
            {
                lblMsg.Text = "Tên người hỗ trợ đã tồn tại. Bạn chạy chọn một tên khác";
            }
        }