Esempio n. 1
0
    public static int TaskSendingNow()
    {
        Model_SendingJobItem ci = new Model_SendingJobItem();
        Model_SendingJob     c  = new Model_SendingJob();
        Model_Setting        s  = new Model_Setting();

        s = s.GetSetting();


        IList <Model_SendingJob> cl = c.GetSendingJob();

        Lock.AcquireWriterLock(Timeout.Infinite);

        SendingEngineController.Onprocess = true;
        //SendingEngineController.SendResponse = job;
        Lock.ReleaseWriterLock();


        //if (cpool.IsBusy)
        //    cpool.Shutdown();

        foreach (Model_SendingJob i in cl)
        {
            IList <Model_SendingJobItem> cil = ci.GetSendingJob(i.SDID);
            object[] parameters = new object[] { cil, s, i, HttpContext.Current };
            SendingEngineController.cpool.QueueWork(parameters, Sendnow);
            // Sendnow(parameters);
        }



        //Sendnow(parameters);
        return(1);
    }
Esempio n. 2
0
    private static void QueAddJobItem(Model_SendingJob rs, IEnumerable <IGrouping <string, Model_Subscriber> > sl_filter, string[] MailAddress = null)
    {
        if (rs.SDID > 0)
        {
            if (MailAddress != null && MailAddress.Length > 0)
            {
                int count1 = 1;
                foreach (string m in MailAddress)
                {
                    if (!string.IsNullOrEmpty(m))
                    {
                        Model_SendingJobItem st = new Model_SendingJobItem();
                        st.SDID   = rs.SDID;
                        st.Que    = count1;
                        st.Status = true;
                        st.IsSent = false;
                        st.Email  = m;

                        st.AddJobItem(st);
                    }
                    count1 = count1 + 1;
                }
            }

            //JobItem


            int count = 1;
            foreach (var group in sl_filter)
            {
                string Email = group.Key;
                if (!string.IsNullOrEmpty(Email))
                {
                    Model_SendingJobItem st = new Model_SendingJobItem();
                    st.SDID   = rs.SDID;
                    st.Que    = count;
                    st.Status = true;
                    st.IsSent = false;
                    st.Email  = Email;
                    st.SID    = group.FirstOrDefault().SID;
                    st.AddJobItem(st);
                }



                count = count + 1;
            }
        }
    }