protected void btnSendInteraction_click(object sender, EventArgs e)
    {
        foreach (ListViewItem item in lvstudent.Items)
        {
            string    InteractionDate = string.Empty;
            string    InteractionTime = string.Empty;
            string    AdmissionID     = string.Empty;
            string    MailFrom        = string.Empty;
            string    MailTo          = string.Empty;
            string    MailSubject     = string.Empty;
            string    MailBody        = string.Empty;
            string    FailiurReason   = string.Empty;
            ArrayList ArrMailTo       = new ArrayList();

            HtmlInputCheckBox interactioncheck = (HtmlInputCheckBox)item.FindControl("interactioncheck");
            if (interactioncheck.Checked)
            {
                TextBox interactiondate = (TextBox)item.FindControl("interactiondate");
                InteractionDate = interactiondate.Text;
                TextBox interactiontime = (TextBox)item.FindControl("interactiontime");
                InteractionTime = interactiontime.Text;
                Label       communicationemail = (Label)item.FindControl("communicationemail");
                HiddenField hdnAdmissionID     = (HiddenField)item.FindControl("hdnAdmissionID");

                AdmissionID = hdnAdmissionID.Value;
                MailFrom    = EmailUtility.SMTPEmailAddress;
                MailTo      = communicationemail.Text;
                MailSubject = GetMailSubject();
                MailBody    = GetMailBody(InteractionDate, InteractionTime);

                if (!string.IsNullOrEmpty(InteractionDate) && !string.IsNullOrEmpty(InteractionTime) && !string.IsNullOrEmpty(MailTo) && !string.IsNullOrEmpty(AdmissionID))
                {
                    ArrMailTo.Add(MailTo);
                    bool IsSendSuccess = EmailUtility.SendEmail(ArrMailTo, MailSubject, MailBody, out FailiurReason);

                    BAL_Admission        oBAL_Admission        = new BAL_Admission();
                    AdmissionInteraction oAdmissionInteraction = new AdmissionInteraction();

                    oAdmissionInteraction.AdmissionId     = AdmissionID;
                    oAdmissionInteraction.InteractionDate = InteractionDate;
                    oAdmissionInteraction.InteractionTime = InteractionTime;
                    oAdmissionInteraction.MailFrom        = MailFrom;
                    oAdmissionInteraction.MailTo          = MailTo;
                    oAdmissionInteraction.MailSubject     = MailSubject;
                    oAdmissionInteraction.MailBody        = MailBody;
                    oAdmissionInteraction.IsSendSuccess   = IsSendSuccess;
                    oAdmissionInteraction.FailureReasons  = GetValue(FailiurReason);
                    oAdmissionInteraction.CreatedBy       = Convert.ToString(AppSessions.EmpolyeeID);

                    oBAL_Admission.AdmissionInteraction_Insert(oAdmissionInteraction);
                }
            }
        }
        BindGrid();

        mainpopup.Attributes["class"] = "overlayone";
        msg.InnerHtml = "Your operation has been successfully completed.";
    }
Ejemplo n.º 2
0
    public bool AdmissionInteraction_Insert(AdmissionInteraction AdmissionInteraction)
    {
        this.oDataHelper  = new DataAccess();
        this.arrParameter = new ArrayList();

        this.arrParameter.Add(new parameter("AdmissionId", AdmissionInteraction.AdmissionId));
        this.arrParameter.Add(new parameter("InteractionDate", AdmissionInteraction.InteractionDate));
        this.arrParameter.Add(new parameter("InteractionTime", AdmissionInteraction.InteractionTime));
        this.arrParameter.Add(new parameter("MailFrom", AdmissionInteraction.MailFrom));
        this.arrParameter.Add(new parameter("MailTo", AdmissionInteraction.MailTo));
        this.arrParameter.Add(new parameter("MailSubject", AdmissionInteraction.MailSubject));
        this.arrParameter.Add(new parameter("MailBody", AdmissionInteraction.MailBody));
        this.arrParameter.Add(new parameter("IsSendSuccess", AdmissionInteraction.IsSendSuccess));
        this.arrParameter.Add(new parameter("FailureReasons", AdmissionInteraction.FailureReasons));
        this.arrParameter.Add(new parameter("CreatedBy", AdmissionInteraction.CreatedBy));

        return(this.oDataHelper.DAL_InsertUpdateWithStatus("AdmissionInteraction_Insert", this.arrParameter));
    }