Exemplo n.º 1
0
        // Method to Insert User Donation Request
        protected void InsertUserDonationReqest()
        {
            _objCommon = new Common();
            string errMsg = "";


            try
            {
                if (Page.IsValid)
                {
                    int i = _objCommon.InsertUserDonationRequest(txtUserName.Text, txtUserMobile.Text, txtUserEmailId.Text, txtCollegeName.Text,
                                                                 Convert.ToInt32(ddlCourse.SelectedValue), txtaccusedName.Text, txtAccusedEmailId.Text, txtAccusedMobileNo.Text, Convert.ToInt16(IryTech.AdmissionJankari.BO.Usertype.Student),
                                                                 txtIncident.Text, out errMsg);
                    if (i > 0)
                    {
                        spnErrMsg.InnerHtml = errMsg;
                        spnErrMsg.Visible   = true;
                        spnErrMsg.Focus();
                        MailTemplates _objmailTemplete = new MailTemplates();
                        var           mail             = new MailMessage
                        {
                            From    = new MailAddress(ApplicationSettings.Instance.Email),
                            Subject = "AdmissionJankari: Report Donation"
                        };
                        var body = _objmailTemplete.MailBodyForDonationUser(txtUserName.Text);
                        mail.To.Add(txtUserEmailId.Text);
                        mail.Body = body;
                        Utils.SendMailMessageAsync(mail);

                        mail = new MailMessage
                        {
                            From    = new MailAddress(ApplicationSettings.Instance.Email),
                            Subject = "AdmissionJankari:Donation Complain"
                        };
                        body = _objmailTemplete.MailBodyForDonationAdmin(txtUserName.Text, txtUserEmailId.Text, txtUserMobile.Text, ddlCourse.SelectedItem.ToString(),
                                                                         txtCollegeName.Text, txtaccusedName.Text, txtAccusedMobileNo.Text, txtAccusedEmailId.Text, txtIncident.Text);

                        mail.To.Add(ClsSingelton.donationMailId);
                        mail.Body = body;
                        Utils.SendMailMessageAsync(mail);
                    }
                }
            }
            catch (Exception ex)
            {
                var err = ex.Message;
                if (ex.InnerException != null)
                {
                    err = err + " :: Inner Exception :- " + ex.ToString();
                }
                const string addInfo = "Error while executing InsertUserDonationReqest in UcReportDonation.ascx  :: -> ";
                var          objPub  = new ClsExceptionPublisher();
                objPub.Publish(err, addInfo);
            }
        }