2010年项目:通过c#更新日历工作周(时间) [英] project 2010: updating calendar work weeks (time) through c#

查看:196
本文介绍了2010年项目:通过c#更新日历工作周(时间)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助才能使用c#更新日历。我可以使用SvcCalendar服务添加例外日历,但是我无法找到更新完整日历工作周(每天的工作时间)而不是工作
时间的方法一个特定日子。例如,项目日历的默认工作时间为8到12天,然后是每周工作日的1到5天,但是我公司的工作时间是星期一,星期二,星期四,星期四,8到5 b $ b和周五,周五从8点到2点,周六从8点到1点。此外,我们每个项目都有不同的日历和不同的工作时间。这就是为什么我需要知道如何更新完整的
日历的工作时间。如果有可能,请通知我以及如何操作。

I need help in updating the calendar using c#. I am able to add exceptions to the calendar using the SvcCalendar service however I can't find a way to update the work weeks (work time for each day) of the complete calendar and not the work time of a single specific day. For example, the default working time of project's calendar is from 8 to 12 and then from 1 to 5 every week day however the working time in my company is from 8 till 5 on monday, tuesday, thursday, and friday while it is from 8 till 2 on wednesday and from 8 till 1 on saturday. Moreover, each project we have has a different calendar with different working times. Thats why I need to know how to update the working time of the complete calendar. Please inform me if this is possible and how to do it.

谢谢

George

推荐答案

嗨乔治,

你有什么理由想要使用这样做的代码?

Is there a reason you want to use code for doing this?

通常,您可以为组织定义一个或多个企业日历。将公司的默认日历分配给默认模板。

Normally you define one or more enterprise calendars for you organisation to use. Assign your companies default calendar to the default template.

您还可以为不同的项目类型创建不同的EPT,每个项目类型都有自己的模板和基础项目日历。

You can also create different EPT's for different project types that each can have there own template and base project calendar.

 

如果您想使用代码进行更改,可以通过加载项进行更改:

When you want to make the changes using code, you can do so through an add-in:

             activeProject.Calendar.WeekDays [MSProject.PjWeekday.pjMonday] .set_Working(真);

            activeProject.Calendar.WeekDays [MSProject.PjWeekday.pjMonday] .Shift1.Start =新日期时间(2011年,1,1,14,0,0);

    &NBSP ;       activeProject.Calendar.WeekDays [MSProject.PjWeekday.pjMonday] .Shift1.Finish =新日期时间(2011年,1,1,15,0,0);

    &NBSP ;       activeProject.Calendar.WeekDays [MSProject.PjWeekday.pjMonday] .Shift2.Clear();

            activeProject.Calendar.WeekDays [MSProject.PjWeekday.pjMonday] .Shift3.Clear();

            activeProject.Calendar.WeekDays [MSProject.PjWeekday.pjMonday] .Shift4.Clear();

            activeProject.Calendar.WeekDays [MSProject.PjWeekday.pjMonday] .Shift5.Clear();

            activeProject.Calendar.WeekDays[MSProject.PjWeekday.pjMonday].set_Working(true);
            activeProject.Calendar.WeekDays[MSProject.PjWeekday.pjMonday].Shift1.Start = new DateTime(2011, 1, 1, 14, 0, 0);
            activeProject.Calendar.WeekDays[MSProject.PjWeekday.pjMonday].Shift1.Finish = new DateTime(2011, 1, 1, 15, 0, 0);
            activeProject.Calendar.WeekDays[MSProject.PjWeekday.pjMonday].Shift2.Clear();
            activeProject.Calendar.WeekDays[MSProject.PjWeekday.pjMonday].Shift3.Clear();
            activeProject.Calendar.WeekDays[MSProject.PjWeekday.pjMonday].Shift4.Clear();
            activeProject.Calendar.WeekDays[MSProject.PjWeekday.pjMonday].Shift5.Clear();

问候,J


这篇关于2010年项目:通过c#更新日历工作周(时间)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