コード例 #1
0
        public DistributionList GetCompanyListFromReader(IDataReader dataReader)
        {
            EntityConverter <DistributionList> distroEntity = new EntityConverter <DistributionList>();
            DistributionList companyList = distroEntity.Convert(dataReader);

            return(companyList);
        }
コード例 #2
0
 private void m_sendEmail1_MethodInvoking(object sender, EventArgs e)
 {
     try
     {
         POLibraryWorkflowAssociationData _activationData  = POLibraryWorkflowAssociationData.Deserialize(m_WorkflowProperties.InitiationData);
         IPurchaseOrderTemplate           _emailBodyObject = null;
         using (EntitiesDataContext _EDC = new EntitiesDataContext(m_WorkflowProperties.SiteUrl))
         {
             if (_activationData.Carrier)
             {
                 _emailBodyObject = FreightPurchaseOrderTemplate.CreateEmailMessage(m_WorkflowProperties.Item, _EDC);
             }
             else
             {
                 _emailBodyObject = SecurityEscortPurchaseOrderTemplate.CreateEmailMessage(m_WorkflowProperties.Item, _EDC);
             }
             m_sendEmail1_CC = DistributionList.GetEmail(ShepherdRole.Coordinator, _EDC);
         }
         m_sendEmail1_From    = m_WorkflowProperties.OriginatorEmail;
         m_sendEmail1_Subject = _activationData.Name;
         m_sendEmail1_To      = _emailBodyObject.EmaiAddressTo;
         m_sendEmail1_Body    = _emailBodyObject.TransformText();
     }
     catch (Exception ex)
     {
         string _frmt = "Worflow aborted in TransformText because of the error: {0}";
         throw new ApplicationException(String.Format(_frmt, ex.Message));
     }
 }
        /// <summary>
        /// Gets favorite Distribution List details from Graph.
        /// </summary>
        /// <param name="favoriteDistributionListEntities">Favorite Distribution List data from storage.</param>
        /// <param name="accessToken">Token to access MS graph.</param>
        /// <returns>Favorite distribution list data from graph.</returns>
        public async Task <List <FavoriteDistributionListData> > GetFavoriteDistributionListsFromGraphAsync(
            IEnumerable <FavoriteDistributionListTableEntity> favoriteDistributionListEntities,
            string accessToken)
        {
            List <FavoriteDistributionListData> favoriteDistributionList = new List <FavoriteDistributionListData>();

            List <string>           groupIds         = favoriteDistributionListEntities.Select(dl => dl.GroupId).ToList();
            List <DistributionList> distributionList = await this.GetDistributionListDetailsFromGraphAsync(groupIds, accessToken);

            foreach (FavoriteDistributionListTableEntity currentItem in favoriteDistributionListEntities)
            {
                DistributionList currentDistributionList = distributionList.Find(dl => dl.Id == currentItem.GroupId);
                if (currentDistributionList == null)
                {
                    continue;
                }

                favoriteDistributionList.Add(
                    new FavoriteDistributionListData
                {
                    IsPinned      = currentItem.PinStatus,
                    DisplayName   = currentDistributionList.DisplayName,
                    Mail          = currentDistributionList.Mail,
                    ContactsCount = currentDistributionList.MembersCount,
                    Id            = currentItem.GroupId,
                    UserObjectId  = currentItem.UserObjectId,
                });
            }

            return(favoriteDistributionList);
        }
コード例 #4
0
        /// <summary>
        /// Stores the DL invalid members info in a local file.
        /// </summary>
        /// <param name="distributionList">Existing distribution list model.</param>
        /// <param name="actionName">Name of the flow attempting to write a failure list</param>
        /// <param name="errorDetails">Add Members details to be written</param>
        /// <returns></returns>
        internal string StoreDistributionListFailures(DistributionList distributionList, string actionName, AddMembersErrorDetails errorDetails)
        {
            string path;

            try
            {
                var directory = Directory.CreateDirectory(AppPath);

                var serializer = new XmlSerializer(typeof(AddMembersErrorDetails));
                path = Path.Combine(directory.FullName, distributionList.Name + "_" + actionName + "_Failures.xmldl");

                using (var writer = new StreamWriter(path))
                {
                    serializer.Serialize(writer, errorDetails);
                }

                LoggingViewModel.Instance.Logger.Write(string.Concat("StoreDistributionListInvalidMembers:OK ", path,
                                                                     Environment.NewLine,
                                                                     distributionList.Name));
            }
            catch (Exception exception)
            {
                LoggingViewModel.Instance.Logger.Write(string.Concat("StoreDistributionListInvalidMembers:Error ",
                                                                     exception.Message, Environment.NewLine,
                                                                     exception.StackTrace,
                                                                     Environment.NewLine,
                                                                     distributionList.Name));

                path = string.Empty;
            }

            return(path);
        }
