protected void Button3_Click(object sender, EventArgs e)
 {
     if (TxtTenSP.Text.Length == 0 || TxtGia.Text.Length == 0 || TxtChitiet.Text.Length == 0 || FileAnh.FileName.Length == 0)
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "Loi", "Loi()", true);
     }
     else
     {
         try
         {
             string TenFile  = "";
             string DuongDan = "";
             if (FileAnh.HasFile)
             {
                 TenFile  = FileAnh.FileName;
                 DuongDan = Server.MapPath("~/css/images/");
                 FileAnh.SaveAs(DuongDan + TenFile);
             }
             Product_Add(DropLoaiSP.SelectedValue, TxtTenSP.Text, TxtGia.Text, TxtChitiet.Text, "~/css/images/" + TenFile);
             Page.ClientScript.RegisterStartupScript(this.GetType(), "Thêm thành công", "ThemThanhCong()", true);
         }
         catch
         {
             Page.ClientScript.RegisterStartupScript(this.GetType(), "Loi", "Loi()", true);
         }
     }
 }
    protected void Button3_Click(object sender, EventArgs e)
    {
        try
        {
            
            if(RNam.Checked){
                GT = RNam.Text;
            }
            if(RNu.Checked){
                GT = RNu.Text;
            }
            string TenFile = "";
            string DuongDan = "";
            if (FileAnh.HasFile)
            {
                TenFile = FileAnh.FileName;
                DuongDan = Server.MapPath("~/css/images/");
                FileAnh.SaveAs(DuongDan + TenFile);
            }

            Taotaikhoan(TxtUser.Text, TxtPass.Text, TxtHo.Text, TxtTen.Text, GT, TxtDC.Text, TxtSDT.Text, TxtEmail.Text, "~/NhomNguyenNhuY_Anh/" + TenFile);
            Page.ClientScript.RegisterStartupScript(this.GetType(), "TaoTaiKhoanThanhCong", "TaoTaiKhoanThanhCong()", true);
        
        }
        catch
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "TaoTaiKhoanThatBai", "TaoTaiKhoanThatBai()", true);
        }
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        if (TxtHo.Text.Length == 0 || TxtTen.Text.Length == 0 || TxtDC.Text.Length == 0 || TxtDT.Text.Length <= 5 || TxtEmail.Text.Length == 0)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "ThatBai", "ThatBai()", true);
        }
        else
        {
            try
            {
                string TenFile  = "";
                string DuongDan = "";
                if (FileAnh.HasFile)
                {
                    TenFile  = FileAnh.FileName;
                    DuongDan = Server.MapPath("~/css/images/");
                    FileAnh.SaveAs(DuongDan + TenFile);
                    TenFile = "~/css/images/" + FileAnh.FileName;
                }
                else
                {
                    TenFile = Anh.ImageUrl;
                }

                UpdateUserInformation(TxtHo.Text, TxtTen.Text, RadioButtonList1.SelectedValue, TxtDC.Text, TxtDT.Text, TxtEmail.Text, TenFile);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "ThanhCong()", true);
            }
            catch
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "ThatBai", "ThatBai()", true);
            }
        }
    }
Exemplo n.º 4
0
 protected void bntSua_Click(object sender, EventArgs e)
 {
     if ((txtTenMon.Text != "") && (txtMaMon.Text != "") && (txtDonGia.Text != "") && (txtDVT.Text != ""))
     {
         string TenFile = "";
         if (FileAnh.HasFile)
         {
             TenFile = FileAnh.FileName;
             FileAnh.SaveAs(Server.MapPath("~/Images/") + TenFile);
         }
         SuaMon(txtMaMon.Text, txtTenMon.Text, DropDownMaLoai.SelectedValue.ToString(), txtDonGia.Text, txtDVT.Text, TenFile);
         DgThucDon.DataSource = dsThucDon();
         DgThucDon.DataBind();
         if (DgThucDon.Rows.Count > 0)
         {
             DgThucDon.HeaderRow.Cells[0].Text = "Mã Món";
             DgThucDon.HeaderRow.Cells[1].Text = "Tên Món";
             DgThucDon.HeaderRow.Cells[2].Text = "Mã Loại";
             DgThucDon.HeaderRow.Cells[3].Text = "Đơn Giá";
             DgThucDon.HeaderRow.Cells[4].Text = "Đơn Vị Tính";
             DgThucDon.HeaderRow.Cells[5].Text = "Ảnh Món";
         }
         txtMaMon.Text    = "";
         txtTenMon.Text   = "";
         txtDVT.Text      = "";
         txtDonGia.Text   = "";
         txtThongBao.Text = "Sửa thành công!";
     }
     else
     {
         txtThongBao.Text = "Không được bỏ trống thuộc tính!";
     }
 }
Exemplo n.º 5
0
        protected void BtnThem_Click(object sender, EventArgs e)
        {
            if (FileAnh.PostedFile != null && FileNhac.PostedFile != null)
            {
                try
                {
                    string fileImg   = Path.GetFileName(FileAnh.PostedFile.FileName);
                    string fileAudio = Path.GetFileName(FileNhac.PostedFile.FileName);

                    FileAnh.SaveAs(Server.MapPath("Imgs/" + fileImg));
                    FileNhac.SaveAs(Server.MapPath("Audios/" + fileAudio));

                    Nhac x = new Nhac(txtMa.Text.Trim()
                                      , txtTuaBH.Text.Trim()
                                      , txtCasy.Text.Trim()
                                      , txtGioiTinh.Text.Trim()
                                      , txtEmail.Text.Trim()
                                      , txtTheLoai.Text.Trim()
                                      , txtNam.Text.Trim()
                                      , "Imgs/" + fileImg
                                      , "Audios/" + fileAudio);
                    lst.Add(x);
                    thongbao.InnerHtml = "Them thanh cong!";
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                }
            }
            else
            {
                thongbao.InnerHtml = "Them that bai!";
            }
        }