Exemplo n.º 1
0
        protected void BtnCommentClick(object sender, EventArgs e)
        {
            var errmsg          = "";
            var objmailTemplete = new MailTemplates();

            try
            {
                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;
            }
            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 BtnCommentClick  :: -> ";
                var objPub = new ClsExceptionPublisher();
                objPub.Publish(err, addInfo);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }