Exemplo n.º 1
0
        public Models.UpdateMenuSubCategoryResultDo CreateMenuSubCategory(Models.MenuSubCategoryDo entity)
        {
            Models.UpdateMenuSubCategoryResultDo result = new Models.UpdateMenuSubCategoryResultDo();

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

                command.AddParameter(typeof(int), "GroupID", entity.GroupID);
                command.AddParameter(typeof(int), "CategoryID", entity.CategoryID);
                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.MenuSubCategoryDo> list = command.ToList <Models.MenuSubCategoryDo>();
                if (list != null)
                {
                    if (list.Count > 0)
                    {
                        result.SubCategory = list[0];
                    }
                }

                result.ErrorParameter(error);
            }));

            return(result);
        }
Exemplo n.º 2
0
        public void DeleteMenuSubCategory(Models.MenuSubCategoryDo entity)
        {
            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Delete_MenuSubCategory]";
                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(DateTime), "UpdateDate", entity.UpdateDate);
                command.AddParameter(typeof(string), "UpdateUser", entity.UpdateUser);

                command.ExecuteNonQuery();
            }));
        }