protected void btnStopSchedule_Click(object sender, EventArgs e)
        {
            try
            {
                string jobName      = "Job" + mGlobal.AccountName + CampaignName + mdtSchedule;
                string groupJobName = "GroupJob" + mGlobal.AccountName;

                SendMailService proxy = new SendMailService();
                proxy.stopSchedule(jobName, groupJobName);

                ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Bạn đã hủy lịch cho chiến dịch này" + "');", true);
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void saveTempScheduleSendEmail()
        {
            ListEditItem cmbEmailOwnselectedItem    = cmbEmailOwn.SelectedItem;
            ListEditItem cmbcmbCampaignselectedItem = cmbCampaign.SelectedItem;

            CampaignName = cmbcmbCampaignselectedItem.GetValue("CampaignName").ToString();
            mdtSchedule  = DateTime.Parse(Request.Form[txt_date_schedule.UniqueID]);
            string jobName      = "Job" + mGlobal.AccountName + CampaignName + mdtSchedule;
            string groupJobName = "GroupJob" + mGlobal.AccountName;
            string triggerName  = "Trigger" + jobName;
            string triggerGroup = "TriggerGroup" + groupJobName;

            for (int i = 0; i < gridView.VisibleRowCount; i++)
            {
                if (gridView.GetRowLevel(i) == gridView.GroupCount)
                {
                    object keyValue = gridView.GetRowValues(i, new string[] { DataField.STT, DataField.Email, DataField.Subject, DataField.Content });
                    if (keyValue != null)
                    {
                        using (SendMailEntities db = new SendMailEntities())
                        {
                            Array arr = (Array)keyValue;
                            TempScheduleSendEmail temp = new TempScheduleSendEmail();
                            temp.STT          = Int64.Parse(arr.GetValue(0).ToString());
                            temp.Email        = arr.GetValue(1).ToString();
                            temp.Subject      = arr.GetValue(2).ToString();
                            temp.ContentEmail = arr.GetValue(3).ToString();
                            temp.IDEmailOwn   = Int64.Parse(cmbEmailOwnselectedItem.GetValue("ID").ToString());
                            temp.IDCampaign   = Int64.Parse(cmbcmbCampaignselectedItem.GetValue("CampaignID").ToString());
                            temp.TimeSchedule = mdtSchedule;
                            temp.IDUser       = mGlobal.UserID;
                            temp.JobName      = jobName;
                            temp.JobGroup     = groupJobName;
                            db.TempScheduleSendEmails.Add(temp);
                            db.SaveChanges();
                        }
                    }
                }
            }

            //call service schedule email
            SendMailService proxy = new SendMailService();

            proxy.SendEmailSchedule(jobName, groupJobName, triggerName, triggerGroup, mdtSchedule);
        }