Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var url = SPContext.Current.Web.Url;

            changeShiftManagementDal = new ChangeShiftManagementDAL(url);
            var guidViews = changeShiftManagementDal.GetViewGuildID().Where(x => x.BaseViewID == BASE_VIEW_ID).FirstOrDefault();

            ChangeShiftByDepartmentWebPart.ViewGuid = guidViews.ID.ToString();
            CheckCurrentUser(url);

            bool     isAdminDepartment = UserPermission.IsAdminDepartment;
            XElement xmlViewDef        = XElement.Parse(ChangeShiftByDepartmentWebPart.XmlDefinition);
            string   selectedDepId     = this.Page.Request.Params.Get("AdminDeptId");
            XElement filterElement     = BuildViewString(isAdminDepartment, selectedDepId);

            XElement whereElement = xmlViewDef.Descendants("Where").FirstOrDefault();

            if (whereElement != null)
            {
                if (whereElement.HasElements)
                {
                    whereElement.RemoveNodes();
                }
                whereElement.Add(filterElement);
                ChangeShiftByDepartmentWebPart.XmlDefinition = xmlViewDef.ToString();
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GetCurrentUser();
            var url = SPContext.Current.Web.Url;

            changeShiftManagementDal = new ChangeShiftManagementDAL(url);
            var guidViews = changeShiftManagementDal.GetViewGuildID().Where(x => x.BaseViewID == baseViewID).FirstOrDefault();

            ChangeShiftRequestWebPart.ViewGuid = guidViews.ID.ToString();
        }
        private void InitialViewGUID(XElement filterElement)
        {
            var guidViews = _changeShiftManagementDAL.GetViewGuildID().Where(x => x.BaseViewID == baseViewID).FirstOrDefault();

            ChangeShiftApprovalWebPart.ViewGuid = guidViews.ID.ToString();

            XElement xmlViewDef   = XElement.Parse(ChangeShiftApprovalWebPart.XmlDefinition);
            XElement whereElement = xmlViewDef.Descendants("Where").FirstOrDefault();

            if (whereElement != null && filterElement != null)
            {
                if (whereElement.HasElements)
                {
                    whereElement.RemoveNodes();
                }
                whereElement.Add(filterElement);
                ChangeShiftApprovalWebPart.XmlDefinition = xmlViewDef.ToString();
            }
        }