Esempio n. 1
0
        ///<summary>Gets logs from the passed in datetime and before.</summary>
        public static List <InsEditLog> GetLogsForPlan(long planNum, long carrierNum, long employerNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <List <InsEditLog> >(MethodBase.GetCurrentMethod(), planNum, carrierNum, employerNum));
            }
            List <long> listCarrierNums = InsEditLogs.GetAssociatedCarrierNums(planNum);

            listCarrierNums.Add(carrierNum);
            List <InsEditLog> retVal  = new List <InsEditLog>();
            string            command = @"SELECT PlanNum FROM insplan WHERE PlanNum = " + POut.Long(planNum);
            long insPlanNum           = Db.GetLong(command);

            command         = @"SELECT CarrierNum FROM carrier WHERE CarrierNum IN (" + string.Join(",", listCarrierNums) + @")";
            listCarrierNums = Db.GetListLong(command);
            command         = @"SELECT EmployerNum FROM employer WHERE EmployerNum=" + POut.Long(employerNum);
            long          empNum       = Db.GetLong(command);
            List <string> listWhereOrs = new List <string>();

            if (insPlanNum > 0)
            {
                listWhereOrs.Add("(LogType=" + POut.Int((int)InsEditLogType.InsPlan) + " AND FKey = " + POut.Long(insPlanNum) + ")");
            }
            if (listCarrierNums.Count > 0)
            {
                listWhereOrs.Add("(LogType=" + POut.Int((int)InsEditLogType.Carrier) + " AND FKey IN (" + string.Join(",", listCarrierNums) + "))");
            }
            if (empNum > 0)
            {
                listWhereOrs.Add("(LogType=" + POut.Int((int)InsEditLogType.Employer) + " AND FKey=" + POut.Long(empNum) + ")");
            }
            listWhereOrs.Add("(LogType=" + POut.Int((int)InsEditLogType.Benefit) + " AND ParentKey=" + POut.Long(planNum) + ")");
            command = @"SELECT * FROM inseditlog
				WHERE "                 + string.Join(@"
				OR "                , listWhereOrs);
            List <InsEditLog> listLogs = Crud.InsEditLogCrud.SelectMany(command);           //get all of the logs

            //get any logs that show that InsPlan's PlanNum changed
            return(GetChangedLogs(listLogs).OrderBy(x => x.DateTStamp)
                   .ThenBy(x => x.LogType != InsEditLogType.InsPlan)
                   .ThenBy(x => x.LogType != InsEditLogType.Carrier)
                   .ThenBy(x => x.LogType != InsEditLogType.Employer)
                   .ThenBy(x => x.LogType != InsEditLogType.Benefit)
                   .ThenBy(x => x.FKey)
                   //primary keys first
                   .ThenBy(x => x.LogType == InsEditLogType.Benefit?(x.FieldName != "BenefitNum")
                                        :x.LogType == InsEditLogType.Carrier?(x.FieldName != "CarrierNum")
                                        :x.LogType == InsEditLogType.Employer?(x.FieldName != "EmployerNum")
                                        :(x.FieldName != "PlanNum")).ToList());
        }
Esempio n. 2
0
        ///<summary>Returns whether appt reminders are enabled and at least one rule with TSPrior set.</summary>
        public static bool UsesApptReminders()
        {
            bool isEnabled = PrefC.GetBool(PrefName.ApptRemindAutoEnabled);

            if (!isEnabled)
            {
                return(false);
            }
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetBool(MethodBase.GetCurrentMethod()));
            }
            return(Db.GetLong("SELECT count(*) FROM ApptReminderRule WHERE TSPrior>0") > 0);
        }
Esempio n. 3
0
        ///<summary>Returns the original prepayment.</summary>
        public static PaySplit GetOriginalPrepayment(PaySplit paySplit)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <PaySplit>(MethodBase.GetCurrentMethod(), paySplit));
            }
            long fSplitNum = paySplit.FSplitNum;

            if (paySplit.UnearnedType == 0)           //paySplit is pos allocation split, find negative income transfer split first
            {
                fSplitNum = Db.GetLong("SELECT FSplitNum FROM paysplit WHERE paysplit.SplitNum=" + POut.Long(paySplit.FSplitNum));
            }
            string command = "SELECT * FROM paysplit WHERE paysplit.SplitNum=" + POut.Long(fSplitNum);

            return(Crud.PaySplitCrud.SelectOne(command));
        }
Esempio n. 4
0
        ///<summary>Returns a single manualPageNum for the given manualPageName and manualVersion.</summary>
        public static long GetOneManualPageNum(string manualPageName, int manualVersion)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetLong(MethodBase.GetCurrentMethod(), manualPageName, manualVersion));
            }
            string command       = $@"
				SELECT ManualPageNum
				FROM manualpage
				WHERE manualpage.FileName='{manualPageName}'
				AND VersionOd={manualVersion}
			"            ;
            long   manualPageNum = 0;

            DataAction.RunManualPublisherHQ(() => {
                manualPageNum = Db.GetLong(command);
            });
            return(manualPageNum);
        }