Пример #1
0
        ///<summary></summary>
        public static void Delete(EmailMessage message)
        {
            if (message.EmailMessageNum == 0)
            {
                return;                                                                                              //this prevents deletion of all commlog entries of something goes wrong.
            }
            string command = "DELETE FROM emailmessage WHERE EmailMessageNum=" + POut.PInt(message.EmailMessageNum); //+";"

            //+"DELETE FROM commlog WHERE EmailMessageNum="+POut.PInt(message.EmailMessageNum);
            try {
                if (RemotingClient.OpenDentBusinessIsLocal)
                {
                    GeneralB.NonQ(command);
                }
                else
                {
                    DtoGeneralNonQ dto = new DtoGeneralNonQ();
                    dto.Command = command;
                    RemotingClient.ProcessCommand(dto);
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.Message);
            }
        }
Пример #2
0
 ///<summary>Same as NonQ, 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 int NonQEx(string command, bool getInsertID)
 {
     if (RemotingClient.OpenDentBusinessIsLocal)
     {
         return(GeneralB.NonQ(command, getInsertID));
     }
     else
     {
         DtoGeneralNonQ dto = new DtoGeneralNonQ();
         dto.Command     = command;
         dto.GetInsertID = getInsertID;
         return(RemotingClient.ProcessCommand(dto));
     }
 }
Пример #3
0
 ///<summary></summary>
 public static int NonQEx(string[] commands)
 {
     for (int i = 0; i < commands.Length; i++)
     {
         if (RemotingClient.OpenDentBusinessIsLocal)
         {
             GeneralB.NonQ(commands[i], false);
         }
         else
         {
             DtoGeneralNonQ dto = new DtoGeneralNonQ();
             dto.Command     = commands[i];
             dto.GetInsertID = false;
             RemotingClient.ProcessCommand(dto);
         }
     }
     return(0);
 }
Пример #4
0
 ///<summary>This query is run with full privileges.  This is for commands generated by the main program, and the user will not have access for injection attacks.  Result is usually number of rows changed, or can be insert id if requested.</summary>
 public static int NonQ(string command, bool getInsertID)
 {
     try {
         if (RemotingClient.OpenDentBusinessIsLocal)
         {
             return(GeneralB.NonQ(command, getInsertID));
         }
         else
         {
             DtoGeneralNonQ dto = new DtoGeneralNonQ();
             dto.Command     = command;
             dto.GetInsertID = getInsertID;
             return(RemotingClient.ProcessCommand(dto));
         }
     }
     catch (Exception e) {
         MessageBox.Show(e.Message);
         return(0);
     }
 }
Пример #5
0
 ///<summary>We need to get away from this due to poor support from databases.  For now, each command will be sent entirely separately.  This never returns number of rows affected.</summary>
 public static int NonQ(string[] commands)
 {
     try {
         for (int i = 0; i < commands.Length; i++)
         {
             if (RemotingClient.OpenDentBusinessIsLocal)
             {
                 GeneralB.NonQ(commands[i], false);
             }
             else
             {
                 DtoGeneralNonQ dto = new DtoGeneralNonQ();
                 dto.Command     = commands[i];
                 dto.GetInsertID = false;
                 RemotingClient.ProcessCommand(dto);
             }
         }
     }
     catch (Exception e) {
         MessageBox.Show(e.Message);
     }
     return(0);
 }
Пример #6
0
        public static int ProcessCommand(DtoCommandBase dto)
        {
            if (dto.GetType() == typeof(DtoDefInsert))
            {
                return(DefB.Insert(((DtoDefInsert)dto).DefCur));
            }
            else if (dto.GetType() == typeof(DtoDefUpdate))
            {
                return(DefB.Update(((DtoDefUpdate)dto).DefCur));
            }
            else if (dto.GetType() == typeof(DtoDocumentInsert))
            {
                return(DocumentB.Insert(((DtoDocumentInsert)dto).Doc, ((DtoDocumentInsert)dto).PatLF, ((DtoDocumentInsert)dto).PatNum));
            }
            else if (dto.GetType() == typeof(DtoDocumentUpdate))
            {
                return(DocumentB.Update(((DtoDocumentUpdate)dto).Doc));
            }
            else if (dto.GetType() == typeof(DtoEmailMessageUpdate))
            {
                return(EmailMessageB.Update(((DtoEmailMessageUpdate)dto).Message));
            }
            else if (dto.GetType() == typeof(DtoGeneralNonQ))
            {
                return(GeneralB.NonQ(((DtoGeneralNonQ)dto).Command, ((DtoGeneralNonQ)dto).GetInsertID));
            }
            else if (dto.GetType() == typeof(DtoLogin))
            {
                return(OpenDentalService.Login(((DtoLogin)dto).Database, ((DtoLogin)dto).OdUser, ((DtoLogin)dto).OdPassHash));
            }
            else if (dto.GetType() == typeof(DtoMiscDataMakeABackup))
            {
                return(MiscDataB.MakeABackup());
            }
            else if (dto.GetType() == typeof(DtoProcedureInsert))
            {
                return(ProcedureB.Insert(((DtoProcedureInsert)dto).Proc));
            }
            else if (dto.GetType() == typeof(DtoProcedureUpdate))
            {
                return(ProcedureB.Update(((DtoProcedureUpdate)dto).Proc, ((DtoProcedureUpdate)dto).OldProc));
            }
            else if (dto.GetType() == typeof(DtoProcedureDelete))
            {
                return(ProcedureB.Delete(((DtoProcedureDelete)dto).ProcNum));
            }
            else if (dto.GetType() == typeof(DtoProcedureUpdateAptNum))
            {
                return(ProcedureB.UpdateAptNum(((DtoProcedureUpdateAptNum)dto).ProcNum, ((DtoProcedureUpdateAptNum)dto).NewAptNum));
            }
            else if (dto.GetType() == typeof(DtoProcedureUpdatePlannedAptNum))
            {
                return(ProcedureB.UpdatePlannedAptNum(((DtoProcedureUpdatePlannedAptNum)dto).ProcNum,
                                                      ((DtoProcedureUpdatePlannedAptNum)dto).NewPlannedAptNum));
            }
            else if (dto.GetType() == typeof(DtoProcedureUpdatePriority))
            {
                return(ProcedureB.UpdatePriority(((DtoProcedureUpdatePriority)dto).ProcNum,
                                                 ((DtoProcedureUpdatePriority)dto).NewPriority));
            }
            else if (dto.GetType() == typeof(DtoProcedureUpdateFee))
            {
                return(ProcedureB.UpdateFee(((DtoProcedureUpdateFee)dto).ProcNum, ((DtoProcedureUpdateFee)dto).NewFee));
            }



            else
            {
                throw new Exception("OpenDentServer.BusinessLayer.ProcessCommand(dto) is missing a case for "
                                    + dto.GetType().ToString());
            }
        }