Example #1
0
    protected void btnUpdateAtachFile_Click(object sender, DirectEventArgs e)
    {
        HttpPostedFile file    = file_cv.PostedFile;
        string         path    = string.Empty;
        string         tenfile = string.Empty;

        if (file != null)
        {
            if (!file_cv.PostedFile.FileName.EndsWith(".exe"))
            {
                if (file_cv.HasFile == false && file.ContentLength > 2000000)
                {
                    Dialog.ShowNotification("File không được lớn hơn 200kb");
                    return;
                }
                else
                {
                    DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/Modules/TuyenDung/AttachFile"));
                    if (dir.Exists == false)
                    {
                        dir.Create();
                    }
                    tenfile = file_cv.FileName;
                    while (Util.GetInstance().FileIsExists("../../TuyenDung/AttachFile/" + tenfile) == true)
                    {
                        tenfile = Util.GetInstance().GetRandomString(3) + file_cv.FileName;
                    }
                    path = Server.MapPath("../../TuyenDung/AttachFile/" + tenfile);
                }

                if (string.IsNullOrEmpty(path) == false && string.IsNullOrEmpty(tenfile) == false)
                {
                    file.SaveAs(path);
                }
                DAL.TepTinDinhKem hsttdk = new DAL.TepTinDinhKem();

                hsttdk.TenTepTin   = txtFileName.Text;
                hsttdk.GhiChu      = txtGhiChu.Text;
                hsttdk.FR_KEY      = decimal.Parse(hdfRecordID.Text);
                hsttdk.Link        = tenfile;
                hsttdk.CreatedDate = DateTime.Now;
                hsttdk.CreatedBy   = CurrentUser.ID;
                hsttdk.SizeKB      = (file_cv.PostedFile.ContentLength / 1024);
                TepTinDinhKemControler hsttdkcontroller = new TepTinDinhKemControler();
                hsttdkcontroller.Insert(hsttdk);
                GridPanel_TepTinDinhkem.Reload();
                if (e.ExtraParams["Close"] == "True")
                {
                    wdAttachFile.Hide();
                }
            }
            else
            {
                X.MessageBox.Alert("Cảnh báo", "Định dạng file upload không đúng").Show();
                return;
            }
        }
    }
Example #2
0
 public void btn_Delete_File_Click(object sender, DirectEventArgs e)
 {
     try
     {
         foreach (var item in RowSelectionModel_TepTinDinhKem.SelectedRows)
         {
             new TepTinDinhKemControler().Delete(int.Parse("0" + item.RecordID));
         }
         btn_Download_File.Disabled = true;
         btn_Delete_File.Disabled   = true;
         GridPanel_TepTinDinhkem.Reload();
         RowSelectionModel_BangCap.ClearSelections();
     }
     catch (Exception ex)
     {
         Dialog.ShowError(ex.Message);
     }
 }
Example #3
0
 private void resetTabPanelAfterUpdate()
 {
     img_anhdaidien.ImageUrl = "../../NhanSu/ImageNhanSu/No_person.jpg";
     lblHoTen.Reset();
     lblGioiTinh.Reset();
     lblTTHN.Reset();
     lblEmail.Reset();
     lblTuoi.Reset();
     lblQuocGia.Reset();
     lblDanToc.Reset();
     lblTinhThanh.Reset();
     lblTonGiao.Reset();
     lblNoiOHienNay.Reset();
     lblChuyenNganh.Reset();
     lblTruongDaoTao.Reset();
     lblKinhNghiem.Reset();
     lblUuDiem.Reset();
     lblNhuocDiem.Reset();
     GridPanel_ChungChi.Reload();
     GridPanel_KinhNghiemLamViec.Reload();
     GridPanel_BangCap.Reload();
     GridPanel_TepTinDinhkem.Reload();
     GridPanel_KetQuaPV.Reload();
 }