Beispiel #1
0
        public Models.UpdateMenuCategoryResultDo UpdateMenuCategory(Models.UpdateMenuCategoryDo entity)
        {
            Models.UpdateMenuCategoryResultDo result = new Models.UpdateMenuCategoryResultDo();

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

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

                string categoryXml = Utils.ConvertUtil.ConvertToXml_Store <Models.MenuCategoryDo>(entity.Categories);
                command.AddParameter(typeof(string), "MenuCategoryXML", categoryXml);

                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);
        }
Beispiel #2
0
        public Models.UpdateMenuCategoryResultDo CreateMenuCategory(Models.MenuCategoryDo entity)
        {
            Models.UpdateMenuCategoryResultDo result = new Models.UpdateMenuCategoryResultDo();

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

                command.AddParameter(typeof(int), "GroupID", entity.GroupID);
                command.AddParameter(typeof(string), "Code", entity.Code);
                command.AddParameter(typeof(string), "Name", entity.Name);

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

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

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

                result.ErrorParameter(error);
            }));

            return(result);
        }