Ejemplo n.º 1
0
        public String SaveGVTemplate([FromBody] API_GV_Template template)
        {
            try {
                if (template == null)
                {
                    throw new ArgumentNullException("template");
                }

                var target = new G_Template {
                    Name    = template.Name,
                    Content = template.Content
                };

                if (_gtemplateService.Exist(template.Name))
                {
                    _gtemplateService.Update(target);
                }
                else
                {
                    _gtemplateService.Add(target);
                }
            } catch (Exception exc) {
                return(exc.Message);
            }

            return(null);
        }
Ejemplo n.º 2
0
        public List <G_Template> GetEntities()
        {
            var entities = new List <G_Template>();

            using (var rdr = SqlHelper.ExecuteReader(this._databaseConnectionString, CommandType.Text, SqlCommands_Sc.Sql_G_Template_Repository_GetEntities, null)) {
                while (rdr.Read())
                {
                    var entity = new G_Template();
                    entity.Name    = SqlTypeConverter.DBNullStringHandler(rdr["Name"]);
                    entity.Content = SqlTypeConverter.DBNullStringHandler(rdr["Content"]);
                    entity.Remark  = SqlTypeConverter.DBNullStringHandler(rdr["Remark"]);
                    entities.Add(entity);
                }
            }
            return(entities);
        }
Ejemplo n.º 3
0
        public G_Template GetEntity(string name)
        {
            SqlParameter[] parms = { new SqlParameter("@Name", SqlDbType.VarChar, 200) };
            parms[0].Value = SqlTypeConverter.DBNullStringChecker(name);

            G_Template entity = null;

            using (var rdr = SqlHelper.ExecuteReader(this._databaseConnectionString, CommandType.Text, SqlCommands_Sc.Sql_G_Template_Repository_GetEntity, parms)) {
                if (rdr.Read())
                {
                    entity         = new G_Template();
                    entity.Name    = SqlTypeConverter.DBNullStringHandler(rdr["Name"]);
                    entity.Content = SqlTypeConverter.DBNullStringHandler(rdr["Content"]);
                    entity.Remark  = SqlTypeConverter.DBNullStringHandler(rdr["Remark"]);
                }
            }
            return(entity);
        }