public static Model_Campaign InsertTemplate(Model_Campaign param)
    {
        Model_Campaign cm = null;

        param.CreatedBy = HttpContext.Current.User.Identity.GetUserId();
        cm = param.model_InsertCampaign(param);


        //Model_Template cm =  param.model_InsertEmailEelement(param);
        // cm = cm.model_InsertEmailEelement(param);

        if (!string.IsNullOrEmpty(cm.EID))
        {
            EmailEelements el = new EmailEelements
            {
                EID      = cm.EID,
                Eelement = cm.EL.ObjectToJSON()
            };
            el.model_InsertEmailEelement(el);
        }

        SendingController.SendQue();

        return(cm);
    }
    public static void CheckStatus()
    {
        bool   success   = true;
        string msg       = "no";
        bool   Isprocess = false;

        //string Total = "0";
        //string PerCent = "0";


        SendingEngineController.Lock.AcquireReaderLock(Timeout.Infinite);
        Isprocess = SendingEngineController.Onprocess;

        //sendprocess = SendingEngineController.SendResponse;
        SendingEngineController.Lock.ReleaseReaderLock();


        string res = (new BaseWebMethodAJax
        {
            success = success,
            msg = msg,
            IsOnprocess = Isprocess,
            Sendprocess = SendingController.GetProcessSendingAndUpdateStatus()
        }).ObjectToJSON();

        AppTools.SendResponse(HttpContext.Current.Response, res);
    }
    public static bool Updatestatus(object param, byte CSID)
    {
        Model_Campaign c = new Model_Campaign();

        object[] arr = (object[])param;

        for (int i = 0; i < arr.Length; i++)
        {
            c.model_updatestatus(int.Parse((string)arr[i]), CSID);
        }


        SendingController.SendQue();

        return(true);
    }
    public static Model_Campaign Update(Model_Campaign param)
    {
        Model_Campaign cm = null;

        cm = param.model_Update(param);

        if (!string.IsNullOrEmpty(cm.EID))
        {
            EmailEelements el = new EmailEelements
            {
                EID      = cm.EID,
                Eelement = cm.EL.ObjectToJSON()
            };
            el.model_InsertEmailEelement(el);
        }

        SendingController.SendQue();

        return(cm);
    }