Example #1
0
    protected void btnLuu_Click(object sender, EventArgs e)
    {
        if (Session["AdminLogined"] != null)
        {
            if (Page.IsValid && FileUpload1.HasFile)
            {
                string filename      = Path.GetRandomFileName() + Path.GetExtension(FileUpload1.FileName);
                string fileName_save = Path.Combine(Server.MapPath("~/uploadimages/thuvienanh"), filename);
                FileUpload1.SaveAs(fileName_save);
                image = "/uploadimages/thuvienanh/" + filename;
            }
            admin_User logedMember = Session["AdminLogined"] as admin_User;

            ctl_newbuilding cls  = new ctl_newbuilding();
            cls_ThemVideo   clss = new cls_ThemVideo();
            {
                if (Session["_id"].ToString() == "0")
                {
                    if (checknull() == false)
                    {
                        alert.alert_Warning(Page, "Hãy nhập đầy đủ thông tin!", "");
                    }
                    else
                    if (clss.Video_them(txtlink.Text, image))
                    {
                        alert.alert_Success(Page, "Thêm thành công", "");
                        setNULL();
                    }
                    else
                    {
                        alert.alert_Error(Page, "Thêm thất bại", "");
                    }
                }
                else
                {
                    if (cls.Linq_suavideo(Convert.ToInt32(Session["_id"].ToString()), txtlink.Text, image))
                    {
                        ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "Alert", "swal('Cập nhật thành công','','success').then(function(){grvList.Refresh();})", true);
                        popupControl.ShowOnPageLoad = false;
                        loadData();
                    }
                    else
                    {
                        alert.alert_Error(Page, "Cập nhật thất bại", "");
                    }
                }
            }
            // loadData();
        }
        // popupControl.ShowOnPageLoad = false;
    }