예제 #1
0
        /// <summary>
        /// Sends the email to user on print.
        /// </summary>
        /// <param name="results">The results.</param>
        /// <param name="parentSiteURL">The parent site URL.</param>
        /// <param name="strAddress">The STR address.</param>
        /// <param name="contextForMail">The context for mail.</param>
        public void SendEmailToUserOnPrint(string results, string parentSiteURL, string strAddress, SPContext contextForMail)
        {
            DataTable dtPrintChapterDetails = null;
            ActiveDirectoryService objADS = null;
            try
            {
                try
                {
                    objADS = new ActiveDirectoryService();
                }
                catch (Exception)
                {
                    objADS = new ActiveDirectoryService(contextForMail);
                }
                dtPrintChapterDetails = new DataTable();
                CommonUtility objUtility = new CommonUtility();
                objCommonDAL = new CommonDAL();
                string strToMailID = string.Empty;
                string strAccessLink = string.Empty;
                string strMessage = string.Empty;

                string strCamlQuery = @"<Where><Eq><FieldRef Name='RequestID' /><Value Type='Text'>" + results + "</Value></Eq></Where>";
                dtPrintChapterDetails = objCommonDAL.GetChapterPrintDetails(strCamlQuery, parentSiteURL, "DWB Chapter Print Details");

                if (dtPrintChapterDetails != null && dtPrintChapterDetails.Rows.Count > 0)
                {
                    /// Loop through the values in Chapter Print Details list.
                    foreach (DataRow dtRow in dtPrintChapterDetails.Rows)
                    {
                        try
                        {
                            strToMailID = objADS.GetEmailID(dtRow["UserName"].ToString());
                        }
                        catch (Exception)
                        {
                        }
                        strAccessLink = parentSiteURL + "/Pages/eWBPDFViewer.aspx?mode=chapter&requestID=" + results;

                        objUtility.SendMailforPrintUpdate(strToMailID, strAccessLink, parentSiteURL, strAddress, contextForMail);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (dtPrintChapterDetails != null)
                    dtPrintChapterDetails.Dispose();
            }
        }
예제 #2
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 cmdSubmit_Click(object sender, EventArgs e)
        {
            DataTable dtListValue = null;
            try
            {

                if(Page.IsPostBack)
                {

                    string strToMailID = string.Empty;
                    string strCAMLQuery = string.Empty;
                    string strStatus = string.Empty;
                    string strActive = string.Empty;
                    bool blnSendMail = false;
                    objUtility = new CommonUtility();
                    objADS = new ActiveDirectoryService();

                    string strParentSiteURL = HttpContext.Current.Request.Url.ToString();
                    string strUserName = txtUserAcc.Text.ToString();

                    StringBuilder strMessage = new StringBuilder();

                    ServiceProvider objFactory = new ServiceProvider();
                    objMossController = objFactory.GetServiceManager("MossService");

                    dtListValue = new DataTable();
                    DataRow listRow;

                    strMessage.Append("User ID : " + strUserName);
                    strMessage.Append("<BR>Region: " + txtRegion.Text);
                    strMessage.Append("<BR>Purpose : " + txtPurpose.Text);
                    strToMailID = objADS.GetEmailID(strUserName);

                    if(Request.QueryString["teamId"] == null)
                    {
                        strCAMLQuery = "<OrderBy><FieldRef Name=\"LinkTitleNoMenu\" /></OrderBy><Where><Eq><FieldRef Name=\"LinkTitle\" /><Value Type=\"Computed\">" + strUserName + "</Value></Eq></Where>";
                        dtListValue = ((MOSSServiceManager)objMossController).ReadList(strParentSiteURL, USERACCESSREQUESTLIST, strCAMLQuery);

                        if(dtListValue.Rows.Count > 0)
                        {
                            listRow = dtListValue.Rows[0];
                            strStatus = listRow["Access_x0020_Approval_x0020_Stat"].ToString();
                            strActive = listRow["Active"].ToString();
                        }

                        if(string.Compare(strStatus, STATUSINPROGRESS, true) == 0)
                        {
                            lblMessage.Text = "You have already requested for access. Please contact administrator.";
                        }
                        else
                        {

                            if((string.IsNullOrEmpty(strStatus)) || ((string.Compare(strStatus, STATUSAPPROVED, true) == 0) && (string.Compare(strActive, "No", true) == 0)))
                            {
                                ((MOSSServiceManager)objMossController).CreateAccessRequest(strUserName, txtRegion.Text, txtPurpose.Text, string.Empty, USERACCESSREQUESTLIST);
                                blnSendMail = true;
                            }
                            else if(string.Compare(strStatus, STATUSREJECTED, true) == 0)
                            {
                                strMessage.Append("<BR><BR><font color='red'><b>Please note that the user's request has been rejected earlier</b></font>");
                                blnSendMail = true;
                            }
                        }

                        if(blnSendMail)
                        {
                            objUtility.SendMailforUserAccessRequest(strToMailID, strMessage.ToString());
                            lblMessage.Text = "Thank you for your access request. You will receive an email shortly in response.";
                        }

                    }
                    else
                    {
                        objUtility.SendTeamAccessRequestEmail(strToMailID, strMessage.ToString(), lblTeamName.Text, hidTeamOwner.Value);
                        lblMessage.Text = "Thank you for your access request. You will receive an email shortly in response.";
                    }

                    cmdSubmit.Visible = false;
                    cmdReset.Visible = false;
                }
            }
            catch(WebException webEx)
            {
                //  ExceptionPanel.Visible = true;
                // lblException.Visible = true;
                //  lblException.Text = webEx.Message;
            }
            catch(Exception ex)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex);
            }
            finally
            {
                if(dtListValue != null)
                    dtListValue.Dispose();
            }
        }
예제 #3
0
        /// <summary>
        /// Updates the book publish details.
        /// </summary>
        /// <param name="requestID">The request ID.</param>
        /// <param name="documentURL">The document URL.</param>
        /// <param name="parentSiteURL">The parent site URL.</param>
        /// <param name="currentUser">The current user.</param>
        /// <param name="isPublish">if set to <c>true</c> [is publish].</param>
        /// <param name="liveBookName">Name of the live book.</param>
        /// <param name="xmlDoc">The XML doc.</param>
        /// <param name="bookID">The book ID.</param>
        public void UpdateBookPublishDetails(string requestID, string documentURL, string parentSiteURL, string currentUser, bool isPublish, string liveBookName, XmlDocument xmlDoc, int bookID)
        {
            ActiveDirectoryService objAds = new ActiveDirectoryService();
            string strEmailID = objAds.GetEmailID(currentUser.ToString());

            objCommonDAL = new CommonDAL();
            objCommonDAL.UpdateBookPublishDetails(requestID, documentURL, parentSiteURL, currentUser, "DWB Book Print details Library", isPublish, liveBookName, xmlDoc, strEmailID, bookID);
        }