コード例 #1
0
ファイル: UserComment.aspx.cs プロジェクト: IryTech/24082018
        protected void BtnUpdateStatus(object sender, EventArgs e)
        {
            try
            {
                var errmsg = "";
                hdnCommentId.Value = hdnCommentId.Value.Replace(",", "");
                var result = new Common().UpdateCommentStatus(Convert.ToInt32(hdnCommentId.Value),
                                                              Convert.ToBoolean(rbtCommentStatus.SelectedValue),
                                                              new SecurePage().LoggedInUserId, out errmsg);
                if (Convert.ToBoolean(rbtCommentStatus.SelectedValue))
                {
                    var mail = new MailMessage
                    {
                        From    = new MailAddress(ApplicationSettings.Instance.Email),
                        Subject = "AdmissionJankari:Comment information"
                    };
                    hdnUserId.Value = hdnUserId.Value.Replace(",", "");
                    var commentSection = CommentSection(rbtSearchQuery.SelectedValue);

                    var objmailTemplete = new MailTemplates();
                    var body            = objmailTemplete.MailBodyForUserCommentByAdmin(hdnUserName.Value, commentSection, hdnCommentFor.Value);

                    mail.To.Add(hdnEmail.Value);
                    mail.Body = body;
                    Utils.SendMailMessageAsync(mail);
                }
                hdnCommentId.Value = "";
                hdnUserId.Value    = "";
                hdnEmail.Value     = string.Empty;
                hdnUserName.Value  = string.Empty;
                rbtCommentStatus.ClearSelection();

                Page.ClientScript.RegisterStartupScript(Type.GetType("System.String"), "addScript",
                                                        "close();", true);
                switch (rbtSearchQuery.SelectedValue)
                {
                case "1":
                    BindCommentList(BindCollegeCommentList());
                    break;

                case "2":
                    BindCommentList(BindExamCommentList());
                    break;

                case "3":
                    BindCommentList(BindNewsCommentList());
                    break;

                case "4":
                    BindCommentList(BindNoticeCommentList());
                    break;

                case "5":
                    BindCommentList(BindLoanCommentList());
                    break;
                }
            }
            catch (Exception ex)
            {
                var err = ex.Message;
                if (ex.InnerException != null)
                {
                    err = err + " :: Inner Exception :- " + ex.InnerException.Message;
                }
                const string addInfo = "Error in Executing  BtnUpdateStatus in UserComment.aspx :: -> ";
                var          objPub  = new ClsExceptionPublisher();
                objPub.Publish(err, addInfo);
            }
        }