protected void btn_add_Click(object sender, EventArgs e) { string unit = Path.GetExtension(FileUpload1.FileName); string type_img = ""; if (unit == ".jpg" || unit == ".png" || unit == ".jfif") { string path = Server.MapPath("img\\"); type_img = FileUpload1.FileName; FileUpload1.SaveAs(path + type_img); } else { txtKQ.InnerText = "Hình ảnh chưa được chọn!"; return; } int id = Convert.ToInt32(Session["type_id"]); string type_name = txtName.Text; DateTime modified = DateTime.Now; string username = txtUserName.Text; int status = Convert.ToInt32(ddl_type_status.SelectedValue); int type_post = Convert.ToInt32(ddl_type_post.SelectedValue); if (status == -1 || type_post == -1) { txtKQ.InnerText = "Status hoặc Type Post chưa được chọn!"; return; } if (txtName.Text.Equals("") || txtUserName.Text.Equals("")) { txtKQ.InnerText = "Type Name hoặc User Name của bạn đang bị bỏ trống!"; return; } if (FoodType.update_food_type(id, type_name, type_post, type_img, status, username, modified)) { txtKQ.InnerText = "Chỉnh Sửa Thành Công!"; } else { txtKQ.InnerText = "Chỉnh Sửa Thất Bại!"; } }