/// <summary>
        ///user wants to update one of the top level items for a list - they may have edited the display name and/or extension.
        ///All the values will be sent over regardless of if they've changed - a more sophisticated "dirty flag" approach or the like is left as an exercize for the reader.
        /// </summary>
        private void buttonUpdateItem_Click(object sender, EventArgs e)
        {
            DisableFormControls();

            ConnectionPropertyList oPropList = new ConnectionPropertyList();

            string strObjectID = gridLists.SelectedRows[0].Cells["ObjectId"].Value.ToString();

            //the property names are case sensitive
            oPropList.Add("DisplayName", textListDisplayName.Text);

            //currently CUPI does not like you setting DtmfAccessId to blank - even though for lists this is legal, so for now screen this out
            if (textListExtension.Text.Length > 0)
            {
                oPropList.Add("DtmfAccessId", textListExtension.Text);
            }

            //do the call to update the items via CUPI
            WebCallResult res = DistributionList.UpdateDistributionList(GlobalItems.CurrentConnectionServer, strObjectID, oPropList);

            EnableFormControls();

            if (res.Success)
            {
                MessageBox.Show("List updated");
                Logger.Log(string.Format("List updated:{0}\r\n{1}", strObjectID, oPropList));
                gridLists.Refresh();
            }
            else
            {
                MessageBox.Show("List failed to update:" + res.ErrorText);
                Logger.Log(string.Format("List failed to update:{0}, error=[{1}]\r\n{2}", strObjectID, res.ErrorText, oPropList));

                //dump out all the results information send from the server
                Logger.Log(res.ToString());
            }
        }
Ejemplo n.º 2
0
        public void UpdateDistributionList_EmptyPropertyList_Failure()
        {
            var res = DistributionList.UpdateDistributionList(_mockServer, "aaa", null);

            Assert.IsFalse(res.Success, "UpdateDistributionList failed to catch empty property list");
        }
Ejemplo n.º 3
0
        public void UpdateDistributionList_NullConnectionServer_Failure()
        {
            WebCallResult res = DistributionList.UpdateDistributionList(null, "aaa", null);

            Assert.IsFalse(res.Success, "UpdateDistributionList failed to catch null ConnectionServerRest object");
        }