当前位置: 首页>>代码示例>>C#>>正文


C# Resource.GetCurrentUserUid方法代码示例

本文整理汇总了C#中Resource.GetCurrentUserUid方法的典型用法代码示例。如果您正苦于以下问题:C# Resource.GetCurrentUserUid方法的具体用法?C# Resource.GetCurrentUserUid怎么用?C# Resource.GetCurrentUserUid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Resource的用法示例。


在下文中一共展示了Resource.GetCurrentUserUid方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     // Browser detection and redirecting to error page
     if (Request.Browser.Browser.ToLower() == "ie" && Convert.ToDouble(Request.Browser.Version) < 7)
     {
         SPUtility.TransferToErrorPage("To view this report use later versions of IE 6.0");
     }
     else
     {
         try
         {
             string siteurl = MyUtilities.ProjectServerInstanceURL(SPContext.Current);
             var Resource_Svc = new Resource()
                                    {
                                        AllowAutoRedirect = true,
                                        Url = siteurl + "/_vti_bin/psi/resource.asmx",
                                        UseDefaultCredentials = true
                                    };
             var result = MyUtilities.GetGovernanceReport(siteurl, Resource_Svc.GetCurrentUserUid());
             //Repeater1.DataSource = result;
             //Repeater1.DataBind();
             JSONData.Text = result.Rows.Count > 0 ? MyUtilities.Serialize(result) : "";
         }
         catch (Exception ex)
         {
             MyUtilities.ErrorLog(ex.Message, EventLogEntryType.Error);
         }
     }
 }
开发者ID:Santhoshonet,项目名称:ProjectGovernanceReport,代码行数:29,代码来源:ITXPGReportV2.aspx.cs

示例2: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     string siteurl = MyConfiguration.GetSiteURL(SPContext.Current);
     var Resource_Svc = new Resource();
     Resource_Svc.AllowAutoRedirect = true;
     Resource_Svc.UseDefaultCredentials = true;
     Resource_Svc.Url = siteurl + "/_vti_bin/psi/resource.asmx";
     LblCurrentResUID.Text = Resource_Svc.GetCurrentUserUid().ToString();
     //LblCurrentResUID.Text = "6FF0A657-63BC-4390-8AAF-7EE5CE033088";
 }
开发者ID:Vengadeswaran,项目名称:TimeSheet-Project,代码行数:10,代码来源:ApprovalPending.ascx.cs

示例3: Approve_Click

        protected void Approve_Click(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                string siteurl = MyConfiguration.GetSiteURL(SPContext.Current);

                var Resource_Svc = new Resource();
                Resource_Svc.AllowAutoRedirect = true;
                Resource_Svc.UseDefaultCredentials = true;
                Resource_Svc.Url = siteurl + "/_vti_bin/psi/resource.asmx";

                var Timesheet_Svc = new TimeSheet();
                Timesheet_Svc.AllowAutoRedirect = true;
                Timesheet_Svc.UseDefaultCredentials = true;
                Timesheet_Svc.Url = siteurl + "/_vti_bin/psi/timesheet.asmx";

                string[] selectedtsuids = Request.Form["LstSelectedtsuids"].Split('#');
                if (selectedtsuids.Length > 0)
                {
                    var grouped_tsuids = (from c in selectedtsuids
                                          group c by c).ToList();
                    foreach (IGrouping<string, string> tsuid_str in grouped_tsuids)
                    {
                        if (tsuid_str.Key != string.Empty)
                        {
                            try
                            {
                                var tsuid = new Guid(tsuid_str.Key);
                                var jobUID = Guid.NewGuid();
                                var nextapprover = Resource_Svc.GetCurrentUserUid();
                                Timesheet_Svc.QueueReviewTimesheet(jobUID, tsuid, nextapprover,
                                                                   "Approving using utility",
                                                                   ITXProjectsLibrary.WebSvcTimeSheet.Action.Approve);
                            }
                            catch (Exception ex)
                            {
                                MyConfiguration.ErrorLog("Error at approving timesheet due to " + ex.Message,
                                                         EventLogEntryType.Error);
                            }
                        }
                    }
                }
                LblStatus.Text = "Timesheet approval process completed successfully.";
            }
        }
开发者ID:Vengadeswaran,项目名称:TimeSheet-Project,代码行数:45,代码来源:ApprovalPending.ascx.cs

