Exemplo n.º 1
0
        /// <summary>
        /// 이모티콘을 저장한다.
        /// </summary>
        /// <param name="model"></param>
        /// <param name="file"></param>
        /// <returns></returns>
        public static int InsertEmoticon(EmoticonModel model, HttpPostedFile file)
        {
            object description = model.Description != null ? (object)model.Description : DBNull.Value;

            SqlParameter[] param =
            {
                CreateInParam("@String",      SqlDbType.VarChar,             50, model.EmoticonString),
                CreateInParam("@Value",       SqlDbType.VarChar,            255, model.EmoticonValue),
                CreateInParam("@Description", SqlDbType.Text,    Int32.MaxValue, description),
                CreateReturnValue()
            };

            SqlCommand cmd = GetSpCommand("UBE_InsertEmoticon", param);

            try
            {
                RepositoryManager.GetInstance().SaveAs("Emoticon", file);

                cmd.ExecuteNonQuery();

                int seqNo = (int)cmd.Parameters["@ReturnValue"].Value;

                return(seqNo);
            }
            catch (Exception e)
            {
                throw new UmcDataException("UBE_InsertEmoticon 프로시져 호출중 에러", e);
            }
            finally
            {
                ReleaseCommand(cmd);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// �̸�Ƽ���� �����Ѵ�.
        /// </summary>
        /// <param name="model"></param>
        /// <param name="file"></param>
        /// <returns></returns>
        public static int InsertEmoticon(EmoticonModel model, HttpPostedFile file)
        {
            object description = model.Description != null ? (object)model.Description : DBNull.Value;

            SqlParameter[] param = {
                CreateInParam("@String",		SqlDbType.VarChar,50,				model.EmoticonString),
                CreateInParam("@Value",			SqlDbType.VarChar,255,				model.EmoticonValue),
                CreateInParam("@Description",	SqlDbType.Text, Int32.MaxValue,		description),
                CreateReturnValue()
            };

            SqlCommand cmd			= GetSpCommand("UBE_InsertEmoticon", param);

            try
            {
                RepositoryManager.GetInstance().SaveAs("Emoticon", file);

                cmd.ExecuteNonQuery();

                int seqNo			= (int)cmd.Parameters["@ReturnValue"].Value;

                return seqNo;
            }
            catch(Exception e)
            {
                throw new UmcDataException("UBE_InsertEmoticon ���ν��� ȣ���� ����",e);
            }
            finally
            {
                ReleaseCommand(cmd);
            }
        }
Exemplo n.º 3
0
        public static void UpdateEmoticon(EmoticonModel model, HttpPostedFile file)
        {
            object description = model.Description != null ? (object)model.Description : DBNull.Value;

            SqlParameter[] param =
            {
                CreateInParam("@SeqNo",        SqlDbType.Int,                   4, model.SeqNo),
                CreateInParam("@String",       SqlDbType.VarChar,              50, model.EmoticonString),
                CreateInParam("@Value",        SqlDbType.VarChar,             255, model.EmoticonValue),
                CreateInParam("@Description",  SqlDbType.Text,     Int32.MaxValue, description),
                CreateInParam("@InsertDate",   SqlDbType.DateTime,              8, (DateTime)model.InsertDate),
                CreateOutParam("@OldFileName", SqlDbType.VarChar, 255)
            };

            SqlCommand cmd = GetSpCommand("UBE_UpdateEmoticon", param);

            cmd.ExecuteNonQuery();

            if (file.FileName != string.Empty)
            {
                string filename = cmd.Parameters["@OldFileName"].Value.ToString();

                string serverPath = RepositoryManager.GetInstance().RepositoryDirectory + "\\Emoticon\\" + filename;

                if (File.Exists(serverPath))
                {
                    File.Delete(serverPath);
                }

                RepositoryManager.GetInstance().SaveAs("Emoticon", file);
            }

            ReleaseCommand(cmd);
        }
Exemplo n.º 4
0
 private static void FillEmoticon(IDataRecord row, EmoticonModel model)
 {
     model.EmoticonString = (string)row["String"];
     model.EmoticonValue  = (string)row["Value"];
     model.Description    = row["Description"] != DBNull.Value ? (string)row["Description"] : string.Empty;
     model.InsertDate     = row["InsertDate"];
 }
    private void InsertEmoticon()
    {
        EmoticonModel model		= new EmoticonModel();
        model.EmoticonString	= txtString.Text;
        model.EmoticonValue		= System.IO.Path.GetFileName(file1.FileName);
        model.Description		= txtDescription.Text;

        int seqNo = EmoticonManager.GetInstance().InsertEmoticon(model, file1.PostedFile);

        if (seqNo == -1)
        {
            lblResult.Text = string.Format("{0} 는 이미 존재합니다", model.EmoticonString);
            txtString.Text = string.Empty;
            return;
        }

        txtString.Text		= string.Empty;
        txtDescription.Text	= string.Empty;

        string img = string.Format("<img src='{0}' alt='' />",
            "/Upload/Emoticon/" + model.EmoticonValue);
        lblResult.Text = string.Format("{0} 는 {1} 로 저장되었습니다",
            model.EmoticonString,
            img);

        EmoticonManager.GetInstance().Dispose();
    }
Exemplo n.º 6
0
        /// <summary>
        /// �̸�Ƽ�� ����Ʈ�� �����´�.
        /// </summary>
        /// <returns></returns>
        public static List<EmoticonModel> GetEmoticonList()
        {
            SqlCommand cmd			= GetSpCommand("UBE_GetEmoticonList");
            SqlDataReader reader	= cmd.ExecuteReader( CommandBehavior.CloseConnection );

            List<EmoticonModel> bindModel	= new List<EmoticonModel>();

            while (reader.Read())
            {
                EmoticonModel model			= new EmoticonModel( (int)reader["SeqNo"] );
                FillEmoticon( reader, model );

                bindModel.Add( model );
                model						= null;
            }

            ReleaseCommand(cmd);

            return bindModel;
        }
Exemplo n.º 7
0
        /// <summary>
        /// �̸�Ƽ���� �����´�.
        /// </summary>
        /// <param name="seqNo"></param>
        /// <returns></returns>
        public static EmoticonModel GetEmoticonBySeqNo(int seqNo)
        {
            SqlParameter[] param	= { CreateInParam("@SeqNo", SqlDbType.Int,4,	seqNo ) };

            SqlCommand cmd			= GetSpCommand("UBE_GetEmoticonBySeqNo", param);
            SqlDataReader reader	= cmd.ExecuteReader( CommandBehavior.CloseConnection );

            EmoticonModel model		= new EmoticonModel(seqNo);

            if (reader.Read())
            {
                FillEmoticon( reader, model );
            }
            else
                return null;

            ReleaseCommand(cmd);

            return model;
        }
Exemplo n.º 8
0
        /// <summary>
        /// 이모티콘 리스트를 가져온다.
        /// </summary>
        /// <returns></returns>
        public static List <EmoticonModel> GetEmoticonList()
        {
            SqlCommand    cmd    = GetSpCommand("UBE_GetEmoticonList");
            SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);

            List <EmoticonModel> bindModel = new List <EmoticonModel>();

            while (reader.Read())
            {
                EmoticonModel model = new EmoticonModel((int)reader["SeqNo"]);
                FillEmoticon(reader, model);

                bindModel.Add(model);
                model = null;
            }

            ReleaseCommand(cmd);

            return(bindModel);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 이모티콘을 가져온다.
        /// </summary>
        /// <param name="seqNo"></param>
        /// <returns></returns>
        public static EmoticonModel GetEmoticonBySeqNo(int seqNo)
        {
            SqlParameter[] param = { CreateInParam("@SeqNo", SqlDbType.Int, 4, seqNo) };

            SqlCommand    cmd    = GetSpCommand("UBE_GetEmoticonBySeqNo", param);
            SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);

            EmoticonModel model = new EmoticonModel(seqNo);

            if (reader.Read())
            {
                FillEmoticon(reader, model);
            }
            else
            {
                return(null);
            }

            ReleaseCommand(cmd);

            return(model);
        }
Exemplo n.º 10
0
 private static void FillEmoticon( IDataRecord row, EmoticonModel model)
 {
     model.EmoticonString	= (string)row["String"];
     model.EmoticonValue		= (string)row["Value"];
     model.Description		= row["Description"] != DBNull.Value ? (string)row["Description"] : string.Empty;
     model.InsertDate		= row["InsertDate"];
 }
Exemplo n.º 11
0
        public static void UpdateEmoticon(EmoticonModel model, HttpPostedFile file)
        {
            object description = model.Description != null ? (object)model.Description : DBNull.Value;

            SqlParameter[] param = {
                CreateInParam("@SeqNo",			SqlDbType.Int,4,					model.SeqNo),
                CreateInParam("@String",		SqlDbType.VarChar,50,				model.EmoticonString),
                CreateInParam("@Value",			SqlDbType.VarChar,255,				model.EmoticonValue),
                CreateInParam("@Description",	SqlDbType.Text, Int32.MaxValue,		description),
                CreateInParam("@InsertDate",	SqlDbType.DateTime,8,	(DateTime)model.InsertDate),
                CreateOutParam("@OldFileName",	SqlDbType.VarChar,255)
            };

            SqlCommand cmd			= GetSpCommand("UBE_UpdateEmoticon", param);

            cmd.ExecuteNonQuery();

            if ( file.FileName != string.Empty)
            {
                string filename = cmd.Parameters["@OldFileName"].Value.ToString();

                string serverPath = RepositoryManager.GetInstance().RepositoryDirectory + "\\Emoticon\\" + filename;

                if (File.Exists(serverPath)) File.Delete(serverPath);

                RepositoryManager.GetInstance().SaveAs("Emoticon", file);
            }

            ReleaseCommand(cmd);
        }
Exemplo n.º 12
0
 public void UpdateEmoticon(EmoticonModel model, HttpPostedFile file)
 {
     EmoticonAccess.UpdateEmoticon( model, file );
 }
    private void initParam()
    {
        seqNo = GetParamInt(PARAM_SEQNO, -1);

        if (seqNo > 0) model = EmoticonManager.GetInstance().GetEmoticonBySeqNo(seqNo);
    }
    private void ModifyEmoticon()
    {
        EmoticonModel modifyModel	= new EmoticonModel( seqNo );
        modifyModel.EmoticonString	= txtString.Text;
        modifyModel.EmoticonValue	= file1.FileName != string.Empty ?
            System.IO.Path.GetFileName( file1.FileName ) : model.EmoticonValue;
        modifyModel.Description		= txtDescription.Text;
        modifyModel.InsertDate		= DateTime.Now;

        EmoticonManager.GetInstance().UpdateEmoticon( modifyModel, file1.PostedFile );

        string img = string.Format("<img src='{0}' alt='' />",
            "/Upload/Emoticon/" + modifyModel.EmoticonValue);
        lblResult.Text = string.Format("{0} 는 {1} 로 수정되었습니다.",
            modifyModel.EmoticonString,
            img);
    }
Exemplo n.º 15
0
 /// <summary>
 /// 이모티콘을 저장한다.
 /// </summary>
 /// <param name="model"></param>
 /// <param name="file"></param>
 /// <returns></returns>
 public int InsertEmoticon(EmoticonModel model, HttpPostedFile file)
 {
     return(EmoticonAccess.InsertEmoticon(model, file));
 }
Exemplo n.º 16
0
 public void UpdateEmoticon(EmoticonModel model, HttpPostedFile file)
 {
     EmoticonAccess.UpdateEmoticon(model, file);
 }
Exemplo n.º 17
0
 /// <summary>
 /// �̸�Ƽ���� �����Ѵ�.
 /// </summary>
 /// <param name="model"></param>
 /// <param name="file"></param>
 /// <returns></returns>
 public int InsertEmoticon(EmoticonModel model, HttpPostedFile file)
 {
     return EmoticonAccess.InsertEmoticon( model, file );
 }