示例#1
0
        private static string GetGroupEmails(string groupName)
        {
            using (ClientContext ctx = new ClientContext(SharePointHelper.Url))
            {
                var web = SharePointHelper.GetWeb(ctx);

                var group = SharePointHelper.GetGroup(ctx, web, groupName);
                var users = group.Users;

                ctx.Load(users);
                ctx.ExecuteQuery();

                var emails = "";

                foreach (User u in group.Users)
                {
                    if (!string.IsNullOrEmpty(u.Email))
                    {
                        emails += u.Email + ",";
                    }
                }


                emails = emails.TrimEnd(',');

                return(emails);
            }
        }
示例#2
0
        public IList <Document> FetchDocuments(string countryCode)
        {
            IList <Document> docList = null;

            try
            {
                Dictionary <string, IList <Document> > countryToDocMap = SPObjectCache.Get(cacheKey) as Dictionary <string, IList <Document> >;

                if (countryToDocMap == null)
                {
                    countryToDocMap = new Dictionary <string, IList <Document> >();
                }

                if (countryToDocMap.ContainsKey(countryCode))
                {
                    docList = countryToDocMap[countryCode];
                }

                if (docList == null)
                {
                    SharePointHelper spHelper = new SharePointHelper();
                    docList = spHelper.GetCountryDocuments(countryCode);

                    countryToDocMap[countryCode] = docList;
                    SPObjectCache.Add(cacheKey, countryToDocMap);
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogError(string.Format(@"Error fetching document for {0}", countryCode), ex);
            }

            return(docList);
        }
示例#3
0
        /// <summary>
        ///     Function to email system error messages
        /// </summary>
        /// <param name="errSysMsg"></param>
        public bool logSysErrorEmail(string APP_NAME, Exception errSysMsg, string errTitle)
        {
            try
            {
                string           categorySetting = "EmailTo";
                SharePointHelper spHelper        = new SharePointHelper(_spSettingList, categorySetting, _spCurrentWeb);

                string EmailTo  = spHelper.GetRCRSettingsItem(categorySetting, _spSettingList).ToString();
                string strError = System.DateTime.Now + "<br>Application: " + APP_NAME + "<br>Error Message: " + errSysMsg.Message + "<br>";

                //Check the InnerException
                while ((errSysMsg.InnerException != null))
                {
                    strError += errSysMsg.InnerException.ToString();
                    errSysMsg = errSysMsg.InnerException;
                }

                //Send error log via email
                SPUtility.SendEmail(_spCurrentWeb, false, false, EmailTo, errTitle, strError);

                SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(APP_NAME, TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, strError, errSysMsg.StackTrace);
                spHelper = null;

                return(true);
            }
            catch
            {
                SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(APP_NAME, TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, errSysMsg.Message.ToString(), errSysMsg.StackTrace);
                return(false);
            }
        }
示例#4
0
        public override void MapFromList(ListItem item, bool includeChildren = false)
        {
            base.MapFromList(item);

            this.SharePointList  = SharePointHelper.ToStringNullSafe(item["SharePointList"]);
            this.ViewName        = SharePointHelper.ToStringNullSafe(item["ViewName"]);
            this.RecipientType   = SharePointHelper.ToStringNullSafe(item["RecipientType"]);
            this.RecipientColumn = SharePointHelper.ToStringNullSafe(item["RecipientColumn"]);
            this.Subject         = SharePointHelper.ToStringNullSafe(item["Subject"]);
            this.Frequency       = SharePointHelper.ToStringNullSafe(item["Frequency"]);
            this.Body            = SharePointHelper.ToStringNullSafe(item["Body"]);
            this.NextRunDate     = Convert.ToDateTime(item["NextRunDateTime"]);
            this.LastRunDate     = Convert.ToDateTime(item["LastRunDateTime"]);
            this.LastRunStatus   = SharePointHelper.ToStringNullSafe(item["LastRunStatus"]);
            this.IncludeCc       = Convert.ToBoolean(item["IncludeCC"]);
            this.Enabled         = Convert.ToBoolean(item["Enabled"]);
            this.Application     = SharePointHelper.ToStringNullSafe(item["Application"]);

            var dict = new Dictionary <string, string>();

            dict = Settings.GetAppEmailFieldsDef(dict);

            if (Title == NotificationTypes.EXTENSION_DECISION || Title == NotificationTypes.EXTENSION_RECEIVED || Title == NotificationTypes.EXTENSION_REQUEST)
            {
                dict = ExtensionRequest.GetEmailFieldsDef(dict);
            }
            else
            {
                dict = OGEForm450.GetEmailFieldsDef(dict);
            }

            this.TemplateFields = dict;
        }
示例#5
0
        public void Deactivate()
        {
            try
            {
                if (this.CurrentFormId == 0)
                {
                    var f = OGEForm450.GetCurrentFormByUser(AccountName);

                    CurrentFormId = f != null ? f.Id : 0;
                }

                //  Set Current Form to Canceled
                if (this.CurrentFormId > 0)
                {
                    var form = OGEForm450.Get(this.CurrentFormId);

                    form.FormStatus = Constants.FormStatus.CANCELED;

                    form.Save();

                    form.RemoveExtensions();
                }

                this.Inactive       = true;
                this.InactiveDate   = DateTime.Now;
                this.EmployeeStatus = Constants.EmployeeStatus.INACTIVE;
            }
            catch (Exception ex)
            {
                // Couldn't find form, ignore exception
                SharePointHelper.HandleException(ex, "", "Employee.Deactivate");
            }
        }
        // GET: Announcement
        public async Task <JsonResult> Index()
        {
            SharePointHelper           sharepointHelper = new SharePointHelper();
            IEnumerable <Announcement> announcements    = await sharepointHelper.GetAnnouncements();

            return(Json(announcements.OrderByDescending(a => a.Timestamp), JsonRequestBehavior.AllowGet));
        }
示例#7
0
        public static List <ExtensionRequest> GetPendingExtensions(int ogeForm450Id)
        {
            var ctx     = new ClientContext(SharePointHelper.Url);
            var type    = new ExtensionRequest();
            var results = new List <ExtensionRequest>();

            try
            {
                var web  = SharePointHelper.GetWeb(ctx);
                var list = SharePointHelper.GetList(ctx, web, type.ListName);

                var caml  = GetPendingRequestsCaml(ogeForm450Id);
                var items = list.GetItems(caml);
                ctx.Load(items);
                ctx.ExecuteQuery();

                foreach (ListItem item in items)
                {
                    var t = new ExtensionRequest();

                    t.MapFromList(item);

                    results.Add(t);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to get " + type.ListName + ". " + ex.Message);
            }

            return(results);
        }
示例#8
0
        public override void MapFromList(ListItem item, bool includeChildren = false)
        {
            base.MapFromList(item);

            if (item["EmployeeUpn"] != null)
            {
                EmployeeUpn = ((FieldUserValue)item["EmployeeUpn"]).LookupValue;
            }

            Status                     = SharePointHelper.ToStringNullSafe(item["Status"]);
            EmployeesName              = SharePointHelper.ToStringNullSafe(item["EmployeesName"]);
            Grade                      = SharePointHelper.ToStringNullSafe(item["Grade"]);
            Branch                     = SharePointHelper.ToStringNullSafe(item["Branch"]);
            Division                   = SharePointHelper.ToStringNullSafe(item["Division"]);
            Supervisor                 = SharePointHelper.ToStringNullSafe(item["Supervisor"]);
            Duties                     = SharePointHelper.ToStringNullSafe(item["Duties"]);
            ProposedActivity           = SharePointHelper.ToStringNullSafe(item["ProposedActivity"]);
            PerformedFor               = SharePointHelper.ToStringNullSafe(item["PerformedFor"]);
            TypeOfWork                 = SharePointHelper.ToStringNullSafe(item["TypeOfWork"]);
            NumberOfHours              = SharePointHelper.ToStringNullSafe(item["NumberOfHours"]);
            StartDate                  = SharePointHelper.ToDateTimeNullIfMin(Convert.ToDateTime(item["StartDate"]));
            EndDate                    = SharePointHelper.ToDateTimeNullIfMin(Convert.ToDateTime(item["EndDate"]));
            IsPaid                     = SharePointHelper.ToStringNullSafe(item["IsPaid"]) == "True";
            IsProfessionalService      = SharePointHelper.ToStringNullSafe(item["IsProfessionalService"]) == "True";
            AffirmDependantInformation = SharePointHelper.ToStringNullSafe(item["AffirmDependantInformation"]) == "True";
            AffirmOfficialDuty         = SharePointHelper.ToStringNullSafe(item["AffirmOfficialDuty"]) == "True";
            IsNonProfitEtc             = SharePointHelper.ToStringNullSafe(item["IsNonProfitEtc"]) == "True";
            ClosedDate                 = SharePointHelper.ToDateTimeNullIfMin(Convert.ToDateTime(item["ClosedDate"]));
        }
示例#9
0
        public override void MapFromList(ListItem item, bool includeChildren = false)
        {
            base.MapFromList(item);

            Info      = SharePointHelper.ToStringNullSafe(item["Info"]);
            SortOrder = Convert.ToInt32(item["SortOrder"]);
        }
示例#10
0
        // Uncomment the method below to handle the event raised after a feature has been activated.

        //public override void FeatureActivated(SPFeatureReceiverProperties properties)
        //{
        //}


        // Uncomment the method below to handle the event raised before a feature is deactivated.

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            try
            {
                using (SPSite oSPSite = new SPSite(SPContext.Current.Site.Url))
                {
                    using (SPWeb oSPWeb = oSPSite.OpenWeb())
                    {
                        SharePointHelper spHelper = new SharePointHelper(LIST_SETTING, "EmailTo", oSPWeb);
                        spHelper.DeleteList(LIST_SETTING, oSPWeb);
                        spHelper = null;
                    }
                }
            }
            catch (Exception err)
            {
                using (SPSite oSPSite = new SPSite(SPContext.Current.Site.Url))
                {
                    using (SPWeb oSPWeb = oSPSite.OpenWeb())
                    {
                        emailUser(APP_NAME + "- FeatureDeactivating Error!", err.Message.ToString(), oSPWeb);
                    }
                }
                SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(APP_NAME, TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, err.Message.ToString(), err.StackTrace);
            }
        }
示例#11
0
        public virtual T Save()
        {
            ListItem newItem;

            try
            {
                SPContext = new ClientContext(SharePointHelper.MigrateUrl);

                var web  = SharePointHelper.GetWeb(SPContext);
                var list = SharePointHelper.GetList(SPContext, web, ListName);

                if (Id == 0)
                {
                    // Create
                    var itemCreateInfo = new ListItemCreationInformation();
                    newItem = list.AddItem(itemCreateInfo);
                }
                else
                {
                    // Update
                    newItem = list.GetItemById(Id);
                }

                MapToList(newItem);
                newItem.Update();
                SPContext.Load(newItem);
                SPContext.ExecuteQuery();
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to save " + ListName + " with id " + Id + ". " + ex.Message);
            }

            return(Get(newItem.Id));
        }
示例#12
0
        public static List <OGEForm450> GetAllReviewable()
        {
            var ctx     = new ClientContext(SharePointHelper.Url);
            var type    = new OGEForm450();
            var results = new List <OGEForm450>();

            try
            {
                var web  = SharePointHelper.GetWeb(ctx);
                var list = SharePointHelper.GetList(ctx, web, type.ListName);

                var caml  = GetReviewableCaml();
                var items = list.GetItems(caml);

                ctx.Load(items);
                ctx.ExecuteQuery();

                foreach (ListItem item in items)
                {
                    var t = new OGEForm450();

                    t.MapFromList(item);
                    results.Add(t);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to get " + type.ListName + ". " + ex.Message);
            }

            return(results);
        }
示例#13
0
        public static T GetBy(string key, int value)
        {
            var ctx = new ClientContext(SharePointHelper.MigrateUrl);
            var t   = new T();

            try
            {
                var web  = SharePointHelper.GetWeb(ctx);
                var list = SharePointHelper.GetList(ctx, web, t.ListName);

                var caml  = SharePointHelper.GetByCaml(key, value);
                var items = list.GetItems(caml);
                ctx.Load(items);
                ctx.ExecuteQuery();

                var item = items.FirstOrDefault();

                t.MapFromList(item);
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to get " + t.ListName + ". " + ex.Message);
            }

            return(t);
        }
示例#14
0
        public static List <T> GetAllBy(string key, string value, bool notEqual = false)
        {
            var ctx     = new ClientContext(SharePointHelper.MigrateUrl);
            var type    = new T();
            var results = new List <T>();

            try
            {
                var web  = SharePointHelper.GetWeb(ctx);
                var list = SharePointHelper.GetList(ctx, web, type.ListName);

                var caml  = SharePointHelper.GetByCaml(key, value, notEqual);
                var items = list.GetItems(caml);
                ctx.Load(items);
                ctx.ExecuteQuery();

                foreach (ListItem item in items)
                {
                    var t = new T();

                    t.MapFromList(item);
                    results.Add(t);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to get " + type.ListName + ". " + ex.Message);
            }

            return(results);
        }
        public async Task <IActionResult> GetList()
        {
            var currentUser = HttpContext.User;
            //var jwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6InRlc3QxIiwicm9sZSI6InRlc3QxIiwibmJmIjoxNjA4MDE4MjE0LCJleHAiOjE2MDgwMTgyMjksImlhdCI6MTYwODAxODIxNH0.mSWppuNmp7Lhh5-qfySmOpZx-YK4taV6yOwu2qUv6dU";
            //var handler = new JwtSecurityTokenHandler();
            //var token = handler.ReadJwtToken(jwt);

            SharepointClientModel sharepointClientModel = new SharepointClientModel();

            sharepointClientModel = new SharepointClientModel()
            {
                ClientId     = "60891e37-f776-471f-80cf-59e74b0f9b93",
                ClientSecret = "Yf1MXgrwmv2dq1q0LEVg83kICWI3Da8ukD46g63kMCE=",
                GrantType    = "client_credentials",
                TenantID     = "9b048e01-f1bb-41c1-8279-71c212d0af1c",
                SiteName     = "sainglinhtoo.sharepoint.com",
                Resource     = "00000003-0000-0ff1-ce00-000000000000"
            };
            AccessTokenModel acc = new AccessTokenModel();

            acc = await SharePointHelper.GetToken(sharepointClientModel);

            var json = await SharePointHelper.GetList(acc.access_token);

            //var jsonData = JsonConvert.SerializeObject(json);
            var data = JObject.Parse(json);

            return(Ok(data));
            //return Unauthorized();
        }
        public override void MapFromList(ListItem item, bool includeChildren = false)
        {
            base.MapFromList(item);

            AssociatedEthicsFormId = SharePointHelper.ToStringNullSafe(item["Associated_x0020_Ethics_x0020_Form_x0020_ID"]);
            FileName = Title;
        }
示例#17
0
        public override void MapToList(ListItem dest)
        {
            if (!string.IsNullOrEmpty(EmployeeUpn))
            {
                dest["EmployeeUpn"] = SharePointHelper.GetFieldUser(EmployeeUpn);
            }

            base.MapToList(dest);

            dest["Status"]           = Status;
            dest["EmployeesName"]    = EmployeesName;
            dest["Grade"]            = Grade;
            dest["Branch"]           = Branch;
            dest["Division"]         = Division;
            dest["Supervisor"]       = Supervisor;
            dest["Duties"]           = Duties;
            dest["ProposedActivity"] = ProposedActivity;
            dest["PerformedFor"]     = PerformedFor;
            dest["TypeOfWork"]       = TypeOfWork;
            dest["NumberOfHours"]    = NumberOfHours;

            dest["StartDate"] = SharePointHelper.ToDateTimeNullIfMin(StartDate);
            dest["EndDate"]   = SharePointHelper.ToDateTimeNullIfMin(EndDate);

            dest["IsPaid"] = IsPaid;
            dest["IsProfessionalService"]      = IsProfessionalService;
            dest["AffirmDependantInformation"] = AffirmDependantInformation;
            dest["AffirmOfficialDuty"]         = AffirmOfficialDuty;
            dest["IsNonProfitEtc"]             = IsNonProfitEtc;

            dest["ClosedDate"] = SharePointHelper.ToDateTimeNullIfMin(ClosedDate);
        }
示例#18
0
        internal IHttpActionResult HandleException(Exception ex)
        {
            var user = AppUser == null ? "unknown" : AppUser.DisplayName;

            SharePointHelper.HandleException(ex, user, this.GetType().Name);

            return(InternalServerError(ex));
        }
示例#19
0
        public string RunBusinessRules(UserInfo appUser, UserInfo submitter, EventRequest oldItem)
        {
            var result = "";

            this.Title = string.IsNullOrEmpty(this.EventName) ? "New Event" : EventName;

            if (string.IsNullOrEmpty(this.Status))
            {
                this.Status = Constants.EventRequestStatus.DRAFT;
            }


            if (this.Status == Constants.EventRequestStatus.UNASSIGNED && (oldItem == null || oldItem.Status == Constants.EventRequestStatus.DRAFT))
            {
                this.SubmittedBy = appUser.Upn;
                this.Submitter   = appUser.DisplayName;

                // EventRequest is being submitted, trigger email notification
                var emailData = this.GetEmailData(submitter);

                _pendingEmails.Add(EmailHelper.GetEmail(NotificationTemplates.NotificationTypes.EVENT_REQUEST_CONFIRMATION, submitter, emailData));
                _pendingEmails.Add(EmailHelper.GetEmail(NotificationTemplates.NotificationTypes.EVENT_REQUEST_SUBMITTED, submitter, emailData));
            }

            if (!string.IsNullOrEmpty(this.AssignedToUpn) && oldItem != null && oldItem.AssignedToUpn != this.AssignedToUpn)
            {
                // Attempting to assign to a new reviewer, if admin or reviewer, accept assignment, set status to Open, else return error
                if (appUser.IsAdmin || appUser.IsReviewer)
                {
                    this.AssignedTo = SharePointHelper.EnsureUser(this.AssignedToUpn).Title;
                    this.Status     = Constants.EventRequestStatus.OPEN;

                    var emailData = this.GetEmailData(submitter);
                    _pendingEmails.Add(EmailHelper.GetEmail(NotificationTemplates.NotificationTypes.EVENT_REQUEST_ASSIGNED, submitter, emailData));
                }
                else
                {
                    result = "Unable to assign event request, you do not have permission to perform this action.";
                }
            }

            if (oldItem != null && !oldItem.Status.Contains("Closed") && this.Status.Contains("Closed"))
            {
                // Attempting to close, only let admin or reviewer close, otherwise return error
                if (appUser.IsAdmin || appUser.IsReviewer)
                {
                    this.ClosedDate = DateTime.Now;
                }
                else
                {
                    result = "Unable to close event request, you do not have permission to perform this action.";
                }
            }

            return(result);
        }
        /// <summary>
        ///     Function to log workflow activities into a SharePoint list
        /// </summary>
        /// <param name="logTitle"></param>
        /// <param name="logMsg"></param>
        /// <param name="spSiteUrl"></param>
        /// <param name="docFileName"></param>
        /// <param name="pdfFileName"></param>
        /// <param name="itemID"></param>
        /// <param name="PdfConvertStatus"></param>
        private void WriteWFLog(string logTitle, string logMsg, string spSiteUrl, string docFileName, string pdfFileName, string itemID, bool PdfConvertStatus)
        {
            SPWeb            currentWeb  = SPContext.Current.Web;
            SharePointHelper objSPHelper = new SharePointHelper(PDF_SETTING_LIST, "SPLogList", currentWeb);

            //Log start of workflow to SP list
            objSPHelper.AddLogListItem(spSiteUrl, logTitle, logMsg, docFileName, pdfFileName, itemID, PdfConvertStatus);
            objSPHelper = null;
            currentWeb  = null;
        }
示例#21
0
        /// <summary>
        ///     Convert document to PDF
        /// </summary>
        public void ConvertDocToPDF(SPListItem listItem)
        {
            try
            {
                SharePointHelper spHelper    = new SharePointHelper();
                string           WordAutoSvc = spHelper.GetRCRSettingsItem("AutomationServices").ToString();

                //Variables used for PDF conversions
                ConversionJobSettings jobSettings;
                ConversionJob         pdfConversionJob;
                string wordFile; //Source Word file
                string pdfFile;  //target destination PDF file

                // Initialize the conversion settings.
                jobSettings = new ConversionJobSettings();
                jobSettings.OutputFormat = SaveFormat.PDF;

                // Create the conversion job using the settings.
                pdfConversionJob = new ConversionJob(WordAutoSvc, jobSettings);

                //Set the credentials to use when running the conversion job.
                pdfConversionJob.UserToken = SPContext.Current.Web.CurrentUser.UserToken;

                // Set the file names to use for the source Word document and the destination PDF document.
                wordFile = SPContext.Current.Web.Url + "/" + listItem.Url;
                if (IsFileTypeDoc(listItem.File, "docx"))
                {
                    pdfFile = wordFile.Replace(".docx", ".pdf");
                }
                else if (IsFileTypeDoc(listItem.File, "doc"))
                {
                    pdfFile = wordFile.Replace(".doc", ".pdf");
                }
                else
                {
                    pdfFile = "";
                }

                if (pdfFile.Length > 0)
                {
                    // Add the file conversion to the conversion job.
                    pdfConversionJob.AddFile(wordFile, pdfFile);

                    // Add the conversion job to the Word Automation Services conversion job queue.
                    // The conversion does not occurimmediately but is processed during the next run of the document conversion job.
                    pdfConversionJob.Start();
                }

                spHelper = null;
            }
            catch (Exception ex)
            {
                SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ClassName, TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, "ConvertDocToPDF - " + ex.Message, ex.StackTrace);
            }
        }
        /// <summary>
        ///     Workflow activity to send email
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void sendEmail_ExecuteCode(object sender, EventArgs e)
        {
            string docFileName = workflowProperties.WebUrl + "/" + workflowProperties.ItemUrl;
            string pdfFileName = "";
            string itemID      = workflowProperties.Item.ID.ToString();
            string spSiteUrl   = SPContext.Current.Site.Url;

            try
            {
                using (SPWeb spWeb = SPContext.Current.Site.OpenWeb(SPContext.Current.Web.ServerRelativeUrl))
                {
                    SharePointHelper objSPHelper = new SharePointHelper(PDF_SETTING_LIST, "EmailFrom", spWeb);
                    SPFieldUserValue currentUser = objSPHelper.GetCurrentUser(spWeb);
                    StringBuilder    emailBody   = new StringBuilder();
                    string           Title       = "PDF Conversion Notification";
                    string           EmailTo     = currentUser.User.Email;

                    emailBody.Append("Dear " + currentUser.User.Name + ",<br>");
                    if (isDocWordFormat)
                    {
                        pdfFileName = Path.ChangeExtension(docFileName, "pdf");
                        emailBody.Append("<p>The document " + docFileName + " is in the process for PDF conversion. Please wait for the PDF file link below to be made availiable.</p><p><b>PDF file:</b> " + pdfFileName + "</p>");
                    }
                    else
                    {
                        emailBody.Append("<p>The document " + docFileName + " is NOT a valid word document file type. Please select the correct word document (*.docx) format for PDF conversion.");
                    }

                    if (EmailTo.Length > 0)
                    {
                        //Send email to user
                        SPUtility.SendEmail(SPContext.Current.Web, true, false, EmailTo, Title, emailBody.ToString());

                        WriteWFLog("PDF Notification Email", "Email has been successfully sent to " + EmailTo, spSiteUrl, docFileName, pdfFileName, itemID, true);
                    }
                    else
                    {
                        WriteWFLog("PDF Notification Email", "Email address is blank and has not been successfully sent", spSiteUrl, docFileName, pdfFileName, itemID, true);
                    }
                    objSPHelper = null;
                    currentUser = null;
                }
            }
            catch (Exception err)
            {
                SPWeb          spCurrentWeb = SPContext.Current.Site.OpenWeb(SPContext.Current.Web.ServerRelativeUrl);
                LogErrorHelper objErr       = new LogErrorHelper(PDF_SETTING_LIST, spCurrentWeb);
                objErr.logSysErrorEmail(APP_NAME, err, "Error at sendEmail_ExecuteCode function");
                objErr       = null;
                spCurrentWeb = null;

                SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(APP_NAME, TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, err.Message.ToString(), err.StackTrace);
                WriteWFLog("ERROR sending email to user!", err.Message.ToString(), spSiteUrl, docFileName, "", itemID, false);
            }
        }
示例#23
0
        public override void MapToList(ListItem dest)
        {
            base.MapToList(dest);

            dest["Application"] = Application;
            dest["Namespace"]   = Namespace;
            dest["Function"]    = Function;
            dest["Info"]        = Info;
            dest["InfoType"]    = InfoType;
            dest["Date"]        = SharePointHelper.ToDateTimeNullIfMin(Date);
        }
        public override void MapFromList(ListItem item, bool includeChildren = false)
        {
            base.MapFromList(item);

            OGEForm450Id   = ((FieldLookupValue)item["OGEForm450Id"]).LookupId;
            InfoType       = SharePointHelper.ToStringNullSafe(item["InfoType"]);
            Name           = SharePointHelper.ToStringNullSafe(item["Name"]);
            Description    = SharePointHelper.ToStringNullSafe(item["Description"]);
            AdditionalInfo = SharePointHelper.ToStringNullSafe(item["AdditionalInfo"]);
            NoLongerHeld   = Convert.ToBoolean(item["NoLongerHeld"]);
        }
示例#25
0
        public override void MapFromList(ListItem item, bool includeChildren = false)
        {
            base.MapFromList(item);

            //FileName = SharePointHelper.ToStringNullSafe(item["Name"]);
            Description = SharePointHelper.ToStringNullSafe(item["Description0"]);
            FormType    = SharePointHelper.ToStringNullSafe(item["FormType"]);
            //ContentType = SharePointHelper.ToStringNullSafe(item["ContentType"]);
            SortOrder = Convert.ToInt32(item["SortOrder"]);
            //Size = Convert.ToInt32(item["Size"]);
        }
示例#26
0
        public override void MapFromList(ListItem item, bool includeChildren = false)
        {
            base.MapFromList(item);

            this.Application = SharePointHelper.ToStringNullSafe(item["Application"]);
            this.Namespace   = SharePointHelper.ToStringNullSafe(item["Namespace"]);
            this.Function    = SharePointHelper.ToStringNullSafe(item["Function"]);
            this.Info        = SharePointHelper.ToStringNullSafe(item["Info"]);
            this.InfoType    = SharePointHelper.ToStringNullSafe(item["InfoType"]);
            this.Date        = SharePointHelper.ToDateTimeNullIfMin(Convert.ToDateTime(item["Date"]));
        }
示例#27
0
        public override void MapToList(ListItem dest)
        {
            if (!string.IsNullOrEmpty(SubmittedBy))
            {
                dest["SubmittedBy"] = SharePointHelper.GetFieldUser(SubmittedBy);
            }

            if (!string.IsNullOrEmpty(AssignedToUpn))
            {
                dest["AssignedTo"]    = SharePointHelper.GetFieldUser(AssignedToUpn);
                dest["AssignedToUpn"] = AssignedToUpn;
            }

            Title = EventName + ((EventStartDate != null) ? " (" + EventStartDate.Value.Year.ToString() + ")" : "");

            base.MapToList(dest);

            dest["EventName"]                 = EventName;
            dest["GuestsInvited"]             = GuestsInvited;
            dest["EventLocation"]             = EventLocation;
            dest["CrowdDescription"]          = CrowdDescription;
            dest["ApproximateAttendees"]      = ApproximateAttendees;
            dest["IsOpenToMedia"]             = IsOpenToMedia;
            dest["EventStartDate"]            = SharePointHelper.ToDateTimeNullIfMin(EventStartDate);
            dest["EventEndDate"]              = SharePointHelper.ToDateTimeNullIfMin(EventEndDate);
            dest["EventContactName"]          = EventContactName;
            dest["EventContactPhone"]         = EventContactPhone;
            dest["IndividualExtendingInvite"] = IndividualExtendingInvite;
            dest["IsIndividualLobbyist"]      = IsIndividualLobbyist;
            dest["OrgExtendingInvite"]        = OrgExtendingInvite;
            dest["IsOrgLobbyist"]             = IsOrgLobbyist;
            dest["TypeOfOrg"]                 = TypeOfOrg;
            dest["OrgHostingEvent"]           = OrgHostingEvent;
            dest["IsHostLobbyist"]            = IsHostLobbyist;
            dest["TypeOfHost"]                = TypeOfHost;
            dest["IsFundraiser"]              = IsFundraiser;
            dest["WhoIsPaying"]               = WhoIsPaying;
            dest["FairMarketValue"]           = FairMarketValue;
            dest["RequiresTravel"]            = RequiresTravel;
            dest["InternationalTravel"]       = InternationalTravel;
            dest["ContactNumber"]             = ContactNumber;
            dest["ContactEmail"]              = ContactEmail;
            dest["ContactComponent"]          = ContactComponent;
            dest["AdditionalInformation"]     = AdditionalInformation;
            dest["GuidanceGiven"]             = GuidanceGiven;
            dest["Status"]         = Status;
            dest["ClosedReason"]   = ClosedReason;
            dest["ClosedBy"]       = ClosedBy;
            dest["ClosedDate"]     = SharePointHelper.ToDateTimeNullIfMin(ClosedDate);
            dest["AttachmentGuid"] = AttachmentGuid;
            dest["Submitter"]      = Submitter;
            dest["OrgOther"]       = OrgOther;
            dest["HostOther"]      = HostOther;
        }
示例#28
0
        public override void MapFromList(ListItem item, bool includeChildren = false)
        {
            base.MapFromList(item);

            this.Division        = Title;
            this.DivisionCode    = SharePointHelper.ToStringNullSafe(item["DivisionCode"]);
            this.FullName        = SharePointHelper.ToStringNullSafe(item["FullName"]);
            this.PayPlan         = SharePointHelper.ToStringNullSafe(item["PayPlan"]);
            this.PositionTitle   = SharePointHelper.ToStringNullSafe(item["PositionTitle"]);
            this.AppointmentType = SharePointHelper.ToStringNullSafe(item["AppointmentType"]);
            this.Upn             = SharePointHelper.ToStringNullSafe(item["Upn"]);
        }
示例#29
0
        public override void MapFromList(ListItem item, bool includeChildren = false)
        {
            base.MapFromList(item);

            OMBEthicsFormId             = SharePointHelper.ToStringNullSafe(item["OMB_x0020_Ethics_x0020_Form_x002"]);
            Submitter                   = SharePointHelper.ToStringNullSafe(item["Submitter"]);
            Attendees                   = SharePointHelper.ToStringNullSafe(item["Attendee"]);
            AttendingCapacity           = SharePointHelper.ToStringNullSafe(item["Attending_x0020_Capacity"]);
            EmployeeType                = SharePointHelper.ToStringNullSafe(item["Employee_x0020_Type"]);
            EventName                   = SharePointHelper.ToStringNullSafe(item["Event_x0020_Name"]);
            EventPurpose                = SharePointHelper.ToStringNullSafe(item["Event_x0020_Purpose"]);
            GuestInvited                = SharePointHelper.ToStringNullSafe(item["Guest_x0020_Invited"]);
            EventLocation               = SharePointHelper.ToStringNullSafe(item["Event_x0020_Location"]);
            EventCrowd                  = SharePointHelper.ToStringNullSafe(item["Event_x0020_Crowd"]);
            EmployeesTotal              = SharePointHelper.ToStringNullSafe(item["Employees_x0020_Total"]);
            OpenToMedia                 = SharePointHelper.ToStringNullSafe(item["Open_x0020_Media_x0020_Present"]);
            EventStartDate              = SharePointHelper.ToDateTimeNullIfMin(Convert.ToDateTime(item["Event_x0020_Date"]));
            EventEndDate                = SharePointHelper.ToDateTimeNullIfMin(Convert.ToDateTime(item["Event_x0020_End_x0020_Date"]));
            EventContactName            = SharePointHelper.ToStringNullSafe(item["Event_x0020_Contact_x0020_Name"]);
            EventContactEmail           = SharePointHelper.ToStringNullSafe(item["Event_x0020_Contact_x0020_Email"]);
            EventContactPhone           = SharePointHelper.ToStringNullSafe(item["Event_x0020_Contact_x0020_Phone"]);
            AttachedInvitation          = SharePointHelper.ToStringNullSafe(item["Attached_x0020_Invitation"]);
            IndividualExtendingInvite   = SharePointHelper.ToStringNullSafe(item["Individual_x0020_Extending_x0020"]);
            OrganizationExtendingInvite = SharePointHelper.ToStringNullSafe(item["Organization_x0020_Extending_x00"]);
            OrganizerHostingEvent       = SharePointHelper.ToStringNullSafe(item["Organizer_x0020_Hosting_x0020_Ev"]);
            Speaker                         = SharePointHelper.ToStringNullSafe(item["Speaker"]);
            PlannedRemarks                  = SharePointHelper.ToStringNullSafe(item["Planned_x0020_Remarks"]);
            Fundraiser                      = SharePointHelper.ToStringNullSafe(item["Fundraiser"]);
            ReasonForAttending              = SharePointHelper.ToStringNullSafe(item["Reason_x0020_For_x0020_Attending"]);
            WhoIsPaying                     = SharePointHelper.ToStringNullSafe(item["Who_x0020_Is_x0020_Paying"]);
            FairMarketValue                 = SharePointHelper.ToStringNullSafe(item["Fair_x0020_Market_x0020_Value"]);
            RequiresTravel                  = SharePointHelper.ToStringNullSafe(item["Requires_x0020_Travel"]);
            InternationalTravel             = SharePointHelper.ToStringNullSafe(item["International_x0020_Travel"]);
            AttachedTravelForm              = SharePointHelper.ToStringNullSafe(item["Attached_x0020_Travel_x0020_Form"]);
            ContactNumber                   = SharePointHelper.ToStringNullSafe(item["Contact_x0020_Number"]);
            ContactEmail                    = SharePointHelper.ToStringNullSafe(item["Contact_x0020_Email"]);
            ContactSupervisor               = SharePointHelper.ToStringNullSafe(item["Contact_x0020_Supervisor"]);
            SupervisorApproval              = SharePointHelper.ToStringNullSafe(item["Supervisor_x0020_Approval"]);
            ContactComponent                = SharePointHelper.ToStringNullSafe(item["Contact_x0020_Component"]);
            AdditionalInformation           = SharePointHelper.ToStringNullSafe(item["Additional_x0020_Information"]);
            GuidanceGiven                   = SharePointHelper.ToStringNullSafe(item["Guidance_x0020_Given"]);
            AssignedFlag                    = SharePointHelper.ToStringNullSafe(item["Assigned_x0020_Flag"]);
            AssignedToUserOBJECT            = SharePointHelper.ToStringNullSafe(item["AssignedToUserOBJECT"]);
            AssignedTo                      = SharePointHelper.ToStringNullSafe(item["Assigned_x0020_To"]);
            AssignedToEmailNotificationSent = SharePointHelper.ToStringNullSafe(item["Assigned_x0020_To_x0020_Email_x0"]);
            EmailNotificationSent           = SharePointHelper.ToStringNullSafe(item["Email_x0020_Notification_x0020_S"]);
            Closed       = SharePointHelper.ToStringNullSafe(item["Closed"]);
            ClosedReason = SharePointHelper.ToStringNullSafe(item["Closed_x0020_Reason"]);
            ClosedBy     = SharePointHelper.ToStringNullSafe(item["Closed_x0020_By"]);
            ClosedDate   = SharePointHelper.ToDateTimeNullIfMin(Convert.ToDateTime(item["Closed_x0020_Date"]));
            ClosedEmailNotificationSent = SharePointHelper.ToStringNullSafe(item["Closed_x0020_Email_x0020_Notific"]);
        }
示例#30
0
        public override void MapFromList(ListItem item, bool includeChildren = false)
        {
            base.MapFromList(item);

            DateAndTime    = Convert.ToDateTime(item["DateAndTime"]);
            Location       = SharePointHelper.ToStringNullSafe(item["Location"]);
            EthicsOfficial = SharePointHelper.ToStringNullSafe(item["EthicsOfficial"]);
            Employee       = ((FieldUserValue)item["Employee"]).LookupValue;
            EmployeesName  = SharePointHelper.ToStringNullSafe(item["EmployeesName"]);
            TrainingType   = SharePointHelper.ToStringNullSafe(item["TrainingType"]);
            Division       = SharePointHelper.ToStringNullSafe(item["Division"]);
            Year           = Convert.ToInt32(item["Year"]);
        }
示例#31
0
 public Admin( )
 {
     SharePointHelper = new SharePointHelper( );
 }
示例#32
0
		public Uploader()
		{
			SharePointHelper = new SharePointHelper();
		}