Esempio n. 1
0
        private void butImport_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length != 1)
            {
                MsgBox.Show(this, "Please select one completed form from the list above first.");
                return;
            }
            long     sheetNum = PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["SheetNum"].ToString());
            long     docNum   = PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["DocNum"].ToString());
            Document doc      = null;

            if (docNum != 0)
            {
                doc = Documents.GetByNum(docNum);
                //Pdf importing broke with dot net 4.0 and was enver reimplemented.
                //See FormSheetImport.Load() region Acro
                //string extens=Path.GetExtension(doc.FileName);
                //if(extens.ToLower()!=".pdf") {
                //	MsgBox.Show(this,"Only pdf's and sheets can be imported into the database.");
                //	return;
                //}
            }
            Sheet sheet = null;

            if (sheetNum != 0)
            {
                sheet = Sheets.GetSheet(sheetNum);
                if (sheet.SheetType != SheetTypeEnum.PatientForm && sheet.SheetType != SheetTypeEnum.MedicalHistory)
                {
                    MsgBox.Show(this, "For now, only sheets of type 'PatientForm' and 'MedicalHistory' can be imported.");
                    return;
                }
            }
            if (sheet == null)
            {
                MsgBox.Show(this, "Only sheets can be imported into the database.");
                return;
            }
            FormSheetImport formSI = new FormSheetImport();

            formSI.SheetCur = sheet;
            formSI.DocCur   = doc;
            formSI.ShowDialog();
            //No need to refresh grid because no changes could have been made.
        }
		private void butImport_Click(object sender,EventArgs e) {
			if(gridMain.SelectedIndices.Length !=1) {
				MsgBox.Show(this,"Please select one completed form from the list above first.");
				return;
			}
			long sheetNum=PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["SheetNum"].ToString());
			long docNum=PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["DocNum"].ToString());
			Document doc=null;
			if(docNum!=0) {
				doc=Documents.GetByNum(docNum);
				string extens=Path.GetExtension(doc.FileName);
				if(extens.ToLower()!=".pdf") {
					MsgBox.Show(this,"Only pdf's and sheets can be imported into the database.");
					return;
				}
			}
			Sheet sheet=null;
			if(sheetNum!=0) {
				sheet=Sheets.GetSheet(sheetNum);
				if(sheet.SheetType!=SheetTypeEnum.PatientForm && sheet.SheetType!=SheetTypeEnum.MedicalHistory) {
					MsgBox.Show(this,"For now, only sheets of type 'PatientForm' and 'MedicalHistory' can be imported.");
					return;
				}
			}
			FormSheetImport formSI=new FormSheetImport();
			formSI.SheetCur=sheet;
			formSI.DocCur=doc;
			formSI.ShowDialog();
			//No need to refresh grid because no changes could have been made.
		}