Exemple #1
0
        // Thực đơn
        public JsonResult InsertMenu(int menu_id, int menu_service_id, string menu_name, int menu_num, decimal menu_price, string menu_status, string menu_note, List <MenuGroup> details)
        {
            AjaxResultModel Result = new AjaxResultModel();

            try
            {
                string xml = "<Root>";
                xml += "<Menu>"
                       + "<MenuId>" + menu_id + "</MenuId>"
                       + "<MenuName>" + menu_name + "</MenuName>"
                       + "<MenuNum>" + menu_num + "</MenuNum>"
                       + "<MenuPrice>" + menu_price + "</MenuPrice>"
                       + "<MenuStatus>" + menu_status + "</MenuStatus>"
                       + "<MenuNote>" + menu_note + "</MenuNote>"
                       + "<MenuServiceId>" + menu_service_id + "</MenuServiceId>"
                       + "</Menu>";
                xml += "<Groups>";
                foreach (MenuGroup group in details)
                {
                    xml += "<Group>"
                           + "<GroupId>" + group.GroupId + "</GroupId>"
                           + "<GroupName>" + (group.GroupName ?? "") + "</GroupName>";
                    xml += "<Rows>";
                    foreach (MenuDetail detail in group.GroupDetails)
                    {
                        xml += "<Detail>"
                               + "<DetailId>" + detail.DetailId + "</DetailId>"
                               + "<DetailName>" + detail.DetailName + "</DetailName>"
                               + "</Detail>";
                    }
                    xml += "</Rows>";
                    xml += "</Group>";
                }
                xml += "</Groups>";
                xml += "</Root>";

                string id = "";
                if (Menus_Service.Insert(xml))
                {
                    Result.Code   = 00;
                    Result.Result = "Thành công";
                }
                else
                {
                    Result.Code   = 001;
                    Result.Result = "Không thành công";
                }
            }
            catch (Exception Ex)
            {
                Result.Code   = 2000;
                Result.Result = "Có lỗi xảy ra. Vui lòng thử lại sau hoặc liên hệ với người quản trị.";
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "UpdatePassword :", Ex.Message, Ex.ToString());
            }

            return(Json(Result));
        }
Exemple #2
0
        public PartialViewResult _MenuList(int serviceId = 0)
        {
            List <TB_MENUS> list = new List <TB_MENUS>();

            try
            {
                list = Menus_Service.GetByServiceId(serviceId);
            }
            catch (Exception ex)
            {
                CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "Services/_TypeList :", ex.Message, ex.ToString());
            }

            return(PartialView(list));
        }
Exemple #3
0
        public PartialViewResult _MenuListDetail(int serviceId, int menuId = 0)
        {
            int height = (int)(Request.Browser.ScreenPixelsHeight * 0.85);

            TB_MENUS menu = Menus_Service.GetById(menuId);

            if (menu == null)
            {
                menu = new TB_MENUS();
            }
            menu.MenuServiceId = serviceId;
            ViewBag.Menu       = menu;

            List <V_Group_Menu> details = Menus_Service.GetAllDetails(menuId);

            ViewBag.Details = details;

            return(PartialView(height));
        }
        public PartialViewResult _MenuListDetail(int registerId = 0)
        {
            TB_REGISTERS regis     = Registers_Service.GetById(registerId);
            int          serviceId = regis.RegisterServiceId;
            int          menuId    = regis.RegisterMenuId;

            int height = (int)(Request.Browser.ScreenPixelsHeight * 0.85);

            TB_MENUS menu = Menus_Service.GetById(menuId);

            if (menu == null)
            {
                menu = new TB_MENUS();
            }
            menu.MenuServiceId = serviceId;
            ViewBag.Menu       = menu;

            List <V_Group_Menu>        details     = Menus_Service.GetAllDetails(menuId);
            List <TB_REGISTER_DETAILS> regisDetail = Registers_Service.GetByRegisterId(registerId);
            List <V_Group_Menu>        list        = new List <V_Group_Menu>();

            foreach (var item in details)
            {
                V_Group_Menu v = new V_Group_Menu();
                v = item;

                foreach (var data in item.MgroupDetail)
                {
                    if (regisDetail.Where(x => x.RdetailMdetailId == data.MdetailId).ToList().Count > 0)
                    {
                        v.MgroupDetail = new List <V_Details_Menu>();
                        v.MgroupDetail.Add(data);
                        list.Add(v);
                        break;
                    }
                }
            }

            ViewBag.Details = list;

            return(PartialView(height));
        }