SendCStoreRequest Example for C#

//LEADDICOMNet1 is a predefined LEADDicomNet object
//LEADDICOM1 is a DICOM Dataset defined outside this method
private void TestSendCStoreRequest ( )
{
   short nRet = 0;
   int hPDU = 0;
   int nID = 0;
   string szClassUID = null;
   string szInstanceUID = null;
   //send a store request to the server
   hPDU = LEADDICOMNet1.GetAssociate(LEADDICOMNet1.hNet);
   //pick the data set to send
   nRet = LEADDICOM1.LoadDS("e:\\images\\dicom16.dic", 0);
   if (nRet != 0)
   {
      MessageBox.Show("Error Loading Data Set!", "Error");
      System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
      return;
   }
   LEADDICOM1.FindFirstElement((int)LTDICLib.DicomDataSetTagConstants1.TAG_SOP_INSTANCE_UID, false);
   LEADDICOM1.GetStringValue(0, 1);
   szInstanceUID = LEADDICOM1.get_StringValues(0);
   LEADDICOM1.MoveFirstElement(false);
   LEADDICOM1.FindFirstElement((int)LTDICLib.DicomDataSetTagConstants1.TAG_SOP_CLASS_UID, false);
   LEADDICOM1.GetStringValue(0, 1);
   szClassUID = LEADDICOM1.get_StringValues(0);
   //send the command set
   nID = LEADDICOMNet1.FindPresentationAbstract(hPDU, szClassUID);
   if (nID == 0)
   {
      nRet = LEADDICOM1.FindUID(szClassUID);
      if (nRet == 0)
         MessageBox.Show("Abstract Syntax, " + LEADDICOM1.get_CurrentUID().Name + ", Not Supported by Association!");
      else
         MessageBox.Show("Abstract Syntax, " + szClassUID + ", Not Supported by Association!");
      System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
      return;
   }
   LEADDICOMNet1.SendCStoreRequest(LEADDICOMNet1.hNet, (short)nID, 999, szClassUID, szInstanceUID, (short)LTDICLib.DicomCommandSetMessagePriorities.COMMAND_PRIORITY_MEDIUM, "", 0, LEADDICOM1.hDicomDS);
   System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
}