protected void btnLogin_Click(object sender, EventArgs e) { DateTime currentDate = DateTime.Now; string username = Request.Cookies["userLoginSystem"].Value; var acc = AccountController.GetByUsername(username); if (acc != null) { if (acc.RoleID == 0) { int id = Convert.ToInt32(ViewState["ID"]); var pi = ProductImageController.GetByID(id); if (pi != null) { bool isHidden = chkIsHidden.Checked; ///Lưu ảnh string duongdan = "/uploads/images/"; string IMG = ""; if (hinhDaiDien.UploadedFiles.Count > 0) { foreach (UploadedFile f in hinhDaiDien.UploadedFiles) { var o = duongdan + Guid.NewGuid() + f.GetExtension(); try { f.SaveAs(Server.MapPath(o)); IMG = o; } catch { } } } else { IMG = imgDaiDien.ImageUrl; } ProductImageController.Update(id, IMG, isHidden, currentDate, username); PJUtils.ShowMessageBoxSwAlert("Cập nhật hình ảnh thành công", "s", true, Page); } } } }