protected void btnDownload_Click(object sender, EventArgs e)
        {
            Common _objCommon = new Common();
            string Msg        = "";
            var    userid     = 0;

            if (Utils.IsEmailValid(txtEmailId.Text))
            {
                MailTemplates _objMailTemplete = new MailTemplates();
                if (Utils.IsMobileValid(txtMobile.Text))
                {
                    QueryProperty objQueryProperty = new QueryProperty
                    {
                        StudentName       = txtName.Text,
                        UserEmailId       = txtEmailId.Text,
                        UserMobileNo      = txtMobile.Text,
                        StudentCityName   = "",
                        StudentCourseId   = Convert.ToInt16(ddlCourse.SelectedValue),
                        StudentQuery      = "User Download the Application from",
                        StudentCourseName = ddlCourse.SelectedItem.ToString(),
                    };
                    int i = QueryProvider.Instance.InsertCommonQuickQuery(objQueryProperty, out Msg, out userid);
                    if (i == 2)
                    {
                        var ObjMail = new MailMessage
                        {
                            From    = new MailAddress(ApplicationSettings.Instance.Email),
                            Subject = "AdmissionJankari:Registration"
                        };
                        var mailbody = _objMailTemplete.MailBodyForRegistation(txtName.Text, txtEmailId.Text, txtMobile.Text);
                        ObjMail.Body = mailbody;
                        ObjMail.To.Add(objQueryProperty.UserEmailId);
                        ObjMail.IsBodyHtml = true;
                        Utils.SendMailMessageAsync(ObjMail);
                    }
                    var mail = new MailMessage
                    {
                        From    = new MailAddress(ApplicationSettings.Instance.Email),
                        Subject = "AdmissionJankari:Download the application form"
                    };
                    var body = _objMailTemplete.MailBodyForDownloadApplicationfrom(txtName.Text, ddlCourse.SelectedItem.ToString());
                    mail.Body = body;
                    mail.To.Add(objQueryProperty.UserEmailId);
                    mail.IsBodyHtml = true;
                    Utils.SendMailMessageAsync(mail);

                    mail = new MailMessage
                    {
                        From    = new MailAddress(ApplicationSettings.Instance.Email),
                        Subject = "AdmissionJankari:Download the application form"
                    };
                    body      = _objMailTemplete.MailBodyForAdminToDownloadApplicationfrom(txtName.Text, ddlCourse.SelectedItem.ToString(), txtMobile.Text);
                    mail.Body = body;
                    mail.To.Add(ClsSingelton.bccDirectAdmission);
                    mail.IsBodyHtml = true;
                    Utils.SendMailMessageAsync(mail);
                    ClearControl();

                    try
                    {
                        ClearControl();
                        lblMsg.Visible = true;
                        lblMsg.Text    = "Thank you for downloading the application form";
                        string fName = HttpContext.Current.Server.MapPath("\\Resource\\Download") + @"\" + "ApplicationForm_FinalDec12_2012.pdf";

                        FileInfo fi = new FileInfo(fName);
                        long     sz = fi.Length;

                        Response.ClearContent();
                        Response.ContentType = MimeType(Path.GetExtension(fName));
                        Response.AddHeader("Content-Disposition", string.Format("attachment; filename = {0}", System.IO.Path.GetFileName(fName)));
                        Response.AddHeader("Content-Length", sz.ToString("F0"));
                        Response.TransmitFile(fName);
                        Response.End();
                    }
                    catch (Exception ex)
                    {
                        ClearControl();
                        lblMsg.Visible = true;
                        lblMsg.Text    = "Thank you for downloading the application form";
                    }
                }
                else
                {
                    lblMsg.Visible = true;
                    lblMsg.Text    = _objCommon.GetValidationMessage("revContactNo");
                }
            }
            else
            {
                lblMsg.Visible = true;
                lblMsg.Text    = _objCommon.GetValidationMessage("revEmail");
            }
        }
