Exemplo n.º 1
0
        ///<summary>Gets one email message from the database.</summary>
        public static EmailMessage GetOne(int msgNum)
        {
            string commands = "SELECT * FROM emailmessage WHERE EmailMessageNum = " + POut.PInt(msgNum)
                              + ";SELECT * FROM emailattach WHERE EmailMessageNum = " + POut.PInt(msgNum);
            DataSet ds = null;

            try {
                if (RemotingClient.OpenDentBusinessIsLocal)
                {
                    ds = GeneralB.GetDataSet(commands);
                }
                else
                {
                    DtoGeneralGetDataSet dto = new DtoGeneralGetDataSet();
                    dto.Commands = commands;
                    ds           = RemotingClient.ProcessQuery(dto);
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
            }
            DataTable    table = ds.Tables[0];
            EmailMessage Cur   = new EmailMessage();

            if (table.Rows.Count == 0)
            {
                return(null);
            }
            //for(int i=0;i<table.Rows.Count;i++){
            Cur.EmailMessageNum = PIn.PInt(table.Rows[0][0].ToString());
            Cur.PatNum          = PIn.PInt(table.Rows[0][1].ToString());
            Cur.ToAddress       = PIn.PString(table.Rows[0][2].ToString());
            Cur.FromAddress     = PIn.PString(table.Rows[0][3].ToString());
            Cur.Subject         = PIn.PString(table.Rows[0][4].ToString());
            Cur.BodyText        = PIn.PString(table.Rows[0][5].ToString());
            Cur.MsgDateTime     = PIn.PDateT(table.Rows[0][6].ToString());
            Cur.SentOrReceived  = (CommSentOrReceived)PIn.PInt(table.Rows[0][7].ToString());
            table           = ds.Tables[1];
            Cur.Attachments = new List <EmailAttach>();
            EmailAttach attach;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                attach = new EmailAttach();
                attach.EmailAttachNum    = PIn.PInt(table.Rows[i][0].ToString());
                attach.EmailMessageNum   = PIn.PInt(table.Rows[i][1].ToString());
                attach.DisplayedFileName = PIn.PString(table.Rows[i][2].ToString());
                attach.ActualFileName    = PIn.PString(table.Rows[i][3].ToString());
                Cur.Attachments.Add(attach);
            }
            return(Cur);
        }
Exemplo n.º 2
0
 ///<summary>Same as GetDataSet, but will throw exception if query fails instead of displaying message.</summary>
 public static DataSet GetDataSetEx(string commands)
 {
     if (RemotingClient.OpenDentBusinessIsLocal)
     {
         return(GeneralB.GetDataSet(commands));
     }
     else
     {
         DtoGeneralGetDataSet dto = new DtoGeneralGetDataSet();
         dto.Commands = commands;
         return(RemotingClient.ProcessQuery(dto));
     }
 }
Exemplo n.º 3
0
 ///<summary>This is for multiple queries all concatenated together with ;</summary>
 public static DataSet GetDataSet(string commands)
 {
     try {
         if (RemotingClient.OpenDentBusinessIsLocal)
         {
             return(GeneralB.GetDataSet(commands));
         }
         else
         {
             DtoGeneralGetDataSet dto = new DtoGeneralGetDataSet();
             dto.Commands = commands;
             return(RemotingClient.ProcessQuery(dto));
         }
     }
     catch (Exception e) {
         MessageBox.Show(e.Message);
         return(new DataSet());
     }
 }