Beispiel #1
0
        public static Logo GetLogo(string id)
        {
            /* LogoGet
              @id varchar(32)
            */
            Logo logo = new Logo();

            SqlParameter[] prams ={
                Database.MakeInParam("@id",SqlDbType.VarChar,32,id)
            };

            SqlDataReader reader = null;

            try
            {
                reader = Database.ExecuteReader(CommandType.StoredProcedure, "LogoGet", prams);
                /*[Id],Guid, UserId, Title, Remark, Enable, [Datetime], Texts*/
                if (reader.Read())
                {
                    logo.Id = reader.GetInt32(0);
                    logo.Guid = reader.GetString(1);
                    logo.UserId = reader.GetInt32(2);
                    logo.Title = reader.GetString(3);
                    logo.Remark = reader.GetString(4);
                    logo.Enable = reader.GetString(5)=="1";
                    logo.Datetime = reader.GetDateTime(6);
                    logo.Texts = reader.GetString(7);
                }
                reader.Close();
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            return logo;
        }
Beispiel #2
0
        public static int SaveLogo(Logo logo)
        {
            /* LogoSave
                @guid char(32),
                @uid int=0,
                @title varchar(50),
                @remark varchar(500)='',
                @texts varchar(1000)='',
                @enable char(1)='1'
                        */
            SqlParameter[] prams ={
                Database.MakeReturnValueParam("@returnValue"),
                Database.MakeInParam("@guid",SqlDbType.Char,32,logo.Guid),
                Database.MakeInParam("@uid",SqlDbType.Int,logo.UserId),
                Database.MakeInParam("@title",SqlDbType.VarChar,30,logo.Title),
                Database.MakeInParam("@remark",SqlDbType.VarChar,500,logo.Remark),
                Database.MakeInParam("@texts",SqlDbType.VarChar,1000,logo.Texts),
                Database.MakeInParam("@enable",SqlDbType.Char,1,logo.Enable?"1":"0")
            };

            int newId = 0;
            try
            {
                newId = Database.ExecuteNonQuery(CommandType.StoredProcedure, "LogoSave", prams);
            }
            catch
            {
                newId = -1;
            }

            return newId;
        }
Beispiel #3
0
        private static ArrayList GetLogos(int uid, int enable, Pager pager)
        {
            ArrayList list = new ArrayList();
            /*
             LogoList
            @type char(1),
            @uid int=0,
            @industry char(6)='000000',
            @pageindex int=1,
            @pagesize int=20,
            @sort int=0
             */
            SqlParameter[] prams ={
                Database.MakeReturnValueParam("@returnValue"),
                Database.MakeInParam("@uid",SqlDbType.Int,uid),
                Database.MakeInParam("@enable",SqlDbType.Int,enable),
                Database.MakeInParam("@pageindex",SqlDbType.Int,pager.PageIndex),
                Database.MakeInParam("@pagesize",SqlDbType.Int,pager.PageSize),
                Database.MakeInParam("@sort",SqlDbType.Int,pager.SortNum)
            };

            SqlDataReader reader = null;

            try
            {
                reader = Database.ExecuteReader(CommandType.StoredProcedure, "LogoList", prams);

                if (reader.Read())
                {
                    pager.RecordCount = reader.GetInt32(0);

                    if (reader.NextResult())
                    {
                        while (reader.Read())
                        {
                            /*[Id],Guid, UserId, Title, Remark, Enable, [Datetime]*/
                            Logo logo = new Logo();
                            logo.Id = reader.GetInt32(0);
                            logo.Guid = reader.GetString(1);
                            logo.UserId = reader.GetInt32(2);
                            logo.Title = reader.GetString(3);
                            logo.Remark = reader.GetString(4);
                            logo.Enable = (reader.GetString(5)=="1");
                            logo.Datetime = reader.GetDateTime(6);
                            list.Add(logo);
                        }
                    }
                }
                reader.Close();
            }
            catch
            {
                //
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }

            return list;
        }
Beispiel #4
0
 public static int SaveLogo(string guid, int uid, string title, string remark, string texts, bool enable)
 {
     Logo logo = new Logo();
     logo.Guid = guid;
     logo.UserId = uid;
     logo.Title = title;
     logo.Remark = remark;
     logo.Texts = texts;
     logo.Enable = enable;
     return SaveLogo(logo);
 }