Beispiel #2
0
        protected void BtnRegisterClick(object sender, EventArgs e)
        {
            var objmailTemplete = new MailTemplates();

            try
            {
                _objUserRegistrationProperty = new UserRegistrationProperty
                {
                    UserFullName   = txtUserName.Text.Trim(),
                    UserEmailid    = txtEmailId.Text.Trim(),
                    MobileNo       = txtMobile.Text.Trim(),
                    UserCategoryId = Convert.ToInt16(ddlUserCategory.SelectedValue),
                    CourseId       = ddlCourse.SelectedIndex > 0?Convert.ToInt16(ddlCourse.SelectedValue):0,
                    UserPassword   = txtMobile.Text.Trim()
                };

                var errMsg = "";
                var result = UserManagerProvider.Instance.InsertUserInfo(_objUserRegistrationProperty, 1, out errMsg);
                hdnUserId.Value       = Convert.ToString(_objUserRegistrationProperty.UserId);
                hdnUserCategory.Value = Convert.ToString(ddlUserCategory.SelectedValue);
                hdnPassword.Value     = _objUserRegistrationProperty.UserPassword;
                if (result > 0)
                {
                    switch (ddlUserCategory.SelectedItem.Text)
                    {
                    case "Student":
                        Page.ClientScript.RegisterStartupScript(Type.GetType("System.String"), "addScript",
                                                                "OpenPoup('popCollege,400,'btnRegister');", true);
                        break;

                    default:
                        Page.ClientScript.RegisterStartupScript(Type.GetType("System.String"), "addScript",
                                                                "OpenPoup('popCity',400,'btnRegister');", true);
                        break;
                    }
                    var mail = new MailMessage
                    {
                        From    = new MailAddress(ApplicationSettings.Instance.Email),
                        Subject = "AdmissionJankari: Registation mail "
                    };

                    var body = objmailTemplete.MailBodyForRegistation(txtUserName.Text, txtEmailId.Text, txtMobile.Text);
                    mail.Body = body;
                    mail.To.Add(_objUserRegistrationProperty.UserEmailid);
                    Utils.SendMailMessageAsync(mail);
                    SetStatus("CommentSuccess", errMsg);
                    ClearFields();
                }
                else
                {
                    SetStatus("CommentError", errMsg);
                }
            }
            catch (Exception ex)
            {
                var err = ex.Message;
                if (ex.InnerException != null)
                {
                    err = err + " :: Inner Exception :- " + ex.InnerException.Message;
                }
                const string addInfo = "Error while executing InsertUserInfo in Register.ascx  :: -> ";
                var          objPub  = new ClsExceptionPublisher();
                objPub.Publish(err, addInfo);
            }
        }
        protected void BtnAddCommentClick(object sender, EventArgs e)
        {
            var errmsg          = "";
            var objmailTemplete = new MailTemplates();


            try
            {
                var objUserRegistrationProperty = new UserRegistrationProperty
                {
                    UserFullName   = txtUserNameComment.Text.Trim(),
                    UserEmailid    = txtEmailIdComment.Text.Trim(),
                    MobileNo       = txtMobileComment.Text.Trim(),
                    UserCategoryId =
                        Convert.ToInt16(Usertype.Student),
                    UserPassword = txtMobileComment.Text.Trim(),
                    CourseId     = Convert.ToInt32(hdnCourseComment.Value)
                };


                var errMsg = "";
                var result = UserManagerProvider.Instance.InsertUserInfo(objUserRegistrationProperty,
                                                                         Convert.ToInt16(Usertype.Student),
                                                                         out errMsg);

                if (result > 0)
                {
                    var result1 = UserManagerProvider.Instance.GetUserListByEmailId(txtEmailIdComment.Text.Trim());

                    if (result1.Count > 0)
                    {
                        var query = result1.First();
                        _objSecurePage.LoggedInUserId      = query.UserId;
                        _objSecurePage.LoggedInUserType    = query.UserCategoryId;
                        _objSecurePage.LoggedInUserEmailId = query.UserEmailid;
                        _objSecurePage.LoggedInUserName    = query.UserFullName;
                        _objSecurePage.LoggedInUserMobile  = query.MobileNo;
                    }
                    var mail = new MailMessage
                    {
                        From    = new MailAddress(ApplicationSettings.Instance.Email),
                        Subject = "AdmissionJankari: Registration mail "
                    };



                    var body = objmailTemplete.MailBodyForRegistation(txtUserNameComment.Text.Trim(),
                                                                      txtEmailIdComment.Text.Trim(),
                                                                      txtMobileComment.Text.Trim());
                    mail.Body = body;
                    mail.To.Add(objUserRegistrationProperty.UserEmailid);
                    Utils.SendMailMessageAsync(mail);
                }
                else
                {
                    var userDetails =
                        UserManagerProvider.Instance.GetUserListByEmailId(txtEmailIdComment.Text.Trim())
                        .FirstOrDefault();
                    if (userDetails != null)
                    {
                        _objSecurePage.LoggedInUserId      = userDetails.UserId;
                        _objSecurePage.LoggedInUserType    = userDetails.UserCategoryId;
                        _objSecurePage.LoggedInUserEmailId = userDetails.UserEmailid;
                        _objSecurePage.LoggedInUserName    = userDetails.UserFullName;
                        _objSecurePage.LoggedInUserMobile  = userDetails.MobileNo;
                    }
                }
                var errCommentMsg = "";
                var commentResult = new Common().InsertUserCoomment(_objSecurePage.LoggedInUserId, CommentType,
                                                                    CommentTypeId,
                                                                    txtComment.Text, out errCommentMsg);
                if (commentResult > 0)
                {
                    var mail = new MailMessage
                    {
                        From    = new MailAddress(ApplicationSettings.Instance.Email),
                        Subject = "AdmissionJankari:Comment information"
                    };
                    var commentSection = CommentSection(CommentType);

                    var body = objmailTemplete.MailBodyForUserCommentToAdmin(_objSecurePage.LoggedInUserName,
                                                                             _objSecurePage.LoggedInUserMobile,
                                                                             _objSecurePage.LoggedInUserEmailId,
                                                                             commentSection, txtComment.Text.Trim());

                    mail.To.Add(ClsSingelton.CommentMailId);
                    mail.Body = body;
                    Utils.SendMailMessageAsync(mail);
                    SetStatus("CommentSuccess", errCommentMsg);
                }
                else
                {
                    SetStatus("CommentError", errCommentMsg);
                }
                txtComment.Text = string.Empty;
                Page.ClientScript.RegisterStartupScript(Type.GetType("System.String"), "addScript",
                                                        "close();", true);
            }
            catch (Exception ex)
            {
                var err = ex.Message;
                if (ex.InnerException != null)
                {
                    err = err + " :: Inner Exception :- " + ex.InnerException.Message;
                }
                const string addInfo =
                    "Error while executing UcCommonComment in BtnAddCommentClick  :: -> ";
                var objPub = new ClsExceptionPublisher();
                objPub.Publish(err, addInfo);
            }
        }
