Beispiel #1
0
        ///<summary></summary>
        public static void Refresh()
        {
            try {
                if (RemotingClient.OpenDentBusinessIsLocal)
                {
                    UserodB.Refresh();
                }
                else
                {
                    DtoUserodRefresh dto = new DtoUserodRefresh();
                    DataSet          ds  = RemotingClient.ProcessQuery(dto);
                    UserodB.RawData = ds.Tables[0];
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
                return;
            }
            Listt = new List <Userod>();         //[UserB.RawData.Rows.Count];
            Userod user;

            for (int i = 0; i < UserodB.RawData.Rows.Count; i++)
            {
                user              = new Userod();
                user.UserNum      = PIn.PInt(UserodB.RawData.Rows[i][0].ToString());
                user.UserName     = PIn.PString(UserodB.RawData.Rows[i][1].ToString());
                user.Password     = PIn.PString(UserodB.RawData.Rows[i][2].ToString());
                user.UserGroupNum = PIn.PInt(UserodB.RawData.Rows[i][3].ToString());
                user.EmployeeNum  = PIn.PInt(UserodB.RawData.Rows[i][4].ToString());
                Listt.Add(user);
            }
        }
        ///<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);
        }
        ///<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);
        }
Beispiel #4
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());
     }
 }
Beispiel #5
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));
     }
 }
Beispiel #6
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);
        }
Beispiel #7
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());
     }
 }
Beispiel #8
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("");
     }
 }
 ///<summary>This is just the first version of this function.  It only gets selected parts of the Account refresh.</summary>
 public static DataSet GetAll(int patNum)
 {
     try {
         if (RemotingClient.OpenDentBusinessIsLocal)
         {
             return(AccountModuleB.GetAll(patNum));
         }
         else
         {
             DtoAccountModuleGetAll dto = new DtoAccountModuleGetAll();
             dto.PatNum = patNum;
             return(RemotingClient.ProcessQuery(dto));
         }
     }
     catch (Exception e) {
         MessageBox.Show(e.Message);
         return(new DataSet());               //It might be better to return null.
     }
 }
Beispiel #10
0
 ///<summary>This is just the first version of this function.  It only gets selected parts of the Chart refresh.</summary>
 public static DataSet GetAll(int patNum, bool isAuditMode)
 {
     try {
         if (RemotingClient.OpenDentBusinessIsLocal)
         {
             return(ChartModuleB.GetAll(patNum, isAuditMode));
         }
         else
         {
             DtoChartModuleGetAll dto = new DtoChartModuleGetAll();
             dto.PatNum      = patNum;
             dto.IsAuditMode = isAuditMode;
             return(RemotingClient.ProcessQuery(dto));
         }
     }
     catch (Exception e) {
         MessageBox.Show(e.Message);
         return(null);
     }
 }
Beispiel #11
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);
        }
Beispiel #12
0
        ///<summary></summary>
        public static void Refresh()
        {
            DataSet ds = null;

            try {
                if (RemotingClient.OpenDentBusinessIsLocal)
                {
                    ds = PrefB.Refresh();
                }
                else
                {
                    DtoPrefRefresh dto = new DtoPrefRefresh();
                    ds = RemotingClient.ProcessQuery(dto);
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
                return;
            }
            PrefB.FillHList(ds.Tables[0]);            //now, we have an HList on both the client and the server.
        }
Beispiel #13
0
        ///<summary></summary>
        public static void Refresh()
        {
            DataSet ds = null;

            try {
                if (RemotingClient.OpenDentBusinessIsLocal)
                {
                    CovCatB.Refresh();
                }
                else
                {
                    DtoCovCatRefresh dto = new DtoCovCatRefresh();
                    ds = RemotingClient.ProcessQuery(dto);
                    CovCatB.FillLists(ds);                    //now, we have both lists on both the client and the server.
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
                return;
            }
        }
Beispiel #14
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);
        }
Beispiel #15
0
 ///<summary>This is used for queries written by the user.  If using the server component, it uses the user with lower privileges  to prevent injection attack.</summary>
 public static DataTable GetTableLow(string command)
 {
     try {
         DataTable retVal;
         if (RemotingClient.OpenDentBusinessIsLocal)
         {
             retVal = GeneralB.GetTable(command).Tables[0].Copy();
         }
         else
         {
             DtoGeneralGetTableLow dto = new DtoGeneralGetTableLow();
             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());
     }
 }
Beispiel #16
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);
        }