コード例 #5
0
        /// <summary>
        /// User wishes to add a new distribution list to Connection - this routine shows a modal form for gathering the name, alias and optionally
        /// an extension number and then adds the new list and shows it in the grid by itself.
        /// </summary>
        private void buttonAddItem_Click(object sender, EventArgs e)
        {
            using (FormNewDistributionListInfo oForm = new FormNewDistributionListInfo())
            {
                if (oForm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                //the call can take a minute to return - disable controls on the form to indicate we're busy.
                DisableFormControls();

                WebCallResult res = DistributionList.AddDistributionList(GlobalItems.CurrentConnectionServer,
                                                                         oForm.DisplayName,
                                                                         oForm.Alias,
                                                                         oForm.Extension,
                                                                         null);
                EnableFormControls();

                if (res.Success)
                {
                    //force a refresh of the grid and then select the list you just added - the ObjectId of the newly added list is returned
                    //in the WebCallResult structure as the ReturnObjectID.
                    _currentPage = 0;
                    UpdateDataDisplay(res.ReturnedObjectId);
                    Logger.Log(string.Format("New distribution list added:{0},{1}", oForm.DisplayName, res.ReturnedObjectId));
                }
                else
                {
                    Logger.Log(string.Format(string.Format("New distribution list add failed:{0}\r\n{1}", oForm.DisplayName, res.ToString())));
                    MessageBox.Show(String.Format("Error adding new distribution list: {0}\r\nresponse from CUPI: {1}", res.ErrorText, res.ResponseText));
                }
            }
        }
コード例 #6
0
        public void TestDistributionListAnnouncementFromDomainAlias()
        {
            var smtpClientSimulator = new SmtpClientSimulator();

            //
            // TEST LIST SECURITY IN COMBINATION WITH DOMAIN NAME ALIASES
            //


            Account account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");

            var recipients = new List <string>();

            recipients.Add("*****@*****.**");

            DistributionList list3 = SingletonProvider <TestSetup> .Instance.AddDistributionList(_domain, "*****@*****.**",
                                                                                                 recipients);

            list3.Mode = eDistributionListMode.eLMAnnouncement;
            list3.RequireSenderAddress = "*****@*****.**";
            list3.Save();

            // THIS MESSAGE SHOULD FAIL
            CustomAsserts.Throws <DeliveryFailedException>(() => smtpClientSimulator.Send("*****@*****.**", "*****@*****.**", "Mail 1", "Mail 1"));

            DomainAlias domainAlias = _domain.DomainAliases.Add();

            domainAlias.AliasName = "dummy-example.com";
            domainAlias.Save();

            // THIS MESSAGE SHOULD SUCCEED
            smtpClientSimulator.Send("*****@*****.**", "*****@*****.**", "Mail 1", "Mail 1");
            ImapClientSimulator.AssertMessageCount("*****@*****.**", "test", "Inbox", 1);
        }
コード例 #7
0
        public void SetDistributionListVoiceName_EmptyObjectId_Failure()
        {
            const string strWavName = @"c:\";
            var          res        = DistributionList.SetDistributionListVoiceName(_mockServer, strWavName, "");

            Assert.IsFalse(res.Success, "SetDistributionListVoiceName did not fail with empty obejctID");
        }
コード例 #8
0
        public void CallHandlerTemplate_AddDeleteTest_ListRecipient()
        {
            List <PhoneSystem> oPhoneSystems;
            var res = PhoneSystem.GetPhoneSystems(_connectionServer, out oPhoneSystems, 1, 1);

            Assert.IsTrue(res.Success, "Failed to fetch phone systems:" + res);
            Assert.IsTrue(oPhoneSystems.Count == 1, "Failed to fetch single phone system");

            List <DistributionList> oLists;

            res = DistributionList.GetDistributionLists(_connectionServer, out oLists, 1, 1);
            Assert.IsTrue(res.Success, "Failed to fetch lists:" + res);
            Assert.IsTrue(oLists.Count == 1, "Failed to fetch single list");

            string strName = "Temp_" + Guid.NewGuid().ToString();

            CallHandlerTemplate oTemplate;

            res = CallHandlerTemplate.AddCallHandlerTemplate(_connectionServer, strName, oPhoneSystems[0].ObjectId,
                                                             oLists[0].ObjectId, "", null, out oTemplate);

            Assert.IsTrue(res.Success, "Failed creating new call handler template:" + res);

            res = oTemplate.Delete();
            Assert.IsTrue(res.Success, "Failed deleting call handler template:" + res);
        }
コード例 #9
0
        public void GetDistributionListVoiceName_EmptyObjectId_Failure()
        {
            const string strWavName = @"c:\";
            var          res        = DistributionList.GetDistributionListVoiceName(_mockServer, "", strWavName);

            Assert.IsFalse(res.Success, "GetDistributionListVoiceName did not fail with empty ObjectId passed");
        }
コード例 #10
0
ファイル: Basics.cs プロジェクト: mr3188/hmailserver
        public void TestRenameDomainWithList()
        {
            DistributionList oList = _domain.DistributionLists.Add();

            oList.Address = "*****@*****.**";
            oList.Active  = true;
            oList.Save();

            DistributionListRecipient oRecipient = oList.Recipients.Add();

            oRecipient.RecipientAddress = "*****@*****.**";
            oRecipient.Save();

            oRecipient = oList.Recipients.Add();
            oRecipient.RecipientAddress = "*****@*****.**";
            oRecipient.Save();

            oRecipient = oList.Recipients.Add();
            oRecipient.RecipientAddress = "*****@*****.**";
            oRecipient.Save();

            _domain.Name = "example.com";
            _domain.Save();

            DistributionList list = _domain.DistributionLists[0];

            Assert.AreEqual("*****@*****.**", list.Address);
            Assert.AreEqual("*****@*****.**", list.Recipients[0].RecipientAddress);
            Assert.AreEqual("*****@*****.**", list.Recipients[1].RecipientAddress);
            Assert.AreEqual("*****@*****.**", list.Recipients[2].RecipientAddress);
        }
コード例 #11
0
        public static ContactBase AddADRecipientToContacts(UserContext userContext, ADRecipient adRecipient)
        {
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            if (adRecipient == null)
            {
                throw new ArgumentNullException("adRecipient");
            }
            Participant primaryParticipant = ContactUtilities.GetPrimaryParticipant(adRecipient);

            if (primaryParticipant == null)
            {
                return(null);
            }
            if (adRecipient is IADDistributionList)
            {
                DistributionList distributionList = DistributionList.Create(userContext.MailboxSession, userContext.ContactsFolderId);
                distributionList.Add(new Participant(adRecipient));
                distributionList.DisplayName = (string)adRecipient[ADRecipientSchema.DisplayName];
                distributionList.Save(SaveMode.ResolveConflicts);
                return(distributionList);
            }
            Contact contact = Contact.Create(userContext.MailboxSession, userContext.ContactsFolderId);

            ContactUtilities.AddContactProperties(userContext, contact, adRecipient, primaryParticipant);
            contact.Save(SaveMode.ResolveConflicts);
            return(contact);
        }
コード例 #12
0
        public void GetDistributionLists_NullConnectionServer_Failure()
        {
            List <DistributionList> oList;
            WebCallResult           res = DistributionList.GetDistributionLists(null, out oList, null);

            Assert.IsFalse(res.Success, "GetDistributionLists failed to catch null ConnectionServerRest object");
        }
コード例 #13
0
        /// <summary>
        /// Stores the DL information in a local file.
        /// </summary>
        /// <param name="distributionList">Existing distribution list model.</param>
        /// <returns></returns>
        internal string StoreDistributionListInformation(DistributionList distributionList)
        {
            string path;

            try
            {
                var directory = Directory.CreateDirectory(AppPath);

                var serializer = new XmlSerializer(typeof(DistributionList));
                path = Path.Combine(directory.FullName, distributionList.Name + ".xmldl");

                using (var writer = new StreamWriter(path))
                {
                    serializer.Serialize(writer, distributionList);
                }

                LoggingViewModel.Instance.Logger.Write(string.Concat("StoreDistributionListInformation:OK ", path,
                                                                     Environment.NewLine,
                                                                     distributionList.Name));
            }
            catch (Exception exception)
            {
                LoggingViewModel.Instance.Logger.Write(string.Concat("StoreDistributionListInformation:Error ",
                                                                     exception.Message, Environment.NewLine,
                                                                     exception.StackTrace, Environment.NewLine, string.Join(",", distributionList.Members.ToArray()),
                                                                     Environment.NewLine,
                                                                     distributionList.Name));

                path = string.Empty;
            }

            return(path);
        }
コード例 #14
0
        public DistributionList GetDistributionListByDepartmentId(int DepartmentId)
        {
            using (DBService dbservice = new BLL.DBService())
            {
                using (DataTable dt = new DataTable())
                {
                    string selectQuery = "SELECT DS.*, d.DepartmentName FROM DistributionList DS inner join Department d on DS.DepartmentId=d.ID  where  DepartmentId=" + DepartmentId.ToString() + ";";
                    //SELECT L.* , d.DepartmentName FROM LoginUser L inner join Department d on L.DepartmentID=d.ID where L.ID=" + id.ToString() + ";";
                    using (OleDbDataAdapter adapter = new OleDbDataAdapter(selectQuery, dbservice.conn))
                    {
                        adapter.Fill(dt);
                    }
                    DistributionList usr = null;
                    if (dt.Rows.Count > 0)
                    {
                        usr = new DistributionList();
                        foreach (DataRow dr in dt.Rows)
                        {
                            usr.DepartmentId = dr["DepartmentID"] != null?Convert.ToInt32(dr["DepartmentID"]) : -1;

                            usr.Recepients = dr["Recepients"].ToString();
                            usr.Department.DepartmentName = dr["DepartmentName"].ToString();
                            usr.IsIncludeUsers            = Convert.ToBoolean(dr["IsIncludeUsers"]);
                            usr.ID = dr["ID"] != null?Convert.ToInt32(dr["ID"]) : -1;
                        }
                    }
                    return(usr);
                }
            }
        }
コード例 #15
0
        public int EditDistributionList(DistributionList dsList)
        {
            using (DBService dbservice = new BLL.DBService())
            {
                DistributionList ds = GetDistributionListByDepartmentId(dsList.DepartmentId);
                if (ds != null)
                {
                    string updateQuery = "UPDATE DistributionList SET [Recepients]='" + dsList.Recepients + "', [IsIncludeUsers]=" + dsList.IsIncludeUsers + " WHERE Departmentid=" + dsList.DepartmentId + ";";
                    using (OleDbCommand cmd = new OleDbCommand(updateQuery, dbservice.conn))
                    {
                        return(cmd.ExecuteNonQuery());
                    }
                }
                else
                {
                    string insertQuery = "INSERT INTO DistributionList (Recepients,IsIncludeUsers,DepartmentID) VALUES ('" + dsList.Recepients + "'," + dsList.IsIncludeUsers + "," + dsList.DepartmentId + ");";


                    using (OleDbCommand cmd = new OleDbCommand(insertQuery, dbservice.conn))
                    {
                        return(cmd.ExecuteNonQuery());
                    }
                }
            }
        }
コード例 #16
0
        /// <summary>
        /// Armed with the ObjectId of a distribution list (passed in via a public property to this form) this routine will
        /// get a list of members from Connection and display them in the grid on the form for review.
        /// </summary>
        private void LoadMembers()
        {
            //while we're loading members make sure the user can't try and edit anything
            DisableFormControls();

            gridMembers.DataSource = null;

            WebCallResult res;
            List <DistributionListMember> oMembers;

            res = DistributionList.GetMembersList(GlobalItems.CurrentConnectionServer, DistributionListObjectId, out oMembers);

            EnableFormControls();

            //if the list has no members fals is returned but the member list object will not be null - only bark an error here if it's null meaning
            //there was really a problem with the fetch.
            if (res.Success == false & oMembers == null)
            {
                MessageBox.Show("Failure fetching distribution list membership:" + res.ErrorText);
                //again, nothing can be done here without membership data so just exit the form.
                this.Close();
            }

            labelListCountValue.Text = string.Format("Members in list: {0}", oMembers.Count);

            //in a production application you'd want to rename columns to be neater and hide colums you didn't want folks to see and such -
            //here we just show everything returned.
            gridMembers.DataSource = oMembers;
            gridMembers.Refresh();
        }
コード例 #17
0
        /// <summary>
        /// Allow the uer to select a subscriber to add to the distribution list as a member - you'd follow the same procedure to add a list just use
        /// the AddMemberPublicList function off the DistributionList class instead of the AddMemberUser.
        /// </summary>
        private void buttonAddUser_Click(object sender, EventArgs e)
        {
            using (FormFindUser oForm = new FormFindUser())
            {
                oForm.ShowDialog();
                if (oForm.DialogResult == DialogResult.Cancel)
                {
                    //user canceled - nothing to do here
                    return;
                }

                WebCallResult res = DistributionList.AddMemberUser(GlobalItems.CurrentConnectionServer,
                                                                   DistributionListObjectId,
                                                                   oForm.UserObjectId);

                //if the user added ok force the membership grid to update to reflect that - otherwise give the user the error message and exit.
                if (res.Success)
                {
                    MessageBox.Show("User added");
                    LoadMembers();
                }
                else
                {
                    //note, adding a duplicate member will result in an error.
                    MessageBox.Show("Error adding user:" + res.ToString());
                }
            }
        }
コード例 #18
0
        public DistributionList generateRandomDist(int count)
        {
            var  dists      = new DistributionList();
            var  dist       = new DistributionSummary();
            var  rand       = new Random();
            bool hasDeposit = false;

            for (int i = 0; i < count; i++)
            {
                hasDeposit = rand.Next(1, 10) % 2 == 0;

                dist = new DistributionSummary()
                {
                    OriginalDistributionID = rand.Next(100000, 999999),
                    TargetAgentID          = rand.Next(100, 10000),
                    TargetAgentName        = "Random Branch #" + i,
                    RequestTime            = DateTime.Now.AddMinutes(rand.Next(100, 10000) * -1),
                    Amount          = rand.Next(10, 10000) * 1000,
                    HasDeposit      = hasDeposit,
                    BankName        = hasDeposit ? "Random Bank #" + i : null,
                    AccountNumber   = hasDeposit ? rand.Next(1000000, 9999999).ToString() : null,
                    ReferenceNumber = hasDeposit ? rand.Next(10000, 99999).ToString() : null,
                    DepositComment  = "Deposit comment #" + i
                };
                if (hasDeposit)
                {
                    dist.DepositDate = DateTime.Now.AddMinutes(rand.Next(100, 10000) * -1);
                }

                dists.Add(dist);
            }
            return(dists);
        }
コード例 #19
0
        public void GetDistributionListVoiceName_Test()
        {
            //use the same string for the alias and display name here
            String strWavName = "TempWAV_" + Guid.NewGuid().ToString();

            //create new list with GUID in the name to ensure uniqueness
            DistributionList oList;

            WebCallResult res = DistributionList.GetDistributionList(out oList, _connectionServer, "", "allvoicemailusers");

            Assert.IsTrue(res.Success, "Fetch of AllVoiceMailUsers list failed:" + res.ToString());
            Assert.AreNotEqual(oList, null, "Fetch of AllVoiceMailUsers list failed returning an empty list");

            //first, get from static method without voice name
            res = DistributionList.GetDistributionListVoiceName(_connectionServer, strWavName, oList.ObjectId);
            Assert.IsTrue(res.Success, "Static method fetch of voice name for allVoiceMailUsers failed:" + res.ToString());
            Assert.IsTrue(File.Exists(strWavName), "Static method voice name fetch did not produce a wav file as expected.");

            File.Delete(strWavName);

            //generate new wav name just to be save
            strWavName = "TempWAV_" + Guid.NewGuid().ToString();

            //now fetch from list instance
            res = oList.GetVoiceName(strWavName);

            Assert.IsTrue(res.Success, "Instance method voice name fetch failed:" + res.ToString());
            Assert.IsTrue(File.Exists(strWavName), "Instance method voice name fetch did not produce a wav file as expected.");

            //clean up the temporary WAV file name
            File.Delete(strWavName);
        }
コード例 #20
0
        public void DistributionList_FullListDataTests()
        {
            List <DistributionList> oLists;
            var res = DistributionList.GetDistributionLists(_connectionServer, out oLists, 1, 2);

            Assert.IsTrue(res.Success, "Failed fetching lists:" + res);
            Assert.IsTrue(oLists.Count > 0, "No lists returned on fetch");
            Assert.IsFalse(string.IsNullOrEmpty(oLists[0].DtmfName), "DTMFName not fetched automatically from list result");

            res = DistributionList.GetDistributionLists(_connectionServer, out oLists, 1, 2);
            Assert.IsTrue(res.Success, "Failed fetching lists:" + res);
            Assert.IsTrue(oLists.Count > 0, "No lists returned on fetch");
            Assert.IsTrue(oLists[0].CreationTime < DateTime.Now.AddDays(2), "List creation date is not correct");

            res = DistributionList.GetDistributionLists(_connectionServer, out oLists, 1, 2);
            Assert.IsTrue(res.Success, "Failed fetching lists:" + res);
            Assert.IsTrue(oLists.Count > 0, "No lists returned on fetch");
            Console.WriteLine(oLists[0].AllowContacts);

            res = DistributionList.GetDistributionLists(_connectionServer, out oLists, 1, 2);
            Assert.IsTrue(res.Success, "Failed fetching lists:" + res);
            Assert.IsTrue(oLists.Count > 0, "No lists returned on fetch");
            Console.WriteLine(oLists[0].AllowForeignMessage);

            res = DistributionList.GetDistributionLists(_connectionServer, out oLists, 1, 2);
            Assert.IsTrue(res.Success, "Failed fetching lists:" + res);
            Assert.IsTrue(oLists.Count > 0, "No lists returned on fetch");
            Assert.IsTrue(oLists[0].IsPublic, "Is Public value no valid");

            res = DistributionList.GetDistributionLists(_connectionServer, out oLists, 1, 2);
            Assert.IsTrue(res.Success, "Failed fetching lists:" + res);
            Assert.IsTrue(oLists.Count > 0, "No lists returned on fetch");
            Console.WriteLine(oLists[0].VoiceName);
        }
コード例 #21
0
        /// <summary>
        /// Checks to see if two UnsuccessAddresses are equal.
        /// </summary>
        /// <param name="obj">The UnsuccessAddresses to check</param>
        /// <returns>true if obj and this are equal</returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (GetType() != obj.GetType())
            {
                return(false);
            }

            DestinationAddress da = (DestinationAddress)obj;

            if (!da.IsDistributionList)
            {
                // value member check
                return
                    (DestinationAddressTon.Equals(da.DestinationAddressTon) &&
                     DestinationAddressNpi.Equals(da.DestinationAddressNpi) &&
                     DestAddress.Equals(da.DestAddress));
            }
            else
            {
                return(DistributionList.Equals(da.DistributionList));
            }
        }
