Exemple #1
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);
        }
Exemple #2
0
        public void DeleteMenu(Models.MenuDo entity)
        {
            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Delete_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(int), "MenuID", entity.MenuID);

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

                command.ExecuteNonQuery();
            }));
        }