Ejemplo 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;
                var 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);
                        //Delete cache
                        CacheController.GetListSupport_Delete();
                    }

                    i++;
                }
            }
            catch
            {
                Response.Redirect(Utility.UrlRoot + Config.PathError, false);
                return;
            }
            BindGird();
            CacheController.GetListSupport_Delete();//delete cache

            //        BindGird(int.Parse(ddlNewType.Text), 0);
        }
Ejemplo n.º 2
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";
            }
        }