コード例 #22
0
        public int Add(DistributionList d)
        {
            var sql = @"INSERT INTO dbo.[DistributionList]
           (DistributionListGuid        ,
           Name                         ,
           Title                        ,
           IsPublic                     ,
           IsActive                     ,
           IsDeleted                    ,
           CreatedOn                    ,
           UpdatedOn                    ,
           CreatedBy                    ,
           UpdatedBy)
            VALUES
              (@DistributionListGuid     ,
               @Name                     ,
               @Title                    ,
               @IsPublic                 ,
               @IsActive                 ,
               @IsDeleted                ,
               @CreatedOn                ,
               @UpdatedOn                ,
               @CreatedBy                ,
               @UpdatedBy)";

            return(_context.Connection.Execute(sql, d));
        }
コード例 #23
0
        public void GetDistributionList_BlankAliasAndName_Failure()
        {
            DistributionList oList;
            var res = DistributionList.GetDistributionList(out oList, _mockServer);

            Assert.IsFalse(res.Success, "Blank alias/objectID params on GetDistributionList did not fail");
        }
コード例 #24
0
        public void GetDistributionList_EmptyObjectIdAndAlias_Failure()
        {
            DistributionList oList;
            var res = DistributionList.GetDistributionList(out oList, _mockServer);

            Assert.IsFalse(res.Success, "GetDistributionList failed to catch empty alias and ObjectId being passed");
        }
