示例#1
0
        /// <summary>
        /// Mock.
        /// </summary>
        /// <param name="id">Mock.</param>
        /// <param name="zone">Mock.</param>
        /// <param name="userName">Mock.</param>
        /// <param name="userId">Mock.</param>
        /// <returns>Mock.</returns>
        public HermesGenericNote GetGenericNote(string id, TimeZone zone, string userName, string userId)
        {
            HermesGenericNote note = new HermesGenericNote();

            note.Id = id;
            return(note);
        }
示例#2
0
        /// <summary>
        /// Create the HermesScheduleItem for the test
        /// </summary>
        /// <returns>the instance of the HermesScheduleItem</returns>
        private HermesScheduleItem CreateScheduleItem()
        {
            HermesScheduleItem hsi = new HermesScheduleItem();

            hsi.Id               = Guid.NewGuid().ToString("N");
            hsi.Activity         = activity;
            hsi.Duration         = new decimal(456.6);
            hsi.ExceptionFlag    = 'N';
            hsi.ExpirationDate   = new DateTime(2005, 5, 23);
            hsi.LastModifiedBy   = "abc";
            hsi.LastModifiedDate = new DateTime(2003, 12, 1);

            HermesGenericNote note = new HermesGenericNote();

            note.Id  = Guid.NewGuid().ToString("n");
            hsi.Note = note;
            hsi.ScheduleItemRequestStatus = requestStatus;
            hsi.ScheduleItemStatus        = itemStatus;
            hsi.Version       = 2;
            hsi.WorkDate      = new DateTime(2004, 4, 12);
            hsi.WorkDayAmount = new Decimal(867.23);
            return(hsi);
        }
