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


C# Report.GetActiveUsers方法代码示例

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


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

示例1: GetWeeklyReport

        private DataTable GetWeeklyReport(DateTime startdate, DateTime enddate, int userid)
        {
            DataTable dtAttandence = new DataTable();
            try
            {
                lblWeekReportheading.Text = "Weekly summary attendance report";
                DateTime endOfMonth = GeneralFunction.GetFirstDayOfWeekDate(enddate);
                lblWeekReport.Text = "( Wk of " + startdate.ToString("MM/dd/yyyy") + " - Wk of" + endOfMonth.ToString("MM/dd/yyyy") + " )";
                dtAttandence.Columns.Add("empid", typeof(string));
                dtAttandence.Columns.Add("Empname", typeof(string));
                dtAttandence.Columns.Add("StatingDate", typeof(string));
                dtAttandence.Columns.Add("TermDate", typeof(string));
                dtAttandence.Columns.Add("TermReason", typeof(string));

                dtAttandence.Rows.Add();
                Attendance.BAL.Report obj = new Report();

                DataSet ds = obj.GetActiveUsers(startdate, enddate, userid, ViewState["Location"].ToString().Trim());

                for (int j = 0; j < 4; j++)
                {

                    DataSet dsResult = obj.GetWeeklyReport(startdate, startdate.AddDays(6), userid, ViewState["Location"].ToString().Trim());

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        dtAttandence.Columns.Add("Week" + (j + 1), typeof(string));
                        dtAttandence.Columns.Add("Days" + (j + 1), typeof(string));
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            if (j == 0)
                            {
                                dtAttandence.Rows.Add();
                            }
                            dtAttandence.Rows[i]["empid"] = ds.Tables[0].Rows[i]["empid"].ToString();
                            dtAttandence.Rows[i]["empname"] = ds.Tables[0].Rows[i]["firstName"].ToString() + " " + ds.Tables[0].Rows[i]["lastname"].ToString();
                            dtAttandence.Rows[i]["StatingDate"] = ds.Tables[0].Rows[i]["Startdate"].ToString();
                            dtAttandence.Rows[i]["TermDate"] = ds.Tables[0].Rows[i]["Termdate"].ToString();
                            if (dsResult.Tables.Count > 0)
                            {
                                if (dsResult.Tables[0].Rows.Count > 1)
                                {
                                    DataTable dt = dsResult.Tables[0];
                                    DataView dv = dt.DefaultView;
                                    DataTable dtname = new DataTable();
                                    dv.RowFilter = "empid='" + ds.Tables[0].Rows[i]["empid"].ToString() + "'";
                                    dtname = dv.ToTable();
                                    if (dtname.Rows.Count > 0)
                                    {
                                        dtAttandence.Rows[i]["Week" + (j + 1)] = dtname.Rows[0]["weeklyhrs"].ToString() == "NULL" ? "" : dtname.Rows[0]["weeklyhrs"].ToString() == "" ? "" : GeneralFunction.CalNumericToint(Convert.ToDouble(dtname.Rows[0]["weeklyhrs"].ToString())).ToString();
                                        dtAttandence.Rows[i]["Days" + (j + 1)] = dtname.Rows[0]["days"].ToString() == "NULL" ? 0 : dtname.Rows[0]["days"].ToString() == "" ? 0 : Convert.ToInt32(dtname.Rows[0]["days"].ToString());
                                    }
                                }
                            }

                        }
                        startdate = startdate.AddDays(7);
                        enddate = startdate.AddDays(6);
                    }

                }

                int TotalHrs1 = 0;
                int TotalHrs2 = 0;
                int TotalHrs3 = 0;
                int TotalHrs4 = 0;
                int TotalDays = 0;

                int Days1 = 0;
                int Days2 = 0;
                int Days3 = 0;
                int Days4 = 0;

                dtAttandence.Columns.Add("Totalhrs");
                dtAttandence.Columns.Add("Days");
                for (int i = 0; i < dtAttandence.Rows.Count - 1; i++)
                {
                    TotalHrs1 = TotalHrs1 + ((dtAttandence.Rows[i]["Week1"].ToString() == "Null") ? 0 : (dtAttandence.Rows[i]["Week1"].ToString() == "") ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week1"]));
                    TotalHrs2 = TotalHrs2 + (dtAttandence.Rows[i]["Week2"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Week2"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week2"]));
                    TotalHrs3 = TotalHrs3 + ((dtAttandence.Rows[i]["Week3"].ToString() == "Null" ? 0 : (dtAttandence.Rows[i]["Week3"].ToString() == "") ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week3"])));
                    TotalHrs4 = TotalHrs4 + (dtAttandence.Rows[i]["Week4"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Week4"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week4"]));

                    int WeekHrs = ((dtAttandence.Rows[i]["Week1"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Week1"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week1"]))) +
                                                     (dtAttandence.Rows[i]["Week2"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Week2"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week2"])) +
                                                     (dtAttandence.Rows[i]["Week3"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Week3"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week3"])) +
                                                     (dtAttandence.Rows[i]["Week4"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Week4"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week4"]));
                    dtAttandence.Rows[i]["Totalhrs"] = WeekHrs == 0 ? "" : GeneralFunction.ConverttoTime(WeekHrs).ToString();
                    dtAttandence.Rows[i]["Days"] = (dtAttandence.Rows[i]["Days1"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days1"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days1"]))
                               + (dtAttandence.Rows[i]["Days2"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days2"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days2"]))
                               + (dtAttandence.Rows[i]["Days3"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days3"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days3"]))
                               + (dtAttandence.Rows[i]["Days4"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days4"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days4"]));

                    Days1 += dtAttandence.Rows[i]["Days1"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days1"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days1"]);
                    Days2 += dtAttandence.Rows[i]["Days2"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days2"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days2"]);
                    Days3 += dtAttandence.Rows[i]["Days3"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days3"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days3"]);
                    Days4 += dtAttandence.Rows[i]["Days4"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days4"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days4"]);

                    TotalDays += dtAttandence.Rows[i]["Days"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days"].ToString());

                }