コード例 #25
0
        public void PrivateListTopLevelUpdate()
        {
            PrivateList oTestList;

            try
            {
                oTestList = new PrivateList(_connectionServer, _tempUser.ObjectId, "", 1);
                Console.WriteLine(oTestList);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to create new private list class instance with list Id of 1" + ex);
            }

            try
            {
                oTestList = new PrivateList(_connectionServer, _tempUser.ObjectId, _tempPrivateList.ObjectId);
                Console.WriteLine(oTestList);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to create new private list class instance with valid ObjectId" + ex);
            }

            WebCallResult res = _tempPrivateList.Update();

            Assert.IsFalse(res.Success, "Calling Update with no pending changes did not result in an error");

            Console.WriteLine(_tempPrivateList.ToString());
            Console.WriteLine(_tempPrivateList.DumpAllProps());

            res = _tempPrivateList.AddMemberUser(_tempUser.ObjectId);
            Assert.IsTrue(res.Success, "Failed to add user to private list:" + res);

            List <DistributionList> oPublicLists;

            res = DistributionList.GetDistributionLists(_connectionServer, out oPublicLists, 1, 20);
            Assert.IsTrue(res.Success, "Failed to fetch public lists:" + res);
            Assert.IsTrue(oPublicLists.Count > 0, "No public lists found");

            res = _tempPrivateList.AddMemberPublicList(oPublicLists[0].ObjectId);
            Assert.IsTrue(res.Success, "Failed to add public list as private list member:" + res);

            List <PrivateListMember> oMembers;

            res = _tempPrivateList.GetMembersList(out oMembers);
            Assert.IsTrue(res.Success, "Failed to fetch members of private list:" + res);
            Assert.IsTrue(oMembers.Count == 2, "Two members not returned from new private list");

            res = _tempPrivateList.RemoveMember(oMembers[0].ObjectId);
            Assert.IsTrue(res.Success, "Failed removing private list member:" + res);

            _tempPrivateList.DisplayName = "New display name";
            res = _tempPrivateList.Update();
            Assert.IsTrue(res.Success, "Failed updating private list:" + res);

            res = _tempPrivateList.RefetchPrivateListData();
            Assert.IsTrue(res.Success, "Failed to refetch private list data:" + res);
        }
