Ejemplo n.º 1
0
 public async Task <bool> Handle(AddEventMenuCommand request, CancellationToken cancellationToken)
 {
     foreach (var item in request.EventMenu)
     {
         var EventMenus = new EventMenu
         {
             EventID = item.EventDetailsID,
             DishID  = item.DishID
         };
         dbContext.EventMenus.Add(EventMenus);
         await dbContext.SaveChangesAsync();
     }
     return(true);
 }
Ejemplo n.º 2
0
    void DayClick(GameObject go)
    {
        //to call the memo
        if (memobg.activeSelf == false)
        {
            memobg.SetActive(true);
        }

        //to restore the daylabel color
        days[nowfirstday + Common.now.Day - 1].label.color = thismonth;

        UILabel l = go.transform.Find("DayLabel").GetComponent <UILabel>();

        while (memogrid.transform.childCount > 0)
        {
            DestroyImmediate(memogrid.transform.GetChild(0).gameObject);
        }

        //to get the month
        if (l.color == thismonth || l.color == selectedday)
        {
            Common.now = new DateTime(Common.now.Year, Common.now.Month, int.Parse(l.text));
            l.color    = selectedday;
        }
        else if (l.color == othermonth)
        {
            int da = int.Parse(l.text), m;

            if (da >= 1 && da <= 14)
            {
                //next month
                m          = Common.now.Month + 1;
                Common.now = m != 13 ? new DateTime(Common.now.Year, m, da) : new DateTime(Common.now.Year + 1, 1, da);
            }
            else if (da >= 24 && da <= 31)
            {
                m          = Common.now.Month - 1;
                Common.now = m != 0 ? new DateTime(Common.now.Year, m, da) : new DateTime(Common.now.Year - 1, 12, da);
            }
            Start();
        }

        Transform t;

        //to set memo
        for (int j = 0; j < 3; ++j)
        {
            if (days[nowfirstday + Common.now.Day - 1].e[j] != -1)
            {
                Events d = null;

                try
                {
                    d = Common.events[j][days[nowfirstday + Common.now.Day - 1].e[j]];
                }
                catch
                {
                    days[nowfirstday + Common.now.Day - 1].e[j] = -1;
                    days[nowfirstday + Common.now.Day - 1].button.defaultColor = noteventday;
                    EventMenu.Writefile(j);
                    break;
                }

                for (int i = 0; i < d.title.Count; ++i)
                {
                    memogrid.AddChild(memogrid.GetChildList().Count == 0 ? t = ((GameObject)Instantiate(Resources.Load("Caramel/Calendar/MemoButton"), new Vector3(370f, 0f, 0f), Quaternion.identity)).transform : t = ((GameObject)Instantiate(memogrid.GetChild(0).gameObject, new Vector3(370f, 0f, 0f), Quaternion.identity)).transform);
                    t.localScale = Vector3.one;
                    t.Find("Memo").GetComponent <UILabel>().text = d.title[i] + '\n' + d.content[i] + "\n時間: " + d.from[i][0] + ':' + d.from[i][1];
                }
            }
        }

        memogrid.enabled = true;
    }