Exemplo n.º 1
0
        ///<summary>For one patient. This should be followed by Documents.Refresh</summary>
        public static List <DocAttach> Refresh(int patNum)
        {
            string  command = "SELECT * FROM docattach WHERE PatNum = " + POut.PInt(patNum);
            DataSet ds      = null;

            try {
                if (RemotingClient.OpenDentBusinessIsLocal)
                {
                    ds = GeneralB.GetTable(command);
                }
                else
                {
                    DtoGeneralGetTable dto = new DtoGeneralGetTable();
                    dto.Command = command;
                    ds          = RemotingClient.ProcessQuery(dto);
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
            }
            DataTable        table = ds.Tables[0];
            List <DocAttach> list  = new List <DocAttach>();       //[table.Rows.Count];
            DocAttach        attach;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                attach = new DocAttach();
                attach.DocAttachNum = PIn.PInt(table.Rows[i][0].ToString());
                attach.PatNum       = PIn.PInt(table.Rows[i][1].ToString());
                attach.DocNum       = PIn.PInt(table.Rows[i][2].ToString());
                list.Add(attach);
            }
            return(list);
        }
Exemplo n.º 2
0
 ///<summary>Same as GetCount, but will throw exception if query fails instead of displaying message.</summary>
 public static string GetCountEx(string command)
 {
     if (RemotingClient.OpenDentBusinessIsLocal)
     {
         return(GeneralB.GetTable(command).Tables[0].Rows[0][0].ToString());
     }
     else
     {
         DtoGeneralGetTable dto = new DtoGeneralGetTable();
         dto.Command = command;
         return(RemotingClient.ProcessQuery(dto).Tables[0].Rows[0][0].ToString());
     }
 }
Exemplo n.º 3
0
        ///<summary>Same as GetTable, but will throw exception if query fails instead of displaying message.  Used in ClassConvertDatabase and any place where we want to be able to suppress the exception message or handle it differently.</summary>
        public static DataTable GetTableEx(string command)
        {
            DataTable retVal;

            if (RemotingClient.OpenDentBusinessIsLocal)
            {
                retVal = GeneralB.GetTable(command).Tables[0].Copy();
            }
            else
            {
                DtoGeneralGetTable dto = new DtoGeneralGetTable();
                dto.Command = command;
                retVal      = RemotingClient.ProcessQuery(dto).Tables[0].Copy();
            }
            retVal.TableName = "";          //this is needed for FormQuery dataGrid
            return(retVal);
        }
Exemplo n.º 4
0
 ///<summary>Use this for count(*) queries.  They are always guaranteed to return one and only one value.  Not any faster, just handier.  Can also be used when retrieving prefs manually, since they will also return exactly one value</summary>
 public static string GetCount(string command)
 {
     try {
         if (RemotingClient.OpenDentBusinessIsLocal)
         {
             return(GeneralB.GetTable(command).Tables[0].Rows[0][0].ToString());
         }
         else
         {
             DtoGeneralGetTable dto = new DtoGeneralGetTable();
             dto.Command = command;
             return(RemotingClient.ProcessQuery(dto).Tables[0].Rows[0][0].ToString());
         }
     }
     catch (Exception e) {
         MessageBox.Show(e.Message);
         return("");
     }
 }
Exemplo n.º 5
0
        /*
         * ///<summary></summary>
         * public static Document[] GetAllWithPat(int patNum) {
         *      string command="SELECT * FROM document WHERE WithPat="+POut.PInt(patNum);
         *      return RefreshAndFill(command);
         * }*/

        private static Document[] RefreshAndFill(string command)
        {
            DataSet ds = null;

            try {
                if (RemotingClient.OpenDentBusinessIsLocal)
                {
                    ds = GeneralB.GetTable(command);
                }
                else
                {
                    DtoGeneralGetTable dto = new DtoGeneralGetTable();
                    dto.Command = command;
                    ds          = RemotingClient.ProcessQuery(dto);
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
            }
            DataTable table = ds.Tables[0];

            Document[] List = new Document[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i]                = new Document();
                List[i].DocNum         = PIn.PInt(table.Rows[i][0].ToString());
                List[i].Description    = PIn.PString(table.Rows[i][1].ToString());
                List[i].DateCreated    = PIn.PDate(table.Rows[i][2].ToString());
                List[i].DocCategory    = PIn.PInt(table.Rows[i][3].ToString());
                List[i].WithPat        = PIn.PInt(table.Rows[i][4].ToString());
                List[i].FileName       = PIn.PString(table.Rows[i][5].ToString());
                List[i].ImgType        = (ImageType)PIn.PInt(table.Rows[i][6].ToString());
                List[i].IsFlipped      = PIn.PBool(table.Rows[i][7].ToString());
                List[i].DegreesRotated = PIn.PInt(table.Rows[i][8].ToString());
                List[i].ToothNumbers   = PIn.PString(table.Rows[i][9].ToString());
                List[i].Note           = PIn.PString(table.Rows[i][10].ToString());
                List[i].SigIsTopaz     = PIn.PBool(table.Rows[i][11].ToString());
                List[i].Signature      = PIn.PString(table.Rows[i][12].ToString());
            }
            return(List);
        }