示例4: GetDataTable

        public static s_GridResult GetDataTable(string nd, int rows, int page, string sidx, string sord)
        {
            try
            {
                string _stdate = HttpContext.Current.Request.QueryString["_stdate"].ToString();
                string _enddate = HttpContext.Current.Request.QueryString["_enddate"].ToString();
                DateTime _enddateformatted = Convert.ToDateTime(_enddate);
                string siteurl = HttpContext.Current.Request.UrlReferrer.ToString();
                var url = new Uri(siteurl);
                string rbsurl = url.Scheme + "://" + url.Host + ":" + url.Port + url.Segments[0] + url.Segments[1];
                int startindex = (page - 1);
                int endindex = page;
                Guid adminguid;
                var resource_svc = new Resource();
                adminguid = new Guid("6FF0A657-63BC-4390-8AAF-7EE5CE033088");
                resource_svc.Url = "http://jump/cimb/_vti_bin/psi/resource.asmx";

                if (url.Host.ToString() != "localhost")
                {
                    //var rbs = new ReadRBSValues(System.Net.CredentialCache.DefaultNetworkCredentials, "http://jump/cimb");
                    resource_svc.Url = rbsurl + "/_vti_bin/psi/resource.asmx";
                }
                //var rbs = new ReadRBSValues(System.Net.CredentialCache.DefaultNetworkCredentials, rbsurl);
                //var resuids = rbs.GetBottomLevelResouceUIDs();
                resource_svc.UseDefaultCredentials = true;
                resource_svc.AllowAutoRedirect = true;
                Guid currentuserid = resource_svc.GetCurrentUserUid();
                string res_under_curr_user = @"
                        SELECT		ResourceUID
                        FROM		dbo.MSP_EpmResource_UserView
                        WHERE		(RBS Like (	(
                                                SELECT	RBS
                                                FROM	dbo.MSP_EpmResource_UserView
                                                WHERE	ResourceUID = '" + currentuserid.ToString() + @"'
                                                )
                                            +'.%')
                                    ) AND ResourceIsActive = 1
                        ";
                WindowsImpersonationContext wik = null;
                wik = WindowsIdentity.Impersonate(IntPtr.Zero);
                SqlConnection con = new SqlConnection(MyConfiguration.GetDataBaseConnectionString(siteurl));
                con.Open();
                DataSet filterresourcelist = new DataSet();
                SqlDataAdapter filterresourceadapter = new SqlDataAdapter(res_under_curr_user, con);
                filterresourceadapter.Fill(filterresourcelist);
                string filterresource = "(";
                foreach (DataRow row in filterresourcelist.Tables[0].Rows)
                {
                    filterresource += "'" + row[0].ToString() + "',";
                }
                /*                foreach (var resuid in resuids)
                                {
                                    filterresource += "'" + resuid.ToString() + "',";
                                }
                */
                filterresource = filterresource.Substring(0, filterresource.Length - 1) + ")";
                MyConfiguration.ErrorLog("RBS Resource List : " + filterresource, EventLogEntryType.Information);
                string gridqry = @"
            SELECT		res.ResourceUID, res.ResourceName, res.RBS, tperiod.PeriodUID, tperiod.PeriodStatusID, tperiod.StartDate, tperiod.EndDate, tperiod.PeriodName,
                    tperiod.LCID, ISNULL(TM_Name.ResourceName, 'Not Assigned') AS TM_Name
            INTO        [#t1]
            FROM        MSP_EpmResource_UserView AS TM_Name RIGHT OUTER JOIN
                    MSP_EpmResource_UserView AS res ON TM_Name.ResourceUID = res.ResourceTimesheetManagerUID CROSS JOIN
                    MSP_TimesheetPeriod AS tperiod
            WHERE		(tperiod.StartDate BETWEEN (
                    (SELECT		CASE WHEN (TimeDayOfTheWeek = 2) THEN '" + _stdate + @"' WHEN (TimeDayOfTheWeek = 1) THEN DATEADD(d,1, '" + _stdate + @"' )
                                ELSE DATEADD(d,(2-TimeDayofTheWeek), '" + _stdate + @"' ) END AS stdate
                    FROM        MSP_TimeByDay
                    WHERE		(TimeByDay = CONVERT(DATETIME, '" + _stdate + @"' , 102)))
                    )
                    AND '" + _enddate + @"' ) AND (res.ResourceUID IN " + filterresource + @")
            SELECT      [#t1].PeriodUID, [#t1].ResourceUID,[#t1].TM_Name, [#t1].RBS, [#t1].ResourceName, [#t1].PeriodName,
                    ISNULl(tstatus.Description,'Not Created') AS [TimeSheet Status], [#t1].StartDate, [#t1].EndDate
            INTO #t2
            FROM        MSP_TimesheetStatus AS tstatus INNER JOIN
                    MSP_Timesheet AS tsheet ON tstatus.TimesheetStatusID = tsheet.TimesheetStatusID INNER JOIN
                    MSP_TimesheetResource AS tres ON tsheet.OwnerResourceNameUID = tres.ResourceNameUID RIGHT OUTER JOIN
                    [#t1] ON [#t1].ResourceUID = tres.ResourceUID AND [#t1].PeriodUID = tsheet.PeriodUID
            drop table	#t1
            /*SELECT		PeriodName, TM_Name, ResourceName, COUNT(CASE WHEN ([TimeSheet Status] = 'In Progress') THEN [TimeSheet Status] END)
                    AS [In Progress], COUNT(CASE WHEN ([TimeSheet Status] = 'Not Created') THEN [TimeSheet Status] END) AS [Not Created],
                    COUNT(CASE WHEN ([TimeSheet Status] = 'Submitted') THEN [TimeSheet Status] END) AS Submitted
            FROM        [#t2]
            WHERE		([TimeSheet Status] <> 'Approved')
            GROUP BY	PeriodName, TM_Name, ResourceName
            ORDER BY	PeriodName, TM_Name, ResourceName
            */
            SELECT		PeriodName, COUNT(CASE WHEN ([TimeSheet Status] = 'In Progress') THEN [TimeSheet Status] END)
                    AS [In Progress], COUNT(CASE WHEN ([TimeSheet Status] = 'Not Created') THEN [TimeSheet Status] END) AS [Not Created],
                    COUNT(CASE WHEN ([TimeSheet Status] = 'Submitted') THEN [TimeSheet Status] END) AS Submitted,
                    COUNT(CASE WHEN ([TimeSheet Status] = 'Approved') THEN [TimeSheet Status] END) AS Approved
            FROM        [#t2]
            --WHERE		([TimeSheet Status] <> 'Approved')
            GROUP BY	PeriodName
            ORDER BY	PeriodName
            drop table	#t2
            ";
                s_GridResult result = new s_GridResult();
                try
                {
//.........这里部分代码省略.........
开发者ID:Vengadeswaran,项目名称:TimeSheet-Project,代码行数:101,代码来源:TimeSheetComplainceData.aspx.cs

示例5: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            // Browser detection and redirecting to error page
            if (Request.Browser.Browser.ToLower() == "ie" && Convert.ToDouble(Request.Browser.Version) < 7)
            {
                SPUtility.TransferToErrorPage("To view this report use later versions of IE 6.0");
            }
            else
            {
                try
                {
                    string SiteUrl = MyUtilities.ProjectServerInstanceURL(SPContext.Current);

                    var Resource_Svc = new Resource();
                    var Project_Svc = new Project();

                    Resource_Svc.UseDefaultCredentials = true;
                    Project_Svc.UseDefaultCredentials = true;

                    Resource_Svc.Url = SiteUrl + "/_vti_bin/psi/resource.asmx";
                    Project_Svc.Url = SiteUrl + "/_vti_bin/psi/project.asmx";

                    Resource_Svc.AllowAutoRedirect = true;
                    Project_Svc.AllowAutoRedirect = true;

                    if (MyUtilities.IndividualPages)
                        LnkConfigButton.PostBackUrl = SiteUrl + "/_layouts/ITXProjectGovernanceReport/ITXPGReport.aspx";
                    else
                        LnkConfigButton.Visible = false;

                    // setting current user uid
                    LblCurUserUId.Text = Resource_Svc.GetCurrentUserUid().ToString();

                    // For Group Repeater control

                    var GroupTable = new DataTable();
                    GroupTable.Columns.Add("title");
                    GroupTable.Columns.Add("grpid");

                    // impersonation here
                    try
                    {
                        var wik = WindowsIdentity.Impersonate(IntPtr.Zero);
                    }
                    catch (Exception)
                    {
                    }

                    MyUtilities.ModifyConnectionString(SiteUrl);

                    using (IObjectScope scope = ObjectScopeProvider1.GetNewObjectScope())
                    {
                        // creating the user account into db if not exists
                        List<Users> userses = (from c in scope.GetOqlQuery<Users>().ExecuteEnumerable()
                                               where c.ResourceUID.Equals(LblCurUserUId.Text)
                                               select c).ToList();
                        if (userses.Count == 0)
                        {
                            scope.Transaction.Begin();
                            var new_user = new Users();
                            new_user.ResourceUID = LblCurUserUId.Text;
                            scope.Add(new_user);
                            scope.Transaction.Commit();

                            userses = (from c in scope.GetOqlQuery<Users>().ExecuteEnumerable()
                                       where c.ResourceUID.Equals(LblCurUserUId.Text)
                                       select c).ToList();
                        }

                        List<Groups> groups = (from c in scope.GetOqlQuery<Users>().ExecuteEnumerable()
                                               from d in c.groups
                                               where
                                                   c.ResourceUID.Equals(LblCurUserUId.Text) &&
                                                   !d.UID.Equals(Guid.Empty.ToString())
                                               select d).ToList();
                        foreach (var group in groups)
                        {
                            var new_row = GroupTable.NewRow();
                            new_row["title"] = group.name;
                            new_row["grpid"] = group.UID;
                            GroupTable.Rows.Add(new_row);
                        }

                        RptrGroupnames.DataSource = GroupTable;
                        RptrGroupnames.DataBind();

                        // For Project name Repeater Control
                        var ProjectTable = MyUtilities.GetProjects_DataTable(SiteUrl, new Guid(LblCurUserUId.Text));

                        groups = (from c in scope.GetOqlQuery<Users>().ExecuteEnumerable()
                                  from d in c.groups
                                  where c.ResourceUID.Equals(LblCurUserUId.Text) && d.UID.Equals(Guid.Empty.ToString())
                                  select d).ToList();

                        if (groups.Count == 0)
                        {
                            if (userses.Count > 0)
                            {
                                scope.Transaction.Begin();
                                var new_group = new Groups();
//.........这里部分代码省略.........
开发者ID:Santhoshonet,项目名称:ProjectGovernanceReport,代码行数:101,代码来源:ProjectGroupConfigure.ascx.cs

示例6: exportcsv_Click

        protected void exportcsv_Click(object sender, EventArgs e)
        {
            string _stdate = _hiddenstdate.Value.ToString();
            string _enddate = _hiddenenddate.Value.ToString();
            DateTime _enddateformatted = Convert.ToDateTime(_enddate);
            string siteurl = HttpContext.Current.Request.UrlReferrer.ToString();
            var url = new Uri(siteurl);
            string rbsurl = url.Scheme + "://" + url.Host + ":" + url.Port + url.Segments[0] + url.Segments[1];
            Guid adminguid;
            var resource_svc = new Resource();
            adminguid = new Guid("6FF0A657-63BC-4390-8AAF-7EE5CE033088");
            resource_svc.Url = "http://jump/cimb/_vti_bin/psi/resource.asmx";

            if (url.Host.ToString() != "localhost")
            {
                //var rbs = new ReadRBSValues(System.Net.CredentialCache.DefaultNetworkCredentials, "http://jump/cimb");
                resource_svc.Url = rbsurl + "/_vti_bin/psi/resource.asmx";
            }
            //var rbs = new ReadRBSValues(System.Net.CredentialCache.DefaultNetworkCredentials, rbsurl);
            //var resuids = rbs.GetBottomLevelResouceUIDs();
            resource_svc.UseDefaultCredentials = true;
            resource_svc.AllowAutoRedirect = true;
            Guid currentuserid = resource_svc.GetCurrentUserUid();
            string res_under_curr_user = @"
                SELECT		ResourceUID
                FROM		dbo.MSP_EpmResource_UserView
                WHERE		(RBS Like (	(
                                        SELECT	RBS
                                        FROM	dbo.MSP_EpmResource_UserView
                                        WHERE	ResourceUID = '" + currentuserid.ToString() + @"'
                                        )
                                    +'.%')
                            ) AND ResourceIsActive = 1
                ";
            WindowsImpersonationContext wik = null;
            wik = WindowsIdentity.Impersonate(IntPtr.Zero);
            SqlConnection con = new SqlConnection(MyConfiguration.GetDataBaseConnectionString(siteurl));
            con.Open();
            DataSet filterresourcelist = new DataSet();
            SqlDataAdapter filterresourceadapter = new SqlDataAdapter(res_under_curr_user, con);
            filterresourceadapter.Fill(filterresourcelist);
            string filterresource = "(";
            foreach (DataRow row in filterresourcelist.Tables[0].Rows)
            {
                filterresource += "'" + row[0].ToString() + "',";
            }
            /*                foreach (var resuid in resuids)
                            {
                                filterresource += "'" + resuid.ToString() + "',";
                            }
            */
            filterresource = filterresource.Substring(0, filterresource.Length - 1) + ")";
            string gridqry = @"
            SELECT		res.ResourceUID, res.ResourceName, res.RBS, tperiod.PeriodUID, tperiod.PeriodStatusID, tperiod.StartDate, tperiod.EndDate, tperiod.PeriodName,
            tperiod.LCID, ISNULL(TM_Name.ResourceName, 'Not Assigned') AS TM_Name
            INTO        [#t1]
            FROM        MSP_EpmResource_UserView AS TM_Name RIGHT OUTER JOIN
            MSP_EpmResource_UserView AS res ON TM_Name.ResourceUID = res.ResourceTimesheetManagerUID CROSS JOIN
            MSP_TimesheetPeriod AS tperiod
            WHERE		(tperiod.StartDate BETWEEN (
            (SELECT		CASE WHEN (TimeDayOfTheWeek = 2) THEN '" + _stdate + @"' WHEN (TimeDayOfTheWeek = 1) THEN DATEADD(d,1, '" + _stdate + @"' )
                        ELSE DATEADD(d,(2-TimeDayofTheWeek), '" + _stdate + @"' ) END AS stdate
            FROM        MSP_TimeByDay
            WHERE		(TimeByDay = CONVERT(DATETIME, '" + _stdate + @"' , 102)))
            )
            AND '" + _enddate + @"' ) AND (res.ResourceUID IN " + filterresource + @")
            SELECT      [#t1].PeriodUID, [#t1].ResourceUID,[#t1].TM_Name, [#t1].RBS, [#t1].ResourceName, [#t1].PeriodName,
            ISNULl(tstatus.Description,'Not Created') AS [TimeSheet Status], [#t1].StartDate, [#t1].EndDate
            INTO #t2
            FROM        MSP_TimesheetStatus AS tstatus INNER JOIN
            MSP_Timesheet AS tsheet ON tstatus.TimesheetStatusID = tsheet.TimesheetStatusID INNER JOIN
            MSP_TimesheetResource AS tres ON tsheet.OwnerResourceNameUID = tres.ResourceNameUID RIGHT OUTER JOIN
            [#t1] ON [#t1].ResourceUID = tres.ResourceUID AND [#t1].PeriodUID = tsheet.PeriodUID
            drop table	#t1
            SELECT		PeriodName, TM_Name, ResourceName, COUNT(CASE WHEN ([TimeSheet Status] = 'In Progress') THEN [TimeSheet Status] END)
            AS [In Progress], COUNT(CASE WHEN ([TimeSheet Status] = 'Not Created') THEN [TimeSheet Status] END) AS [Not Created],
            COUNT(CASE WHEN ([TimeSheet Status] = 'Submitted') THEN [TimeSheet Status] END) AS Submitted,
            COUNT(CASE WHEN ([TimeSheet Status] = 'Approved') THEN [TimeSheet Status] END) AS Approved
            FROM        [#t2]
            --WHERE		([TimeSheet Status] <> 'Approved')
            GROUP BY	PeriodName, TM_Name, ResourceName
            ORDER BY	PeriodName, TM_Name, ResourceName
            /*
            SELECT		PeriodName, COUNT(CASE WHEN ([TimeSheet Status] = 'In Progress') THEN [TimeSheet Status] END)
            AS [In Progress], COUNT(CASE WHEN ([TimeSheet Status] = 'Not Created') THEN [TimeSheet Status] END) AS [Not Created],
            COUNT(CASE WHEN ([TimeSheet Status] = 'Submitted') THEN [TimeSheet Status] END) AS Submitted
            FROM        [#t2]
            WHERE		([TimeSheet Status] <> 'Approved')
            GROUP BY	PeriodName
            ORDER BY	PeriodName
            */
            drop table	#t2
            ";

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                DataSet dt = new DataSet();
                SqlDataAdapter adapter = new SqlDataAdapter(new SqlCommand(gridqry, con));
                adapter.Fill(dt);

//.........这里部分代码省略.........
开发者ID:Vengadeswaran,项目名称:TimeSheet-Project,代码行数:101,代码来源:TimeSheetComplainceReport.ascx.cs


注:本文中的Resource.GetCurrentUserUid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。