Example #1
0
        public Models.UpdateMenuResultDo UpdateMenu(Models.UpdateMenuDo entity)
        {
            Models.UpdateMenuResultDo result = new Models.UpdateMenuResultDo();

            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Update_Menu]";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.AddParameter(typeof(int), "GroupID", entity.GroupID);
                command.AddParameter(typeof(int), "CategoryID", entity.CategoryID);

                string subCategoryXml = Utils.ConvertUtil.ConvertToXml_Store <Models.MenuSubCategoryDo>(entity.SubCategories);
                command.AddParameter(typeof(string), "MenuSubCategoryXML", subCategoryXml);

                string menuXml = Utils.ConvertUtil.ConvertToXml_Store <Models.MenuDo>(entity.Menus);
                command.AddParameter(typeof(string), "MenuXML", menuXml);

                string brandXml = Utils.ConvertUtil.ConvertToXml_Store <Models.MenuBrandDo>(entity.Brands);
                command.AddParameter(typeof(string), "MenuBrandXML", brandXml);

                command.AddParameter(typeof(DateTime), "UpdateDate", entity.UpdateDate);
                command.AddParameter(typeof(string), "UpdateUser", entity.UpdateUser);

                Utils.SQL.ISQLDbParameter error = command.AddErrorParameter();

                command.ExecuteNonQuery();
                result.ErrorParameter(error);
            }));

            return(result);
        }
Example #2
0
        public Models.UpdateMenuResultDo CreateMenu(Models.MenuDo entity)
        {
            Models.UpdateMenuResultDo result = new Models.UpdateMenuResultDo();

            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Create_Menu]";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.AddParameter(typeof(int), "GroupID", entity.GroupID);
                command.AddParameter(typeof(int), "CategoryID", entity.CategoryID);
                command.AddParameter(typeof(int), "SubCategoryID", entity.SubCategoryID);
                command.AddParameter(typeof(string), "Code", entity.Code);
                command.AddParameter(typeof(string), "Name", entity.Name);
                command.AddParameter(typeof(string), "NickName", entity.NickName);
                command.AddParameter(typeof(decimal), "Price", entity.Price);
                command.AddParameter(typeof(string), "Printer", entity.Printer);
                command.AddParameter(typeof(bool), "FlagTakeAway", entity.FlagTakeAway);
                command.AddParameter(typeof(bool), "FlagAllowDiscount", entity.FlagAllowDiscount);
                command.AddParameter(typeof(bool), "FlagSpecifyPrice", entity.FlagSpecifyPrice);
                command.AddParameter(typeof(string), "SeparateBill", entity.SeparateBill);
                command.AddParameter(typeof(string), "BillHeader", entity.BillHeader);
                command.AddParameter(typeof(string), "MenuType", entity.MenuType);

                string brandXml = Utils.ConvertUtil.ConvertToXml_Store <Models.MenuBrandDo>(entity.Brands);
                command.AddParameter(typeof(string), "MenuBrandXML", brandXml);

                command.AddParameter(typeof(DateTime), "CreateDate", entity.CreateDate);
                command.AddParameter(typeof(string), "CreateUser", entity.CreateUser);

                Utils.SQL.ISQLDbParameter error = command.AddErrorParameter();

                List <Models.MenuDo> list = command.ToList <Models.MenuDo>();
                if (list != null)
                {
                    if (list.Count > 0)
                    {
                        result.Menu = list[0];
                    }
                }

                result.ErrorParameter(error);
            }));

            return(result);
        }