Exemplo n.º 1
0
        private void InitialViewGUID()
        {
            var webUrl = SPContext.Current.Web.Url;

            leaveManagementDAL = new LeaveManagementDAL(webUrl);
            var guidViews = leaveManagementDAL.GetViewGuildID().Where(x => x.BaseViewID == baseViewID).FirstOrDefault();

            LeaveRequestForSecurityWebPart.ViewGuid = guidViews == null ? "" : guidViews.ID.ToString();

            string employeeID = this.Page.Request.Params.Get("employeeId");

            XElement filterElement = BuildViewString(webUrl, employeeID);

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

            if (whereElement != null)
            {
                if (whereElement.HasElements)
                {
                    whereElement.RemoveNodes();
                }
                whereElement.Add(filterElement);
                LeaveRequestForSecurityWebPart.XmlDefinition = xmlViewDef.ToString();
            }
        }
        private void InitialViewGUID()
        {
            var url = SPContext.Current.Web.Url;

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

            LeaveByDepartmentWebPart.ViewGuid = guidViews == null ? "" : guidViews.ID.ToString();

            UserHelper   userHelper          = new UserHelper();
            EmployeeInfo currentEmployeeInfo = userHelper.GetCurrentLoginUser();

            string   selectedDepId = this.Page.Request.Params.Get("AdminDeptId");
            XElement filterElement = BuildViewString(currentEmployeeInfo, selectedDepId);

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

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

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

            LeaveRequestWebPart.ViewGuid = guidViews.ID.ToString();
        }
Exemplo n.º 4
0
        private void InitialViewGUID()
        {
            var siteUrl = SPContext.Current.Web.Url;

            leaveManagementDAL = new LeaveManagementDAL(siteUrl);
            var guidViews = leaveManagementDAL.GetViewGuildID().Where(x => x.BaseViewID == baseViewID).FirstOrDefault();

            LeaveApprovalWebPart.ViewGuid = guidViews == null ? "" : guidViews.ID.ToString();

            XElement xmlViewDef    = XElement.Parse(LeaveApprovalWebPart.XmlDefinition);
            XElement filterElement = BuildViewString(SPContext.Current.Web.CurrentUser.ID, siteUrl);

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

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