コード例 #26
0
        public List <MimeMessage> GetNewMessagesFromMailbox(DistributionList distributionList)
        {
            var allMessages = new List <MimeMessage>();

            // TODO: Remove me

            return(allMessages);
        }
コード例 #27
0
        public int Edit(DistributionList d)
        {
            var sql = @"UPDATE DistributionList
                        SET Title = @Title, IsPublic =@IsPublic,UpdatedOn = @UpdatedOn, UpdatedBy = @UpdatedBy  
                         WHERE DistributionListGuid = @distributionListGuid";

            return(_context.Connection.Execute(sql, d));
        }
コード例 #28
0
        public void DistributionList_CreateWithInvalidExtension()
        {
            string           strAlias = Guid.NewGuid().ToString().Replace("-", "");
            DistributionList oList;
            var res = DistributionList.AddDistributionList(_connectionServer, strAlias, strAlias, strAlias, null, out oList);

            Assert.IsFalse(res.Success, "Creating list with invalid extension should fail:" + res);
        }
コード例 #29
0
        public void GetDistributionList_NullConnectionServer_Failure()
        {
            DistributionList oList;

            WebCallResult res = DistributionList.GetDistributionList(out oList, null, "", "allvoicemailusers");

            Assert.IsFalse(res.Success, "Null Connection server on GetDistributionList did not fail.");
        }
