示例#1
0
        /// <summary>
        /// Handles the Click event of the cmdSubmit control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            objController = objFactory.GetServiceManager("MossService");
            objUtility = new CommonUtility();
            try
            {
                bool blnIsSaved = false;
                string strUserId = objUtility.GetUserName();
                string strMessage = string.Empty;
                //set the values selected by the user.
                if (rdoRating.SelectedIndex != -1)
                {
                    objFeedback.Rating = rdoRating.SelectedItem.Text;
                }
                objFeedback.Reason = txtReasonForRating.Text.Trim();
                objFeedback.AdditionalInformation = txtAdditionalInformation.Text.Trim();

                objFeedback.PageName = ddlPageName.SelectedItem.Text;
                objFeedback.Comment = txtPageLevelComment.Text.Trim();
                //check the type of feedback has selected.
                if (string.Compare(rdoFeedback.SelectedItem.Text, PAGELEVELFEEDBACK) == 0)
                {
                    objFeedback.TypeofFeedback = PAGELEVELFEEDBACK;
                }
                else
                {
                    objFeedback.TypeofFeedback = GENERALFEEDBACK;
                }

                ///Check if the Session object for the uploaded file is not null.
                if (Session["FileAttached"] != null)
                {
                    objFeedback.FileAttached = (byte[])Session["FileAttached"];
                    objFeedback.FileName = hidFileName.Value;
                }
                //Enters the Feedback details into sharepoint list.
                blnIsSaved = ((MOSSServiceManager)objController).UpdateFeedback(strUserId, objFeedback);
                if (blnIsSaved)
                {
                    lblMessage.Text = SUCCESSMESSEGE;
                    objUtility.SendAlertMailforNewFeedback(strMessage);
                }
                else
                {
                    lblMessage.Text = ERRORMESSEGE;
                }

                pnlConfirmFeedback.Visible = true;
                pnlFeedback.Visible = false;
            }
            catch (WebException webEx)
            {
                lblErrorMessage.Visible = true;
                lblErrorMessage.Text = webEx.Message;
            }
            catch (Exception ex)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex);
            }
        }