Beispiel #4
0
        private void InsertUserTestimonial()
        {
            try
            {
                if (Page.IsValid)
                {
                    var objmailTemplete = new MailTemplates();
                    var objTestimonialProperty = new TestimonialProperty();
                    int i, insert = 0; string errMsg = "";
                    if (string.IsNullOrWhiteSpace(txtTesimonial.FckValue))
                    {
                        RfvFck.Text = "Testimonial cannot be blank"; RfvFck.Visible = true; return;
                    }
                    if (Session["UID"] == null)
                    {
                        var objUserRegistrationProperty = new UserRegistrationProperty
                        {
                            UserFullName   = txtUserName.Text.Trim(),
                            UserEmailid    = txtUserEmailId.Text.Trim(),
                            MobileNo       = txtUserMobile.Text.Trim(),
                            UserCategoryId = Convert.ToInt16(Usertype.Student),
                            UserPassword   = txtUserMobile.Text.Trim(),
                            CourseId       = Convert.ToInt32(new Common().CourseId),
                        };

                        i = UserManagerProvider.Instance.InsertUserInfo(objUserRegistrationProperty, Convert.ToInt16(Usertype.Student), out errMsg);

                        if (i > 0)
                        {
                            objTestimonialProperty.UserID = Session["UID"] == null?Convert.ToInt32(objUserRegistrationProperty.UserId) : _objSecurePage.LoggedInUserId;

                            objTestimonialProperty.Testimonials = Convert.ToString(txtTesimonial.FckValue.Trim());
                            insert = NewsArticleNoticeProvider.Instance.InsertTestimonilasDetails(objTestimonialProperty, 1, out errMsg);
                            var mail = new MailMessage
                            {
                                From    = new MailAddress(ApplicationSettings.Instance.Email),
                                Subject = "AdmissionJankari: Registration mail "
                            };
                            var body = objmailTemplete.MailBodyForRegistation(txtUserName.Text.Trim(), txtUserEmailId.Text.Trim(), txtUserMobile.Text.Trim());
                            mail.Body = body;
                            mail.To.Add(objUserRegistrationProperty.UserEmailid);
                            Utils.SendMailMessageAsync(mail);
                        }
                        else
                        {
                            var userDetails = UserManagerProvider.Instance.GetUserListByEmailId(txtUserEmailId.Text.Trim());
                            if (userDetails != null)
                            {
                                var query1 = userDetails.First();
                                _objSecurePage.LoggedInUserId      = query1.UserId;
                                _objSecurePage.LoggedInUserType    = query1.UserCategoryId;
                                _objSecurePage.LoggedInUserEmailId = query1.UserEmailid;
                                _objSecurePage.LoggedInUserName    = query1.UserFullName;
                                _objSecurePage.LoggedInUserMobile  = query1.MobileNo;

                                objTestimonialProperty.UserID       = _objSecurePage.LoggedInUserId;
                                objTestimonialProperty.Testimonials = Convert.ToString(txtTesimonial.FckValue.Trim());
                                insert = NewsArticleNoticeProvider.Instance.InsertTestimonilasDetails(objTestimonialProperty, 1, out errMsg);
                            }
                        }
                    }
                    else
                    {
                        objTestimonialProperty.UserID       = Convert.ToInt32(Session["UID"]);
                        objTestimonialProperty.Testimonials = Convert.ToString(txtTesimonial.FckValue.Trim());
                        insert = NewsArticleNoticeProvider.Instance.InsertTestimonilasDetails(objTestimonialProperty, 1, out errMsg);
                    }

                    RfvFck.Visible      = false;
                    spnErrMsg.InnerHtml = "Your testimonial is successfully submitted";
                }
            }
            catch (Exception ex)
            {
                var err = ex.Message;
                if (ex.InnerException != null)
                {
                    err = err + " :: Inner Exception :- " + ex.InnerException.Message;
                }
                const string addInfo = "Error while executing InsertUserInfo in Testimonial.aspx  :: -> ";
                var          objPub  = new ClsExceptionPublisher();
                objPub.Publish(err, addInfo);
            }
        }
        //private string BindPaymentAmount(int courseId)
        //{
        //    Consulling _objConsulling = new Consulling();
        //    var amount = "";
        //    try
        //    {
        //        amount = _objConsulling.GetPayemntAmountAccordingToCourse(courseId);
        //    }
        //    catch (Exception ex)
        //    {
        //        var err = ex.Message;
        //        if (ex.InnerException != null)
        //        {
        //            err = err + " :: Inner Exception :- " + ex.ToString();
        //        }
        //        const string addInfo = "Error while executing BindPaymentAmount in UcCollegeBranchEvent.aspx  :: -> ";
        //        var objPub = new ClsExceptionPublisher();
        //        objPub.Publish(err, addInfo);
        //    }
        //    return amount;
        //}
        protected void BtnRegisterClick(object sender, EventArgs e)
        {
            MailTemplates _objmailTemplete = new MailTemplates();

            _objSecurePage = new SecurePage();

            try
            {
                _objUserRegistrationProperty = new UserRegistrationProperty
                {
                    UserFullName   = txtEventUser.Text.Trim(),
                    UserEmailid    = txtEmailIdEvent.Text.Trim(),
                    MobileNo       = txtMobileEvent.Text.Trim(),
                    UserCategoryId = Convert.ToInt16(Usertype.Student),
                    CourseId       = CourseId,
                    UserPassword   = txtMobileEvent.Text.Trim()
                };
                var errMsg = "";
                var result = UserManagerProvider.Instance.InsertUserInfo(_objUserRegistrationProperty, Convert.ToInt16(Usertype.Student), out errMsg);
                if (result > 0)
                {
                    var mail = new MailMessage
                    {
                        From    = new MailAddress(ApplicationSettings.Instance.Email),
                        Subject = "AdmissionJankari: Registation mail "
                    };
                    var body = _objmailTemplete.MailBodyForRegistation(txtEventUser.Text, txtEmailIdEvent.Text, txtMobileEvent.Text);
                    mail.Body = body;
                    mail.To.Add(_objUserRegistrationProperty.UserEmailid);
                    Utils.SendMailMessageAsync(mail);
                    var result1 = UserManagerProvider.Instance.GetUserListByEmailId(txtEmailIdEvent.Text.Trim());

                    var mail1 = new MailMessage
                    {
                        From    = new MailAddress(ApplicationSettings.Instance.Email),
                        Subject = "AdmissionJankari: Event attending by user-" + txtEventUser.Text
                    };
                    var body1 = _objmailTemplete.MailToAdminRegardingEventAttendingByStudent(txtEventUser.Text, txtEmailIdEvent.Text, txtMobileEvent.Text, CollegeName, hdnCollegeEvent.Value, hdnCollegeDate.Value);
                    mail1.Body = body1;
                    mail1.To.Add(ClsSingelton.donationMailId);
                    Utils.SendMailMessageAsync(mail1);

                    if (result1.Count > 0)
                    {
                        var query1 = result1.First();
                        _objSecurePage.LoggedInUserId      = query1.UserId;
                        _objSecurePage.LoggedInUserType    = query1.UserCategoryId;
                        _objSecurePage.LoggedInUserEmailId = query1.UserEmailid;
                        _objSecurePage.LoggedInUserName    = query1.UserFullName;
                        _objSecurePage.LoggedInUserMobile  = query1.MobileNo;
                        var collegeInsert = new Consulling().InsertStudentCollegePrefrance(_objSecurePage.LoggedInUserId, CollegeName, CourseId);
                        var cityInsert    = new Consulling().InsertStudentCityPrefrance(_objSecurePage.LoggedInUserId, CityName);
                        var objCrypto     = new ClsCrypto(ClsSecurity.GetPasswordPhrase(Common.PassPhraseOne, Common.PassPhraseTwo));
                        //  var amount = BindPaymentAmount(CourseId);
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>EventMessage();</script>", false);
                        //Response.Redirect("/PaymentOptions.aspx?BookSeatPayment=" + objCrypto.Encrypt(amount));
                    }
                }
                else
                {
                    var result1 = UserManagerProvider.Instance.GetUserListByEmailId(txtEmailIdEvent.Text.Trim());

                    if (result1.Count > 0)
                    {
                        var query1 = result1.First();
                        _objSecurePage.LoggedInUserId      = query1.UserId;
                        _objSecurePage.LoggedInUserType    = query1.UserCategoryId;
                        _objSecurePage.LoggedInUserEmailId = query1.UserEmailid;
                        _objSecurePage.LoggedInUserName    = query1.UserFullName;
                        _objSecurePage.LoggedInUserMobile  = query1.MobileNo;

                        var collegeInsert = new Consulling().InsertStudentCollegePrefrance(_objSecurePage.LoggedInUserId, CollegeName, CourseId);
                        var cityInsert    = new Consulling().InsertStudentCityPrefrance(_objSecurePage.LoggedInUserId, CityName);
                        var objCrypto     = new ClsCrypto(ClsSecurity.GetPasswordPhrase(Common.PassPhraseOne, Common.PassPhraseTwo));
                        // var amount = BindPaymentAmount(CourseId);
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>EventMessage();</script>", false);
                        // Response.Redirect("/PaymentOptions.aspx?BookSeatPayment=" + objCrypto.Encrypt(amount));
                    }
                }
            }
            catch (Exception ex)
            {
                var err = ex.Message;
                if (ex.InnerException != null)
                {
                    err = err + " :: Inner Exception :- " + ex.InnerException.Message;
                }
                const string addInfo = "Error while executing BtnRegisterClick in UcCollegeBranchEvent.ascx  :: -> ";
                var          objPub  = new ClsExceptionPublisher();
                objPub.Publish(err, addInfo);
            }
        }