コード例 #30
0
 public DistributionList AddDistributionList(DistributionList DistributionList)
 {
     using (_context = ConnectionHelper.CreateConnection())
     {
         _context.DistributionLists.Add(DistributionList);
         _context.SaveChanges();
     }
     return(DistributionList);
 }
コード例 #31
0
        public AddEditDistributionListModel(int distributionListTypeId)
        {
            mDistributionList = new DistributionList();

            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

            mDistributionListLoaded = true;//need to set to true so event fires for inserts only.

            cmsWebServiceClient.GetDistributionListTypeCompleted += cmsWebServiceClient_GetDistributionListTypeCompleted;
            cmsWebServiceClient.GetDistributionListTypeAsync(distributionListTypeId);

            OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanExecuteOkButtonHandler);
            CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, CanExecuteOkButtonHandler);
        }
コード例 #32
0
        private void cmsWebServiceClient_GetDistributionListCompleted(object sender, GetDistributionListCompletedEventArgs e)
        {
            mDistributionList = e.Result;
            mDistributionListLoaded = true;

            CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);
            cmsWebServiceClient.GetDistributionListTypeCompleted += cmsWebServiceClient_GetDistributionListTypeCompleted;
            cmsWebServiceClient.GetDistributionListTypeAsync(mDistributionListTypeId);
        }