Exemple #1
0
        public FormInfoBO GetFormInfoByFormId(string formId, int userId)
        {
            //Owner Forms
            FormInfoBO result = new FormInfoBO();

            if (userId > 0)
            {
                result = _formInfoDao.GetFormByFormId(formId, userId);
            }

            result.HasDraftModeData = _formInfoDao.HasDraftRecords(formId);

            return(result);
        }
Exemple #2
0
        private void SendEmail(Dictionary <int, String> AssignedUserList, string FormId, List <UserBO> FormCurrentUsersList, bool ShareForm = false)
        {
            try
            {
                FormInfoBO FormInfoBO = _formInfoDao.GetFormByFormId(FormId);
                if (!string.IsNullOrEmpty(FormInfoBO.ParentId))
                {
                    return;
                }
                UserBO        UserBO            = _userDao.GetCurrentUser(FormInfoBO.UserId);
                List <string> UsersEmail        = new List <string>();
                List <string> CurrentUsersEmail = new List <string>();

                foreach (UserBO User in FormCurrentUsersList)
                {
                    CurrentUsersEmail.Add(User.EmailAddress);
                }


                if (CurrentUsersEmail.Count() > 0)
                {
                    foreach (var User in AssignedUserList)
                    {
                        if (!CurrentUsersEmail.Contains(User.Value))
                        {
                            UsersEmail.Add(User.Value);
                        }
                    }
                }
                else
                {
                    foreach (var User in AssignedUserList)
                    {
                        UsersEmail.Add(User.Value);
                    }
                }

                if (UsersEmail.Count() > 0)
                {
                    Epi.Web.Enter.Common.Email.Email Email = new Web.Enter.Common.Email.Email();
                    if (!ShareForm)
                    {
                        Email.Body    = UserBO.FirstName + " " + UserBO.LastName + " has assigned the following form to you in Epi Info™ Cloud Data Capture.\n\nTitle: " + FormInfoBO.FormName + " \n \n \nPlease click the link below to launch Epi Info™ Cloud Data Capture.";
                        Email.Body    = Email.Body.ToString() + " \n \n" + ConfigurationManager.AppSettings["BaseURL"];
                        Email.From    = UserBO.EmailAddress;
                        Email.To      = UsersEmail;
                        Email.Subject = "An Epi Info Cloud Data Capture Form - " + FormInfoBO.FormName + " has been assigned to you";
                    }
                    else
                    {
                        Email.Body    = UserBO.FirstName + " " + UserBO.LastName + " has shared the following form  with your organization in Epi Info™ Cloud Data Capture.\n\nTitle: " + FormInfoBO.FormName + " \n \n \nPlease click the link below to launch Epi Info™ Cloud Data Capture.";
                        Email.Body    = Email.Body.ToString() + " \n \n" + ConfigurationManager.AppSettings["BaseURL"];
                        Email.From    = UserBO.EmailAddress;
                        Email.To      = UsersEmail;
                        Email.Subject = "An Epi Info Cloud Data Capture Form - " + FormInfoBO.FormName + " has been shared with your organization.";
                    }
                    Epi.Web.Enter.Common.Email.EmailHandler.SendMessage(Email);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }