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


C# Date.getCountDays方法代码示例

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


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

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null) Response.Redirect("Default.aspx");

        Display disp = new Display();
        Date dt = new Date();
        SAPDB db = new SAPDB();
        SQLDB sql = new SQLDB();
        PeriodDB perdb = new PeriodDB();

        Person user = (Person)Session["User"];

        //List<Role> rol = user.Roles;
        //foreach (Role r in rol)
        //    Response.Write(r.RoleID + " = " + r.RoleName);

        if (!IsPostBack)
        {
            fillMonths();
            if (Request.QueryString["data"] == null)
                period.SelectedValue = dt.getMonthToday();
        }

        year = period.SelectedItem.Text.Substring(period.SelectedItem.Text.Length - 4);
        month = period.SelectedItem.Value;

        string fio = "";
        string tab_number = "";
        string post = "";
        check = false;
        closed = false;

        count_days = dt.getCountDays(Convert.ToInt32(month), Convert.ToInt32(year));

        if (Request.QueryString["type"] != null) role = Request.QueryString["type"].ToString();

        Period per = perdb.getPeriod(Convert.ToInt32(month), Convert.ToInt32(year));

        if (per.IsClosed == 1)
        {
            lbStatus.Text = "������";
            Traffic.Text = "<img alt='' src='App_Resources/red.bmp' style='position:relative; top:4px;' />";
            closed = true;
        }
        else Traffic.Text = "<img alt='' src='App_Resources/green.bmp' style='position:relative; top:4px;' />";

        if (Request.QueryString["data"] != null)
        {
            EncryptedQueryString QueryString = new EncryptedQueryString(Request.QueryString["data"]);
            if (QueryString["fio"] != null) fio = QueryString["fio"];
            if (QueryString["tab"] != null) tab_number = QueryString["tab"];
            if (QueryString["post"] != null) post = QueryString["post"];
            if (QueryString["role"] != null) role = QueryString["role"];
            if (QueryString["check"] != null) check = true;
            if (!QueryString["month"].Equals(period.SelectedItem.Value))
            {
                fio = "";
                tab_number = "";
                post = "";
                check = false;
            }
        }

        //Response.Write(month);

        //Response.Write("fio=" + fio + "tab=" + tab_number + " - " + month + "<br>");
        //Response.Write(post + "<br>");

        string start_date = dt.getSAPStartPeriodDate(month, year);
        string end_date = dt.getSAPEndPeriodDate(month, year);

        StartDateOfPeriod = start_date;
        EndDateOfPeriod = end_date;
        //Response.Write(start_date + end_date);

        Label lb = new Label();
        lb.Text = disp.DisplayDaysTabel(count_days, 18);
        days.Controls.Add(lb);

        //Response.Write(start_date + end_date);
        //Period period_time = perdb.getPeriod(Convert.ToInt32(month), Convert.ToInt32(year));

        setButtons(role);

        //Response.Write(start_date + "-" + end_date + "<br>");

        this.employees = null;/// db.getEmployeeList(start_date, end_date, user.TabNum, this.role);
        EmployeeList emp_list = new EmployeeList();
        List<Post> post_list = null;/// pl.getPosts(db.getPostList(start_date, end_date, user.TabNum, this.role));
        if (post_list != null)
        {
            fillPosts(post_list);
        }
        else
        {
            ListItem li = new ListItem("�������� ���������");
            ddl_post.Items.Add(li);
        }

        /*if (post != "")
//.........这里部分代码省略.........
开发者ID:ROLF-IT-Department,项目名称:timeboard,代码行数:101,代码来源:Tabel.aspx.cs

示例2: GetReportTimeboard

    public void GetReportTimeboard(List<Employee> all_employees, Period per)
    {
        SQLDB sql = new SQLDB();

        Date dt = new Date();

        OpenReportExcelFile(@"C:\Inetpub\wwwroot\timeboard\Reports\ReportTimeboard.xls");
        Excel.Workbook workbook = (Excel.Workbook)thisApplication.Workbooks["ReportTimeboard.xls"];
        Excel.Worksheet worksheet = (Excel.Worksheet)workbook.Worksheets["Sheet1"];

        NightHoursDB nightdb = new NightHoursDB();
        List<NightHours> nighthours = nightdb.getNightHours();

        EmployeeComparerByFullnameASC emp_comp = new EmployeeComparerByFullnameASC();
        all_employees.Sort(emp_comp);

        int count_days = dt.getCountDays(per.MonthID, per.Year);

        worksheet.Cells[1, 1] = "Таб. номер";
        worksheet.Cells[1, 2] = "ФИО";

        int j = 2;
        int i = 1;

        for (i = 1; i <= count_days; i++)
        {
            worksheet.Cells[1, ++j] = i;
            worksheet.Cells[1, ++j] = i + "a";
        }

        i = 2;

        foreach (Employee emp in all_employees)
        {

            worksheet.Cells[i, 1] = DeleteZeroFromEmployeeID(emp.EmployeeID);
            worksheet.Cells[i, 2] = emp.FullName;

            j = 2;

            int day = 1;

            EmployeeList emp_list = new EmployeeList();

            List<HRHours> hr_current = sql.getHRHours(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate);
            List<Schedule> schedule = sql.getSchedule(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate);
            List<ScheduleDeflection> dschedule = sql.getScheduleDeflection(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate);

            foreach (Schedule sch in schedule)
            {
                j++;

                decimal all_hours = 0;
                decimal night_hours = 0;

                int d = Convert.ToInt32(sch.DayPeriod);
                // если у нас день не совпадает с днем в графике, заполняю пустым квадратом

                HRHours hr = hr_current.Find(delegate(HRHours hrh) { return Convert.ToInt32(hrh.Day) == day; });

                if (hr != null)
                {
                    all_hours += hr.DayOverHours + hr.NightOverHours;
                    night_hours += hr.NightOverHours;
                }

                while (d != day)
                {
                    if (day == count_days) break;

                    if (all_hours != 0) worksheet.Cells[i, j] = all_hours.ToString();

                    if (night_hours != 0) worksheet.Cells[i, ++j] = night_hours.ToString();
                    else j++;

                    j++;
                    day++;
                }

                ScheduleDeflection sd = dschedule.Find(delegate(ScheduleDeflection dsch) { return Convert.ToInt32(dsch.DayPeriod) == day; });
                if (sd != null)
                {
                    //time = CheckDecimalNumber(sd.CodeT13);

                    decimal diversity = sch.TimeHours - sd.TimeHours;
                    if (diversity != 0)
                    {
                        if (diversity > 0)
                        {

                            all_hours = diversity;
                        }
                        else
                        {

                            all_hours = sd.TimeHours;
                        }
                    }

                    if (all_hours != 0) worksheet.Cells[i, j] = all_hours.ToString();
//.........这里部分代码省略.........
开发者ID:ROLF-IT-Department,项目名称:timeboard,代码行数:101,代码来源:ExcelFile.cs

示例3: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null) Response.Redirect("Default.aspx");

        Date dt = new Date();
        SAPDB db = new SAPDB();
        SQLDB sql = new SQLDB();
        PeriodDB perdb = new PeriodDB();
        NightHoursDB nightdb = new NightHoursDB();
        Person user = (Person)Session["User"];

        string role = "";
        string month_id = "";
        string year = "";
        string start_date = "";
        string end_date = "";

        if (Request.QueryString["rtb"] != null)
        {
            EncryptedQueryString QueryString = new EncryptedQueryString(Request.QueryString["rtb"]);
            if (QueryString["role"] != null) role = QueryString["role"].ToString();
            if (QueryString["month_id"] != null) month_id = QueryString["month_id"].ToString();
            if (QueryString["year"] != null) year = QueryString["year"].ToString();
            if (QueryString["start_date"] != null) start_date = QueryString["start_date"].ToString();
            if (QueryString["end_date"] != null) end_date = QueryString["end_date"].ToString();
        }

        List<NightHours> nighthours = nightdb.getNightHours();

        Period per = perdb.getPeriod(Convert.ToInt32(month_id), Convert.ToInt32(year));

        EmployeeList emp_list = new EmployeeList();

        List<Employee> all_employees = db.getEmployeeListForReports(start_date, end_date, user.TabNum, role);

        if (all_employees == null)
        {
            MessageBox.Show("Невозможно сформировать отчет! Список сотрудников за период пуст!");
            return;
        }

        EmployeeComparerByFullnameASC emp_comp = new EmployeeComparerByFullnameASC();
        all_employees.Sort(emp_comp);

        Response.Clear();
        Response.Charset = "utf-8";
        Response.ContentType = "application/vnd.ms-excel";

        string str = @"<table cellspacing='0' cellpadding='0' border='1'>
                            <tr>
                                <td width='30px' style='font-weight: bold;' align='center' valign='middle'>
                                    Таб. номер
                                </td>
                                <td width='100px' style='font-weight: bold;' align='center' valign='middle'>
                                    ФИО
                                </td>";

        int count_days = dt.getCountDays(per.MonthID, per.Year);

        for (int i = 1; i <= count_days; i++)
            str += "<td width='20px' style='font-weight: bold;' align='center'>" + i.ToString() + "</td><td width='20px' style='background-color: #99CCFF; font-weight: bold;' align='center' >" + i.ToString() + "a</td>";

        str += "<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";

        foreach (Employee emp in all_employees)
        {

            str += "<tr>";
            str += "<td width='30px' align='center'>" + DeleteZeroFromEmployeeID(emp.EmployeeID) + "</td>";
            str += "<td width='100px' align='center'>" + emp.FullName + "</td>";

            int day = 1;

            List<HRHours> hr_current = sql.getHRHours(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate);
            List<Schedule> schedule = sql.getSchedule(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate);
            List<ScheduleDeflection> dschedule = sql.getScheduleDeflection(emp.EmployeeID, emp.StartPeriod, emp.BeginDate, emp.EndDate);

           foreach (Schedule sch in schedule)
           {

               decimal all_hours = 0;
               decimal night_hours = 0;

               int d = Convert.ToInt32(sch.DayPeriod);
               // если у нас день не совпадает с днем в графике, заполняю пустым квадратом

               //TimekeeperHours tkh = tkh_current.Find(delegate(TimekeeperHours h) { return Convert.ToInt32(h.Day) == day; });
               HRHours hr = hr_current.Find(delegate(HRHours hrh) { return Convert.ToInt32(hrh.Day) == day; });

               if (hr != null)
               {
                   all_hours += hr.DayOverHours + hr.NightOverHours;
                   night_hours += hr.NightOverHours;
               }

               while (d != day)
               {
                   if (day == count_days) break;

                   if (all_hours != 0) str += "<td width='20px' align='center'>" + all_hours.ToString() + "</td>";
//.........这里部分代码省略.........
开发者ID:ROLF-IT-Department,项目名称:timeboard,代码行数:101,代码来源:ReportTimeboard.aspx.cs


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