예제 #1
0
        public Models.UpdateMenuGroupResultDo CreateMenuGroup(Models.MenuGroupDo entity)
        {
            Models.UpdateMenuGroupResultDo result = new Models.UpdateMenuGroupResultDo();

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

                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.MenuGroupDo> list = command.ToList <Models.MenuGroupDo>();
                if (list != null)
                {
                    if (list.Count > 0)
                    {
                        result.Group = list[0];
                    }
                }
                result.ErrorParameter(error);
            }));

            return(result);
        }
예제 #2
0
        public Models.UpdateMenuGroupResultDo UpdateMenuGroup(Models.UpdateMenuGroupDo entity)
        {
            Models.UpdateMenuGroupResultDo result = new Models.UpdateMenuGroupResultDo();

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

                string groupXml = Utils.ConvertUtil.ConvertToXml_Store <Models.MenuGroupDo>(entity.Groups);
                command.AddParameter(typeof(string), "MenuGroupXML", groupXml);

                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);
        }