protected void btnUpdate_Click(object sender, EventArgs e)
        {
            //Upload image
            string typefile = "";
            string file     = hdImage.Value; //Nếu file chưa có thì sẽ là rỗng

            if (fUp.FileName.Length > 0)
            {
                if (fUp.PostedFile.ContentLength < 5000000)
                {
                    if (fUp.PostedFile.ContentType.Equals("image/jpeg") ||
                        fUp.PostedFile.ContentType.Equals("image/pjpeg") ||
                        fUp.PostedFile.ContentType.Equals("image/x-png") ||
                        fUp.PostedFile.ContentType.Equals("image/png") ||
                        fUp.PostedFile.ContentType.Equals("image/gif") ||
                        fUp.PostedFile.ContentType.Equals("image/x-shockwave-flash"))
                    {
                        typefile = Path.GetExtension(fUp.FileName).ToLower();
                        file     = Path.GetFileName(fUp.PostedFile.FileName);
                        file     = fUp.FileName.Replace(file, "IFsoft_ProductImage" + DateTime.Now.Hour + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Minute + DateTime.Now.Second + typefile);
                        fUp.PostedFile.SaveAs(Server.MapPath("~/Images/") + file);
                    }
                }
            }

            //Kiểm tra image đã tồn tại
            if (!file.Equals(hdImage.Value))
            {
                if (!hdImage.Value.Equals(""))
                {
                    if (System.IO.File.Exists(Server.MapPath("~/Images/" + hdImage.Value)) == true)
                    {
                        System.IO.File.Delete(Server.MapPath("~/Images/" + hdImage.Value));
                    }
                }
            }

            if (!string.IsNullOrEmpty(txtName.Text.Trim()))
            {
                if (hdInsert.Value == "insert")
                {
                    //Thêm mới
                    bool active = chkActive.Checked ? true : false;
                    _product.InsertProductDetail(int.Parse(drpProductCategory.SelectedValue.ToString()),
                                                 int.Parse(txtCode.Text.Trim()), txtName.Text.Trim(), txtDesc.Text.Trim(),
                                                 txtContent.Text.Trim(), file, int.Parse(txtQuantity.Text.Trim()),
                                                 float.Parse(txtPrice.Text.Trim()), DateTime.Now, txtView.Text.Trim(), active);
                }
                else
                {
                    //Cập nhật
                    bool active = chkActive.Checked ? true : false;
                    _product.UpdateProductDetail(int.Parse(hdProDelID.Value.ToString()),
                                                 int.Parse(drpProductCategory.SelectedValue.ToString()),
                                                 int.Parse(txtCode.Text.Trim()), txtName.Text.Trim(), txtDesc.Text.Trim(),
                                                 txtContent.Text.Trim(), file, int.Parse(txtQuantity.Text.Trim()),
                                                 float.Parse(txtPrice.Text.Trim()), DateTime.Now, txtView.Text.Trim(), active);
                }
                Response.Redirect(Request.Url.ToString());
            }
        }