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


C# Data.IsThisWeek方法代码示例

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


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

示例1: LoadGlanceCalendar

    protected void LoadGlanceCalendar()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        int sun = 0;
        int mon = 0;
        int tues = 0;
        int wed = 0;
        int thurs = 0;
        int fri = 0;
        int sat = 0;
        DataSet ds = dat.GetData("SELECT * FROM User_Calendar UC, Event_Occurance EO WHERE UC.EventID=EO.EventID AND UC.UserID="+Session["User"].ToString());

        int subtraction = 0;

        switch (DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).DayOfWeek)
        {
            case DayOfWeek.Friday:
                subtraction = 5;
                break;
            case DayOfWeek.Monday:
                subtraction = 1;
                break;
            case DayOfWeek.Saturday:
                subtraction = 6;
                break;
            case DayOfWeek.Sunday:
                subtraction = 0;
                break;
            case DayOfWeek.Thursday:
                subtraction = 4;
                break;
            case DayOfWeek.Tuesday:
                subtraction = 2;
                break;
            case DayOfWeek.Wednesday:
                subtraction = 3;
                break;
            default: break;
        }

        if(ds.Tables.Count > 0)
            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DateTime date = DateTime.Parse(ds.Tables[0].Rows[i]["DateTimeStart"].ToString());

                    switch (date.DayOfWeek)
                    {
                        case DayOfWeek.Friday:
                            if (dat.IsThisWeek(date))
                                fri++;
                            GlanceDay6.DATE = date;
                            break;
                        case DayOfWeek.Monday:
                            if (dat.IsThisWeek(date))
                                mon++;
                            GlanceDay2.DATE = date;
                            break;
                        case DayOfWeek.Saturday:
                            if (dat.IsThisWeek(date))
                                sat++;
                            GlanceDay7.DATE = date;
                            break;
                        case DayOfWeek.Sunday:
                            if (dat.IsThisWeek(date))
                                sun++;
                            GlanceDay1.DATE = date;
                            break;
                        case DayOfWeek.Thursday:
                            if (dat.IsThisWeek(date))
                                thurs++;
                            GlanceDay5.DATE = date;
                            break;
                        case DayOfWeek.Tuesday:
                            if (dat.IsThisWeek(date))
                                tues++;
                            GlanceDay3.DATE = date;
                            break;
                        case DayOfWeek.Wednesday:
                            if (dat.IsThisWeek(date))
                                wed++;
                            GlanceDay4.DATE = date;
                            break;
                        default: break;
                    }

                }
            }

        if (sun == 0)
            GlanceDay1.DATE = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).Subtract(TimeSpan.FromDays(subtraction));
        GlanceDay1.NUM_OF_EVENTS = sun;

        if (mon == 0)
            GlanceDay2.DATE = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).Subtract(TimeSpan.FromDays(subtraction-1));
        GlanceDay2.NUM_OF_EVENTS = mon;

        if (tues == 0)
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:User_OLD.aspx.cs