Exemplo n.º 6
0
        ///<summary>Only used in FormDefinitions</summary>
        public static Def[] GetCatList(int myCat)
        {
            string command =
                "SELECT * from definition"
                + " WHERE category = '" + myCat + "'"
                + " ORDER BY ItemOrder";
            DataSet ds = null;

            try {
                if (RemotingClient.OpenDentBusinessIsLocal)
                {
                    ds = GeneralB.GetTable(command);
                }
                else
                {
                    DtoGeneralGetTable dto = new DtoGeneralGetTable();
                    dto.Command = command;
                    ds          = RemotingClient.ProcessQuery(dto);
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
            }
            DataTable table = ds.Tables[0];

            Def[] List = new Def[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i]           = new Def();
                List[i].DefNum    = PIn.PInt(table.Rows[i][0].ToString());
                List[i].Category  = (DefCat)PIn.PInt(table.Rows[i][1].ToString());
                List[i].ItemOrder = PIn.PInt(table.Rows[i][2].ToString());
                List[i].ItemName  = PIn.PString(table.Rows[i][3].ToString());
                List[i].ItemValue = PIn.PString(table.Rows[i][4].ToString());
                List[i].ItemColor = Color.FromArgb(PIn.PInt(table.Rows[i][5].ToString()));
                List[i].IsHidden  = PIn.PBool(table.Rows[i][6].ToString());
            }
            return(List);
        }
Exemplo n.º 7
0
 ///<summary></summary>
 public static DataTable GetTable(string command)
 {
     try {
         DataTable retVal;
         if (RemotingClient.OpenDentBusinessIsLocal)
         {
             retVal = GeneralB.GetTable(command).Tables[0].Copy();
         }
         else
         {
             DtoGeneralGetTable dto = new DtoGeneralGetTable();
             dto.Command = command;
             retVal      = RemotingClient.ProcessQuery(dto).Tables[0].Copy();
         }
         retVal.TableName = "";              //this is needed for FormQuery dataGrid
         return(retVal);
     }
     catch (Exception e) {
         MessageBox.Show(e.Message);
         return(new DataTable());
     }
 }
Exemplo n.º 8
0
        private static Signal[] RefreshAndFill(string command)
        {
            //we don't want an error message to show, because that can cause a cascade of a large number of error messages.
            DataTable table = null;

            try {
                if (RemotingClient.OpenDentBusinessIsLocal)
                {
                    table = GeneralB.GetTable(command).Tables[0];
                }
                else
                {
                    DtoGeneralGetTable dto = new DtoGeneralGetTable();
                    dto.Command = command;
                    table       = RemotingClient.ProcessQuery(dto).Tables[0];
                }
            }
            catch {
                //MessageBox.Show(e.Message);
                return(new Signal[0]);
            }
            Signal[] List = new Signal[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                List[i]             = new Signal();
                List[i].SignalNum   = PIn.PInt(table.Rows[i][0].ToString());
                List[i].FromUser    = PIn.PString(table.Rows[i][1].ToString());
                List[i].ITypes      = (InvalidTypes)PIn.PInt(table.Rows[i][2].ToString());
                List[i].DateViewing = PIn.PDate(table.Rows[i][3].ToString());
                List[i].SigType     = (SignalType)PIn.PInt(table.Rows[i][4].ToString());
                List[i].SigText     = PIn.PString(table.Rows[i][5].ToString());
                List[i].SigDateTime = PIn.PDateT(table.Rows[i][6].ToString());
                List[i].ToUser      = PIn.PString(table.Rows[i][7].ToString());
                List[i].AckTime     = PIn.PDateT(table.Rows[i][8].ToString());
            }
            Array.Sort(List);
            return(List);
        }