Esempio n. 1
0
        ///<summary>Combines all the given employers into one. Updates patient and insplan. Then deletes all the others.
        ///No need to pass in usernum, it is set before the remoting role and passed in for logging.</summary>
        public static void Combine(List <long> employerNums, long userNum = 0)
        {
            if (RemotingClient.RemotingRole != RemotingRole.ServerWeb)
            {
                userNum = Security.CurUser.UserNum;              //must be before normal remoting role check to get user at workstation
            }
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), employerNums, userNum);
                return;
            }
            long newNum = employerNums[0];

            for (int i = 1; i < employerNums.Count; i++)
            {
                string command = "UPDATE patient SET EmployerNum = " + POut.Long(newNum)
                                 + " WHERE EmployerNum = " + POut.Long(employerNums[i]);
                Db.NonQ(command);
                command = "SELECT * FROM insplan WHERE EmployerNum = " + POut.Long(employerNums[i]);
                List <InsPlan> listInsPlans = Crud.InsPlanCrud.SelectMany(command);
                command = "UPDATE insplan SET EmployerNum = " + POut.Long(newNum)
                          + " WHERE EmployerNum = " + POut.Long(employerNums[i]);
                Db.NonQ(command);
                listInsPlans.ForEach(x => {                 //log updated employernums for insplan.
                    InsEditLogs.MakeLogEntry("EmployerNum", userNum, employerNums[i].ToString(), newNum.ToString(),
                                             InsEditLogType.InsPlan, x.PlanNum, 0, x.GroupNum + " - " + x.GroupName);
                });
                Employer employerCur = Employers.GetEmployer(employerNums[i]); //from the cache
                Employers.Delete(employerCur);                                 //logging taken care of in Delete method.
            }
        }
Esempio n. 2
0
        ///<summary>Combines all the given employers into one. Updates patient and insplan. Then deletes all the others.</summary>
        public static void Combine(List <long> employerNums)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), employerNums);
                return;
            }
            long newNum = employerNums[0];

            for (int i = 1; i < employerNums.Count; i++)
            {
                string command = "UPDATE patient SET EmployerNum = " + POut.Long(newNum)
                                 + " WHERE EmployerNum = " + POut.Long(employerNums[i]);
                Db.NonQ(command);
                command = "SELECT * FROM insplan WHERE EmployerNum = " + POut.Long(employerNums[i]);
                List <InsPlan> listInsPlans = Crud.InsPlanCrud.SelectMany(command);
                command = "UPDATE insplan SET EmployerNum = " + POut.Long(newNum)
                          + " WHERE EmployerNum = " + POut.Long(employerNums[i]);
                Db.NonQ(command);
                //Security.CurUser.UserNum gets set on MT by the DtoProcessor so it matches the user from the client WS.
                listInsPlans.ForEach(x => {                 //log updated employernums for insplan.
                    InsEditLogs.MakeLogEntry("EmployerNum", Security.CurUser.UserNum, employerNums[i].ToString(), newNum.ToString(),
                                             InsEditLogType.InsPlan, x.PlanNum, 0, x.GroupNum + " - " + x.GroupName);
                });
                Employer employerCur = Employers.GetEmployer(employerNums[i]); //from the cache
                Employers.Delete(employerCur);                                 //logging taken care of in Delete method.
            }
        }