示例2: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        DayOfWeek theWeekDay = DayOfWeek.Friday;
        switch (theDay)
        {
            case days.Sun:
                theWeekDay = DayOfWeek.Sunday;
                break;
            case days.Mon:
                theWeekDay = DayOfWeek.Monday;
                break;
            case days.Tues:
                theWeekDay = DayOfWeek.Tuesday;
                break;
            case days.Wed:
                theWeekDay = DayOfWeek.Wednesday;
                break;
            case days.Thurs:
                theWeekDay = DayOfWeek.Thursday;
                break;
            case days.Fri:
                theWeekDay = DayOfWeek.Friday;
                break;
            case days.Sat:
                theWeekDay = DayOfWeek.Saturday;
                break;
        }

        if (!IsPostBack)
        {
            string imageSrc = "";
            string eventStr = "";
            string thisDay = theDay.ToString();

            HttpCookie cookie = Request.Cookies["BrowserDate"];
            DateTime datNow = DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":"));
            Data dat = new Data(datNow);

            int thisDayCount = 0;
            DataView dvAll = dat.GetDataDV("SELECT DISTINCT EO.DateTimeStart AS TheDate, EO.EventID AS ID, E.Header FROM Events E, User_Calendar UC, Event_Occurance EO WHERE " +
                "UC.EventID=EO.EventID AND EO.EventID=E.ID AND UC.UserID=" + Session["User"].ToString());

            int subtraction = 0;

            switch (datNow.DayOfWeek)
            {
                case DayOfWeek.Friday:
                    subtraction = 5;
                    break;
                case DayOfWeek.Monday:
                    subtraction = 1;
                    break;
                case DayOfWeek.Saturday:
                    subtraction = 6;
                    break;
                case DayOfWeek.Sunday:
                    subtraction = 0;
                    break;
                case DayOfWeek.Thursday:
                    subtraction = 4;
                    break;
                case DayOfWeek.Tuesday:
                    subtraction = 2;
                    break;
                case DayOfWeek.Wednesday:
                    subtraction = 3;
                    break;
                default: break;
            }

            string toolTipText = "";

            if (dvAll.Count > 0)
            {
                for (int i = 0; i < dvAll.Count; i++)
                {
                    DateTime date2 = DateTime.Parse(dvAll[i]["TheDate"].ToString());

                    if (date2.DayOfWeek == theWeekDay)
                    {
                        if (dat.IsThisWeek(date2))
                        {
                            thisDayCount++;
                            toolTipText += "<div class=\"TextNormal\" style=\"clear: both;\"><a class=\"NavyLink12\" href=\"" + dat.MakeNiceName(dvAll[i]["Header"].ToString()) +
                                "_" + dvAll[i]["ID"].ToString() + "_Event\">" + dvAll[i]["Header"].ToString() + "</a> at " +
                                DateTime.Parse(dvAll[i]["TheDate"].ToString()).ToShortTimeString() + "</div>";
                        }
                    }
                }
            }

            numberOfEvents = thisDayCount;

            switch (numberOfEvents)
            {
                case 0:
                    imageSrc = "NewImages/GlanceCalendarOpen.png";
                    eventStr = "open";
                    break;
                default:
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:GlanceDay.ascx.cs

示例3: LoadGlanceCalendar

    protected void LoadGlanceCalendar()
    {
        HttpCookie cookie = Request.Cookies["BrowserDate"];
        Data dat = new Data(DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")));
        int sun = 0;
        int mon = 0;
        int tues = 0;
        int wed = 0;
        int thurs = 0;
        int fri = 0;
        int sat = 0;
        DataView dv = dat.GetDataDV("SELECT DISTINCT EO.DateTimeStart AS TheDate, EO.EventID AS ID FROM User_Calendar UC, Event_Occurance EO WHERE " +
            "UC.EventID=EO.EventID AND UC.UserID="+Session["User"].ToString());

        DataView dvGroupEventMessages = dat.GetDataDV("SELECT DISTINCT GEO.DateTimeStart AS TheDate, E.ID FROM GroupEvent_Members UC, "+
            "GroupEvents E, " +
        " GroupEvent_Occurance GEO WHERE GEO.GroupEventID=E.ID AND UC.GroupEventID=E.ID AND UC.Accepted = " +
        "'True' AND UC.UserID=" + Session["User"].ToString());

        DataView dvGroupEventMessagesNonMember = dat.GetDataDV("SELECT DISTINCT GEO.DateTimeStart AS TheDate, E.ID FROM "+
            "User_GroupEvent_Calendar UC, GroupEvents E, GroupEvent_Occurance GEO WHERE  UC.GroupEventID=E.ID "+
            " AND UC.UserID=" + Session["User"].ToString() + " AND GEO.GroupEventID=E.ID ");

        DataView dvAll = MergeDVTwoCol(dv, MergeDVTwoCol(dvGroupEventMessages, dvGroupEventMessagesNonMember));

        int subtraction = 0;

        switch (DateTime.Parse(cookie.Value.ToString().Replace("%20", " ").Replace("%3A", ":")).DayOfWeek)
        {
            case DayOfWeek.Friday:
                subtraction = 5;
                break;
            case DayOfWeek.Monday:
                subtraction = 1;
                break;
            case DayOfWeek.Saturday:
                subtraction = 6;
                break;
            case DayOfWeek.Sunday:
                subtraction = 0;
                break;
            case DayOfWeek.Thursday:
                subtraction = 4;
                break;
            case DayOfWeek.Tuesday:
                subtraction = 2;
                break;
            case DayOfWeek.Wednesday:
                subtraction = 3;
                break;
            default: break;
        }

        if (dvAll.Count > 0)
        {
            for (int i = 0; i < dvAll.Count; i++)
            {
                DateTime date = DateTime.Parse(dvAll[i]["TheDate"].ToString());

                switch (date.DayOfWeek)
                {
                    case DayOfWeek.Friday:
                        if (dat.IsThisWeek(date))
                            fri++;
                        GlanceDay6.DATE = date;
                        break;
                    case DayOfWeek.Monday:
                        if (dat.IsThisWeek(date))
                            mon++;
                        GlanceDay2.DATE = date;
                        break;
                    case DayOfWeek.Saturday:
                        if (dat.IsThisWeek(date))
                            sat++;
                        GlanceDay7.DATE = date;
                        break;
                    case DayOfWeek.Sunday:
                        if (dat.IsThisWeek(date))
                            sun++;
                        GlanceDay1.DATE = date;
                        break;
                    case DayOfWeek.Thursday:
                        if (dat.IsThisWeek(date))
                            thurs++;
                        GlanceDay5.DATE = date;
                        break;
                    case DayOfWeek.Tuesday:
                        if (dat.IsThisWeek(date))
                            tues++;
                        GlanceDay3.DATE = date;
                        break;
                    case DayOfWeek.Wednesday:
                        if (dat.IsThisWeek(date))
                            wed++;
                        GlanceDay4.DATE = date;
                        break;
                    default: break;
                }

            }
//.........这里部分代码省略.........
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:101,代码来源:User_OLD2.aspx.cs


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