0

I have one datasheet like mentioned below

WorkWeek Person1 Person2 
WW1      X       Y
WW2      Z       A
WW3      X       Z

Where A,X,Y & Z are members of the sharepoint group. Required I want display a webpart like this

WW1
Image1       Image2
X            Y

Next Week the webpart should get updated like this dynamically.

WW2
Image3      Image4
Z           A

Where this requirement is possible, If possible then pls suggest how to accomplish this.

4

2 回答 2

0

这在 SharePoint 中称为每周更新 Webpart。

我的想法:

您可以将CurrentDateDateTime.Today 之类的一个值设置为 Current Web properties。还可以为 WorkWeek 用户设置另一个属性。现在检查

         SPWeb web = SPContext.Current.Web;
         if (string.isnullorEmpty(web.Properties["CurrentDate"]))
            {
                 web.Properties["CurrentDate"] = DateTime.Today.Tostring();
                 // do the stuff for displying data.
            }
        else 
          {
             if(IFChangeNeeded())
              {
                 // do the stuff for displying data.
              }
            else
              {
                 web.Properties["CurrentDate"] = DateTime.Today.Tostring();
                 // do the stuff for displying data.
        
            }
         }

IfChangeNeeded()是返回布尔值的函数。此功能检查员工本周需要更换。

      public bool IFChangeNeeded()
      {
           DateTime PropDate = Convert.ToDateTime(web.Properties["CurrentDate"]);
           DateTime TDate = DateTime.Today;
           
           if(WeekNo(TDate) == WeekNo(PropDate)) // WeekNo is function return weekno from current date.
             {
                return true;
             
             }
           else
             {
                 return false;
             }
      }
于 2012-12-27T06:13:14.080 回答
0

我可以为您提供一些可以帮助您完成此要求的逻辑。

根据您的要求,使用具有 html 的用户控件创建一个 Visual Web 部件,

要从数据表中获取数据,请使用代码从数据表中读取数据

当您要显示第一周的数据时,请创建一个变量并对其进行维护以识别从数据表中获取的周顺序。

第一次访问数据表时,请将此变量设置为一年中的第几周。

使用此变量(例如 IF 变量为空)来调节数据表的读取,然后将其分配为一年中的第几周。,

下次你遇到这个逻辑时检查这个变量,如果变量小于周没有当前周没有年份然后取数据表最后你得到 + 1 表示数据表 2 等等..

对不起英语不好

variable : one for DaasheetNo, WeekNo,CurrentWeekNo

assign datasheetNo = Sheet1

If(WeekNo== Null)
{
first time getdata from DaasheetNo (First Sheet)
}
else if(WeekNo < CurrentWeekNo)
{
Get data from datasheetNo +1
}

希望对你有帮助

于 2012-12-27T05:58:10.573 回答