示例#1
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (IsPostBack && Request["__EVENTTARGET"] == DTCWeek.UniqueID)
            {
                if (ownerId > 0)
                {
                    if (blockInstanceId < 0)
                    {
                        BindBlockTypeInstancesByUser(ownerId);
                    }
                }
                else if (blockInstanceId > 0)
                {
                    BindUsersByBlockTypeInstance(blockInstanceId);
                }

                BindGrid();
            }

            if (BlockInstanceList.Items.Count == 0)
            {
                NoItemsLabel.Visible      = true;
                BlockInstanceList.Visible = false;
            }
            else
            {
                NoItemsLabel.Visible      = false;
                BlockInstanceList.Visible = true;
            }
            lblWeek.Text = String.Format("{1} - {2} (#{0})",
                                         Iso8601WeekNumber.GetWeekNumber(startDate),
                                         CHelper.GetWeekStartByDate(startDate).ToString("d MMM yyyy"),
                                         CHelper.GetWeekEndByDate(startDate).ToString("d MMM yyyy"));
        }
示例#2
0
        public override void DataBind()
        {
            if (index < 0)
            {
                index = PortalConfig.PortalFirstDayOfWeek;
            }

            dgTimesheet.Columns[0].HeaderText = LocRM.GetString("Title");
            dgTimesheet.Columns[1].HeaderText = LocRM2.GetString("taskTime");
            dgTimesheet.Columns[2].HeaderText = LocRM2.GetString("Posted");
            dgTimesheet.Columns[3].HeaderText = LocRM2.GetString("InAWeek");
            dgTimesheet.Columns[4].HeaderText = LocRM.GetString("tTotalAppr");
            dgTimesheet.Columns[5].HeaderText = LocRM.GetString("tRate");
            dgTimesheet.Columns[6].HeaderText = LocRM.GetString("tCost");

            if (block != null)
            {
                if (block.ProjectId.HasValue)
                {
                    lblProject.Text = Mediachase.UI.Web.Util.CommonHelper.GetObjectTitle((int)Mediachase.IBN.Business.ObjectTypes.Project, block.ProjectId.Value);
                }
                else
                {
                    lblProject.Text = block.Title;
                }
                lblUser.Text = Mediachase.UI.Web.Util.CommonHelper.GetUserStatusPureName(block.OwnerId);

                DateTimeFormatInfo dtf = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat;
                if (index < 0)
                {
                    index = PortalConfig.PortalFirstDayOfWeek;
                }
                int WeekNumber = dtf.Calendar.GetWeekOfYear(block.StartDate, CalendarWeekRule.FirstDay, (System.DayOfWeek)(index));
                lblWeek.Text = WeekNumber.ToString() + " [ " + block.StartDate.ToShortDateString() + " - " + CHelper.GetWeekEndByDate(block.StartDate).ToShortDateString() + " ]";
            }

            BindButtons();
            BindDG();
        }