示例#3
0
文件: Demo.cs 项目: kurtrips/tc
        public void Demo()
        {
            HermesScheduleItemPersistenceProvider hsipp = new HermesScheduleItemPersistenceProvider();

            ///////////////////INSERT UPDATE GET DELETE/////////////////////////////
            // Create an activity group
            HermesActivityGroup hag = new HermesActivityGroup();

            hag.Id               = new Guid("1234567890ABCDEF1234567890ABCDEF").ToString();
            hag.Abbreviation     = "HAG1";
            hag.Name             = "HermesActivityGroup1";
            hag.LastModifiedBy   = "hagUser";
            hag.LastModifiedDate = new DateTime(2007, 7, 7);
            //Save it into database
            hsipp.SaveActivityGroup(hag);
            //Get it from database
            HermesActivityGroup getFromDb = hsipp.GetActivityGroup("1234567890ABCDEF1234567890ABCDEF");

            //Delete it from database
            hsipp.DeleteActivityGroup("1234567890ABCDEF1234567890ABCDEF");

            //Create an activity type
            HermesActivityType hat = new HermesActivityType();

            hat.Id               = new Guid("34563456345634563456345634563456").ToString();
            hat.Abbreviation     = "HAT1";
            hat.Name             = "HermesActivityType1";
            hat.LastModifiedBy   = "hatUser";
            hat.LastModifiedDate = new DateTime(2007, 11, 7);
            hat.ActivityGroup    = hsipp.GetActivityGroup("11111111111111111111111111111111");
            //Save it into database
            hsipp.SaveActivityType(hat);
            //Get it from database
            HermesActivityType getFromDb2 = hsipp.GetActivityType("34563456345634563456345634563456");

            //Delete it from database
            hsipp.DeleteActivityType("34563456345634563456345634563456");

            //Create an activity
            HermesActivity activity = new HermesActivity();

            activity.Id                = new Guid("99887766998877669988776699887766").ToString();
            activity.Abbreviation      = "ACT";
            activity.ActivityType      = hsipp.GetActivityType("22222222222222222222222222222222");
            activity.DefaultDuration   = new decimal(33.45);
            activity.DefaultExpireDays = 666;
            activity.DefaultStartTime  = 432;
            activity.Enabled           = true;
            activity.ExclusiveFlag     = true;
            activity.LastModifiedBy    = "ACTuser";
            activity.LastModifiedDate  = new DateTime(2007, 8, 8);
            activity.Name              = "CoolAndReallyNiceActivity";
            activity.WorkDayAmount     = 9966;
            //Save it into database
            hsipp.SaveActivity(activity);
            //Get it from database
            HermesActivity getFromDb3 = hsipp.GetActivity("99887766998877669988776699887766");

            //Delete it from database
            hsipp.DeleteActivity("99887766998877669988776699887766");

            //Create a ScheduleItem and save
            HermesScheduleItem hsiParent = new HermesScheduleItem();

            hsiParent.Id               = new Guid("19081908190819081908190819081908").ToString();
            hsiParent.Activity         = hsipp.GetActivity("33333333333333333333333333333333");
            hsiParent.Duration         = new decimal(546.89);
            hsiParent.ExceptionFlag    = 'Y';
            hsiParent.ExpirationDate   = new DateTime(2005, 12, 23);
            hsiParent.LastModifiedBy   = "ivern";
            hsiParent.LastModifiedDate = new DateTime(2007, 12, 1);
            HermesGenericNote note = new HermesGenericNote();

            note.Id        = new Guid("12340987123409871234098712340987").ToString();
            hsiParent.Note = note;
            hsiParent.ScheduleItemRequestStatus = hsipp.GetScheduleItemRequestStatus("55555555555555555555555555555555");
            hsiParent.ScheduleItemStatus        = hsipp.GetScheduleItemStatus("44444444444444444444444444444444");
            hsiParent.Version       = 1;
            hsiParent.WorkDate      = new DateTime(2004, 12, 12);
            hsiParent.WorkDayAmount = new Decimal(86787.23);
            hsipp.SaveScheduleItem(hsiParent);

            //Create another ScheduleItem and save
            HermesScheduleItem hsiEdit = new HermesScheduleItem();

            hsiEdit.Id               = new Guid("23451987234519872345198723451987").ToString();
            hsiEdit.Activity         = hsipp.GetActivity("33333333333333333333333333333333");
            hsiEdit.Duration         = new decimal(546.89);
            hsiEdit.ExceptionFlag    = 'Y';
            hsiEdit.ExpirationDate   = new DateTime(2005, 12, 23);
            hsiEdit.LastModifiedBy   = "ivern";
            hsiEdit.LastModifiedDate = new DateTime(2007, 12, 1);
            HermesGenericNote note2 = new HermesGenericNote();

            note2.Id     = new Guid("12340987123409871234098712340987").ToString();
            hsiEdit.Note = note2;
            hsiEdit.ScheduleItemRequestStatus = hsipp.GetScheduleItemRequestStatus("55555555555555555555555555555555");
            hsiEdit.ScheduleItemStatus        = hsipp.GetScheduleItemStatus("44444444444444444444444444444444");
            hsiEdit.Version       = 1;
            hsiEdit.WorkDate      = new DateTime(2004, 12, 12);
            hsiEdit.WorkDayAmount = new Decimal(86787.23);
            hsipp.SaveScheduleItem(hsiEdit);

            //....and so on for other properties



            /////////////////GET ALL ENTITIES//////////
            IList <HermesScheduleItemRequestStatus> reqStats = hsipp.GetAllScheduleItemRequestStatuses();
            IList <HermesScheduleItemStatus>        statuses = hsipp.GetAllScheduleItemStatuses();
            IList <HermesActivity> items = hsipp.GetAllActivities(false);

            //....and so on for other properties



            //////////////MANAGE SCHEDULE ITEMS RELATIONS////////////////
            hsipp.CreateScheduleItemPublishEditCopyRelationship(hsiParent, hsiEdit);
            hsipp.GetScheduleItemEditCopy(hsiParent);
            hsipp.GetScheduleItemParentCopy(hsiEdit);
            hsipp.DeleteScheduleItemPublishEditCopyRelationship(hsiEdit);
        }
