示例#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);
        }
示例#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));
     }
 }
示例#3
0
        ///<summary>DataSet cannot be null.</summary>
        public static DataSet ProcessQuery(DtoQueryBase dto)
        {
            if (dto.GetType() == typeof(DtoGeneralGetTable))
            {
                return(GeneralB.GetTable(((DtoGeneralGetTable)dto).Command));
            }
            else if (dto.GetType() == typeof(DtoGeneralGetTableLow))
            {
                return(GeneralB.GetTableLow(((DtoGeneralGetTableLow)dto).Command));
            }
            else if (dto.GetType() == typeof(DtoGeneralGetDataSet))
            {
                return(GeneralB.GetDataSet(((DtoGeneralGetDataSet)dto).Commands));
            }
            else if (dto.GetType() == typeof(DtoAccountModuleGetAll))
            {
                return(AccountModuleB.GetAll(((DtoAccountModuleGetAll)dto).PatNum));
            }
            else if (dto.GetType() == typeof(DtoChartModuleGetAll))
            {
                return(ChartModuleB.GetAll(((DtoChartModuleGetAll)dto).PatNum, ((DtoChartModuleGetAll)dto).IsAuditMode));
            }
            else if (dto.GetType() == typeof(DtoCovCatRefresh))
            {
                return(CovCatB.Refresh());
            }
            else if (dto.GetType() == typeof(DtoDefRefresh))
            {
                return(DefB.Refresh());
            }
            else if (dto.GetType() == typeof(DtoPrefRefresh))
            {
                return(PrefB.Refresh());
            }
            else if (dto.GetType() == typeof(DtoProcedureRefresh))
            {
                return(ProcedureB.Refresh(((DtoProcedureRefresh)dto).PatNum));
            }
            else if (dto.GetType() == typeof(DtoUserodRefresh))
            {
                return(UserodB.Refresh());
            }


            else
            {
                throw new Exception("OpenDentServer.BusinessLayer.ProcessObject(dto) is missing a case for "
                                    + dto.GetType().ToString());
            }
        }
示例#4
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());
     }
 }