コード例 #1
0
 public void Move()
 {
     using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
     {
         IList <PersonalAutoAttendant> list = null;
         ipaastore.TryGetAutoAttendants(PAAValidationMode.StopOnFirstError, out list);
         Guid identity = new Guid(Convert.FromBase64String((string)base.GetParameter("Id")));
         int  num;
         PersonalAutoAttendant personalAutoAttendant = PersonalAutoAttendantOptionsEventHandler.FindAutoAttendantByGuid(list, identity, out num);
         if (personalAutoAttendant != null)
         {
             if (this.IsOrderChanged(list))
             {
                 base.RenderPartialFailure(-846213614, OwaEventHandlerErrorCode.UnexpectedError);
             }
             else
             {
                 int num2 = (int)base.GetParameter("op");
                 if ((num2 != 1 || num == 0) && (num2 != 2 || num >= list.Count - 1))
                 {
                     throw new OwaInvalidRequestException("Event name and parameter doesn't match");
                 }
                 list.RemoveAt(num);
                 if (num2 == 1)
                 {
                     list.Insert(num - 1, personalAutoAttendant);
                 }
                 else
                 {
                     list.Insert(num + 1, personalAutoAttendant);
                 }
                 ipaastore.Save(list);
                 ipaastore.TryGetAutoAttendants(PAAValidationMode.StopOnFirstError, out list);
             }
         }
         else
         {
             base.RenderPartialFailure(-289549140, OwaEventHandlerErrorCode.ItemNotFound);
         }
         this.RefreshList(list);
     }
 }
コード例 #2
0
 public void Enable()
 {
     using (IPAAStore ipaastore = PAAStore.Create(base.UserContext.ExchangePrincipal))
     {
         IList <PersonalAutoAttendant> list = null;
         ipaastore.TryGetAutoAttendants(PAAValidationMode.StopOnFirstError, out list);
         Guid identity = new Guid(Convert.FromBase64String((string)base.GetParameter("Id")));
         int  index;
         PersonalAutoAttendant personalAutoAttendant = PersonalAutoAttendantOptionsEventHandler.FindAutoAttendantByGuid(list, identity, out index);
         if (personalAutoAttendant != null)
         {
             int num = (int)base.GetParameter("op");
             if (num == 3)
             {
                 personalAutoAttendant.Enabled = true;
             }
             else
             {
                 if (num != 4)
                 {
                     throw new OwaInvalidRequestException("Event name and parameter doesn't match");
                 }
                 personalAutoAttendant.Enabled = false;
             }
             ipaastore.Save(list);
             ipaastore.TryGetAutoAttendants(PAAValidationMode.StopOnFirstError, out list);
             personalAutoAttendant = list[index];
             this.Writer.Write("<div id=\"ret\" enbl=");
             this.Writer.Write(personalAutoAttendant.Enabled ? 1 : 0);
             this.Writer.Write("></div>");
         }
         else
         {
             base.RenderPartialFailure(-289549140, OwaEventHandlerErrorCode.ItemNotFound);
             this.RefreshList(list);
         }
     }
 }