public void saveMeeting() { if (checkData()) { string idDiaChi = insertDiaChi(); if (idDiaChi != null) { logical.dataRqUpload dtup = uploadFile(); DateTime ngay = frmaddMeeting.dtp_NgayHop.Value; DateTime gio = frmaddMeeting.dtp_GioHop.Value; string datestr = string.Format("{0:u}", ngay).Substring(0, 10); string timesrt = string.Format("{0:T}", gio); string datetime = datestr + " " + timesrt.Substring(0, timesrt.Length - 3); string sqlInsert = "insert into CuocHop(TieuDe,NoiDung,ThoiGian,IDDiaChi,ChuTri,ToTrinh,NguoiThem,NgayThem) values(N'" + frmaddMeeting.tb_TieuDe.Text + "',N'" + frmaddMeeting.tb_NoiDung.Text + "','" + datetime + "'," + idDiaChi + ",'" + frmaddMeeting.ccb_NguoiChuTri.SelectedValue + "',N'" + dtup.WebContentLink + "'," + caseData.DataTam.DuLieu.ID + ",getdate())"; if (daladdmeeting.them(sqlInsert) > 0) { sqlInsert = "insert into ThongBao(TieuDe,NoiDung,NgayDang,NguoiDang) values(N'" + frmaddMeeting.tb_TieuDe.Text + "',N'" + frmaddMeeting.tb_NoiDung.Text + "',getdate()," + caseData.DataTam.DuLieu.ID + ")"; daladdmeeting.them(sqlInsert); MessageBox.Show("Thêm cuộc họp thành công"); } else { MessageBox.Show("Thêm cuộc họp thất bại"); } } } }
private logical.dataRqUpload uploadFile() { caseData.txtRead txtread = new caseData.txtRead(); logical.GgDriveAPI ggDrive = new logical.GgDriveAPI(); logical.dataRqUpload dtup = new logical.dataRqUpload(); caseData.getTypeFile gettype = new caseData.getTypeFile(); string filename = System.IO.Path.GetFileName(frmaddMeeting.tb_linkToTrinh.Text); string duoiFile = filename.Split('.')[1]; string typefile = gettype.getType(duoiFile); string idFolder = txtread.readfile(2)[1]; try { dtup = ggDrive.uploadFileDriveGoogle(idFolder, filename, frmaddMeeting.tb_linkToTrinh.Text, (typefile + "/" + duoiFile)); return(dtup); } catch { return(null); } }