示例#4
0
文件: Demo.cs 项目: kurtrips/tc
        public void Demo1()
        {
            //Get existing HermesActivity
            HermesActivity refHermesActivity =
                client.GetActivity(new Guid("33333333333333333333333333333333").ToString());

            //Create 2 new schedule items
            HermesScheduleItem schedItem1 = client.CreateScheduleItem(DateTime.Today, refHermesActivity);
            HermesScheduleItem schedItem2 = client.CreateScheduleItem(DateTime.Today, refHermesActivity);

            //Make some changes to the above 2
            schedItem1.Duration       = new decimal(34.67);
            schedItem1.ExceptionFlag  = 'Y';
            schedItem1.ExpirationDate = DateTime.Today.AddDays(24);
            HermesGenericNote note = new HermesGenericNote();

            note.Description = "NewNoteDesc";
            schedItem1.Note  = note;
            schedItem1.ScheduleItemRequestStatus =
                client.GetScheduleItemRequestStatus(new Guid("55555555555555555555555555555555").ToString());
            schedItem1.ScheduleItemStatus =
                client.GetScheduleItemStatus(new Guid("44444444444444444444444444444444").ToString());
            schedItem1.Version       = 2;
            schedItem1.WorkDate      = DateTime.Today.AddDays(1);
            schedItem1.WorkDayAmount = new decimal(10.45);

            schedItem2.Duration       = new decimal(34.67);
            schedItem2.ExceptionFlag  = 'Y';
            schedItem2.ExpirationDate = DateTime.Today.AddDays(24);
            note             = new HermesGenericNote();
            note.Description = "NewNoteDesc";
            schedItem2.Note  = note;
            schedItem2.ScheduleItemRequestStatus =
                client.GetScheduleItemRequestStatus(new Guid("55555555555555555555555555555555").ToString());
            schedItem2.ScheduleItemStatus =
                client.GetScheduleItemStatus(new Guid("44444444444444444444444444444444").ToString());
            schedItem2.Version       = 2;
            schedItem2.WorkDate      = DateTime.Today.AddDays(1);
            schedItem2.WorkDayAmount = new decimal(10.45);

            //We can save them individually
            client.SaveScheduleItem(schedItem1);
            client.SaveScheduleItem(schedItem2);

            //Or we can save them in one go
            List <HermesScheduleItem> schedItems = new List <HermesScheduleItem>();

            schedItems.Add(schedItem1);
            schedItems.Add(schedItem2);
            client.SaveScheduleItems(schedItems);

            //Get the schedule items
            schedItem1 = client.GetScheduleItem(schedItem1.Id);
            schedItem2 = client.GetScheduleItem(schedItem2.Id);

            //Although getting many schedule items in one go is not supported but it is supported for other types
            //Get all activities
            IList <HermesActivity> activities1 = client.GetAllActivities(true);
            //Get all activities which are enabled
            IList <HermesActivity> activities2 = client.GetAllActivities(false);
            //Get all activity groups
            IList <HermesActivityGroup> activityGroups = client.GetAllActivityGroups();

            //Delete them in one go
            List <string> ids = new List <string>();

            ids.Add(schedItem1.Id);
            ids.Add(schedItem2.Id);
            client.DeleteScheduleItems(ids);

            //Delete a single schedule item
            client.DeleteScheduleItem(new Guid("66666666666666666666666666666666").ToString());
        }
示例#5
0
 /// <summary>
 /// Mock.
 /// </summary>
 /// <param name="note">Mock.</param>
 /// <param name="userName">Mock.</param>
 /// <param name="userId">Mock.</param>
 /// <returns>Mock.</returns>
 public HermesGenericNote AddGenericNote(HermesGenericNote note, string userName, string userId)
 {
     return(note);
 }
示例#6
0
 /// <summary>
 /// Mock.
 /// </summary>
 /// <param name="note">Mock.</param>
 /// <param name="s">Mock.</param>
 /// <param name="name">Mock.</param>
 public void DeleteGenericNote(HermesGenericNote note, string s, string name)
 {
 }
示例#7
0
 /// <summary>
 /// svcutil generated code
 /// </summary>
 /// <param name="note">svcutil generated code</param>
 /// <param name="userName">svcutil generated code</param>
 /// <param name="userId">svcutil generated code</param>
 public void DeleteGenericNote(HermesGenericNote note, string userName, string userId)
 {
     base.Channel.DeleteGenericNote(note, userName, userId);
 }
示例#8
0
 /// <summary>
 /// svcutil generated code
 /// </summary>
 /// <param name="note">svcutil generated code</param>
 /// <param name="userName">svcutil generated code</param>
 /// <param name="userId">svcutil generated code</param>
 /// <returns>svcutil generated code</returns>
 public HermesGenericNote UpdateGenericNote(HermesGenericNote note, string userName, string userId)
 {
     return(base.Channel.UpdateGenericNote(note, userName, userId));
 }