//.........这里部分代码省略.........
开发者ID:BInny1,项目名称:TestHrBizStrides,代码行数:101,代码来源:Reports.aspx.cs

示例2: GetMonthlyreport

        private DataTable GetMonthlyreport(DateTime startdate, DateTime endMonth, int userid)
        {
            DataTable dtAttandence = new DataTable();
            try
            {
                lblWeekReportheading.Text = "Monthly summary attendance report";

                lblWeekReport.Text = "( " + startdate.ToString("MM/dd/yyyy") + " - " + endMonth.ToString("MM/dd/yyyy") + " )";
                dtAttandence.Columns.Add("empid", typeof(string));
                dtAttandence.Columns.Add("Empname", typeof(string));
                dtAttandence.Columns.Add("StatingDate", typeof(string));
                dtAttandence.Columns.Add("TermDate", typeof(string));
                dtAttandence.Columns.Add("TermReason", typeof(string));
                dtAttandence.Columns.Add("Days", typeof(int));
                dtAttandence.Rows.Add();
                Attendance.BAL.Report obj = new Report();


                DateTime enddate = startdate.AddMonths(1).AddSeconds(-1);

                DataSet ds = obj.GetActiveUsers(startdate, endMonth, userid, ViewState["Location"].ToString().Trim());

                for (int j = 0; j < 6; j++)
                {

                    DataSet dsResult = obj.GetWeeklyReport(startdate, enddate, userid, ViewState["Location"].ToString().Trim());

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        dtAttandence.Columns.Add("Month" + (j + 1), typeof(string));

                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            if (j == 0)
                            {
                                dtAttandence.Rows.Add();
                            }
                            dtAttandence.Rows[i]["empid"] = ds.Tables[0].Rows[i]["empid"].ToString();
                            dtAttandence.Rows[i]["empname"] = ds.Tables[0].Rows[i]["firstName"].ToString() + " " + ds.Tables[0].Rows[i]["lastname"].ToString();
                            dtAttandence.Rows[i]["StatingDate"] = ds.Tables[0].Rows[i]["Startdate"].ToString();
                            dtAttandence.Rows[i]["TermDate"] = ds.Tables[0].Rows[i]["Termdate"].ToString();
                            if (dsResult.Tables.Count > 0)
                            {
                                if (dsResult.Tables[0].Rows.Count > 1)
                                {
                                    DataTable dt = dsResult.Tables[0];
                                    DataView dv = dt.DefaultView;
                                    DataTable dtname = new DataTable();
                                    dv.RowFilter = "empid='" + ds.Tables[0].Rows[i]["empid"].ToString() + "'";
                                    dtname = dv.ToTable();
                                    if (dtname.Rows.Count > 0)
                                    {
                                       // dtAttandence.Rows[i]["Month" + (j + 1)] = dtname.Rows[0]["weeklyhrs"].ToString();
                                        dtAttandence.Rows[i]["Month" + (j + 1)] = dtname.Rows[0]["weeklyhrs"].ToString() == "NULL" ? "" : dtname.Rows[0]["weeklyhrs"].ToString() == "" ? "" : GeneralFunction.CalNumericToint(Convert.ToDouble(dtname.Rows[0]["weeklyhrs"].ToString())).ToString();
                                        dtAttandence.Rows[i]["Days"] = (dtAttandence.Rows[i]["Days"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days"].ToString())) + (dtname.Rows[0]["days"].ToString() == "NULL" ? 0 : Convert.ToInt32(dtname.Rows[0]["days"].ToString()));
                                    }
                                }
                            }


                        }
                        startdate = enddate.AddSeconds(1);
                        enddate = startdate.AddMonths(1).AddSeconds(-1);
                    }

                }

                int TotalHrs1 = 0;
                int TotalHrs2 = 0;
                int TotalHrs3 = 0;
                int TotalHrs4 = 0;
                int TotalHrs5 = 0;
                int TotalHrs6 = 0;
                int TotalDays = 0;
                dtAttandence.Columns.Add("Totalhrs");
                for (int i = 0; i < dtAttandence.Rows.Count-1; i++)
                {
                    TotalHrs1 = TotalHrs1 + ((dtAttandence.Rows[i]["Month1"].ToString() == "Null") ? 0 : (dtAttandence.Rows[i]["Month1"].ToString() == "") ? 0 :Convert.ToInt32(dtAttandence.Rows[i]["Month1"]));
                    TotalHrs2 = TotalHrs2 + (dtAttandence.Rows[i]["Month2"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month2"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month2"]));
                    TotalHrs3 = TotalHrs3 + ((dtAttandence.Rows[i]["Month3"].ToString() == "Null" ? 0 : (dtAttandence.Rows[i]["Month3"].ToString() == "") ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month3"])));
                    TotalHrs4 = TotalHrs4 + (dtAttandence.Rows[i]["Month4"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month4"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month4"]));
                    TotalHrs5 = TotalHrs5 + (dtAttandence.Rows[i]["Month5"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month5"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month5"]));
                    TotalHrs6 = TotalHrs6 + (dtAttandence.Rows[i]["Month6"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month6"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month6"]));

                    int WeekHrs = ((dtAttandence.Rows[i]["Month1"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month1"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month1"]))) +
                                                     (dtAttandence.Rows[i]["Month2"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month2"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month2"])) +
                                                     (dtAttandence.Rows[i]["Month3"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month3"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month3"])) +
                                                     (dtAttandence.Rows[i]["Month4"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month4"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month4"]))+
                                                     (dtAttandence.Rows[i]["Month5"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month5"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month5"]))+
                                                     (dtAttandence.Rows[i]["Month6"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month6"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month6"]));
                                                                       
                    dtAttandence.Rows[i]["Totalhrs"] = WeekHrs == 0 ? "" : GeneralFunction.ConverttoTime(WeekHrs);
                    TotalDays += Convert.ToInt32(dtAttandence.Rows[i]["Days"]); 
                }

                dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Month1"] = TotalHrs1==0?"":TotalHrs1.ToString();
                dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Month2"] = TotalHrs2==0?"":TotalHrs2.ToString();
                dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Month3"] = TotalHrs3==0?"":TotalHrs3.ToString();
                dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Month4"] = TotalHrs4==0?"":TotalHrs4.ToString();
                dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Month5"] = TotalHrs5==0?"":TotalHrs5.ToString();
//.........这里部分代码省略.........
开发者ID:kamaelyoung,项目名称:HR.bizstrides,代码行数:101,代码来源:Reports.aspx.cs


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