Example #1
0
        public override void Insert_T_NewsChuyenDe_From_T_NewsChuyenDe(int news_id, int copyfrom, int Lang_id, int status, int nguoisua, DateTime ngaysua)
        {
            string     _sql        = "[Insert_T_NewsChuyenDe_From_T_NewsChuyenDe]";
            SqlService _sqlservice = new SqlService();

            try
            {
                _sqlservice.AddParameter("@ID", SqlDbType.Int, news_id, true);
                _sqlservice.AddParameter("@CopyFrom", SqlDbType.Int, copyfrom, true);
                _sqlservice.AddParameter("@Lang_Id", SqlDbType.Int, Lang_id, true);
                _sqlservice.AddParameter("@News_Status", SqlDbType.Int, status, true);
                _sqlservice.AddParameter("@News_EditorID", SqlDbType.Int, nguoisua, true);
                _sqlservice.AddParameter("@News_DateEdit", SqlDbType.DateTime, ngaysua, true);

                _sqlservice.ExecuteSP(_sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _sqlservice.Disconnect();
            }
        }
Example #2
0
        public override void UpdateObject(object obj)
        {
            SqlService _sqlservice = new SqlService(connectionString);
            string     sql         = "Sp_UpdateRow" + obj.GetType().Name;

            foreach (PropertyInfo propertyinfo in obj.GetType().GetProperties())
            {
                //if (propertyinfo.PropertyType.ToString() == "System.DateTime")
                //{
                //    if ((DateTime)propertyinfo.GetValue(obj, null) == DateTime.MinValue || (DateTime)propertyinfo.GetValue(obj, null) == DateTime.MaxValue)
                //        _sqlservice.AddParameter(new SqlParameter("@" + propertyinfo.Name, DBNull.Value));
                //    else
                //        _sqlservice.AddParameter(new SqlParameter("@" + propertyinfo.Name, propertyinfo.GetValue(obj, null)));
                //}
                //else
                //{
                _sqlservice.AddParameter(new SqlParameter("@" + propertyinfo.Name, propertyinfo.GetValue(obj, null)));
                // }
            }
            try
            {
                _sqlservice.ExecuteSP(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _sqlservice.Disconnect();
            }
        }
Example #3
0
        public override double ExecStoreReturn(string StoreName, string[] param1, object[] value)
        {
            string     _sql        = StoreName;
            SqlService _sqlservice = new SqlService(connectionString);

            for (int i = 0; i < param1.Length; i++)
            {
                _sqlservice.AddParameter(new SqlParameter(param1[i], value[i]));
            }
            SqlParameter paraOutput = new SqlParameter("@ReturnValue", SqlDbType.Float);

            paraOutput.Value     = 0;
            paraOutput.Direction = ParameterDirection.Output;
            _sqlservice.AddParameter(paraOutput);
            try
            {
                _sqlservice.ExecuteSP(_sql);
                return((double)paraOutput.Value);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _sqlservice.CloseConnect();
                _sqlservice.Disconnect();
            }
        }
Example #4
0
        public override void ExecStore(string StoreName)
        {
            string     _sql        = StoreName;
            SqlService _sqlservice = new SqlService(connectionString);

            _sqlservice.ExecuteSP(_sql);
            _sqlservice.Disconnect();
        }
Example #5
0
        public override int InsertObjectReturn(object obj, string spName)
        {
            SqlService _sqlservice = new SqlService(connectionString);
            string     sql         = spName;

            foreach (PropertyInfo propertyinfo in obj.GetType().GetProperties())
            {
                if (propertyinfo.PropertyType.ToString() == "System.DateTime")
                {
                    if ((DateTime)propertyinfo.GetValue(obj, null) == DateTime.MinValue || (DateTime)propertyinfo.GetValue(obj, null) == DateTime.MaxValue)
                    {
                        _sqlservice.AddParameter(new SqlParameter("@" + propertyinfo.Name, DBNull.Value));
                    }
                    else
                    {
                        _sqlservice.AddParameter(new SqlParameter("@" + propertyinfo.Name, propertyinfo.GetValue(obj, null)));
                    }
                }
                else
                {
                    _sqlservice.AddParameter(new SqlParameter("@" + propertyinfo.Name, propertyinfo.GetValue(obj, null)));
                }
            }
            SqlParameter paraOutput = new SqlParameter("@ReturnValue", SqlDbType.Int);

            paraOutput.Value     = 0;
            paraOutput.Direction = ParameterDirection.Output;
            _sqlservice.AddParameter(paraOutput);
            try
            {
                _sqlservice.ExecuteSP(sql);
                return((int)paraOutput.Value);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _sqlservice.Disconnect();
            }
        }
Example #6
0
        public override void Insert_T_Event_Category_From_T_Event_Category(int news_id)
        {
            string     _sql        = "[Insert_T_Event_Category_From_T_Event_Category]";
            SqlService _sqlservice = new SqlService();

            try
            {
                _sqlservice.AddParameter("@ID", SqlDbType.Int, news_id, true);

                _sqlservice.ExecuteSP(_sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _sqlservice.Disconnect();
            }
        }
Example #7
0
        public override void Insert_T_CategoryChuyenDe_From_T_CategoryChuyenDe(int news_id, int copyfrom)
        {
            string     _sql        = "[Insert_T_CategoryChuyenDe_From_T_CategoryChuyenDe]";
            SqlService _sqlservice = new SqlService();

            try
            {
                _sqlservice.AddParameter("@ID", SqlDbType.Int, news_id, true);
                _sqlservice.AddParameter("@CopyFrom", SqlDbType.Int, copyfrom, true);

                _sqlservice.ExecuteSP(_sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _sqlservice.Disconnect();
            }
        }
Example #8
0
        public override void Insert_T_NewsEvent_Content_From_T_NewsEvent_Content(int news_id, int _CopyFrom)
        {
            string     _sql        = "Insert_T_NewsEvent_Content_From_T_NewsEvent_Content";
            SqlService _sqlservice = new SqlService();

            try
            {
                _sqlservice.AddParameter("@ID", SqlDbType.Int, news_id, true);
                _sqlservice.AddParameter("@Copyfrom", SqlDbType.Int, _CopyFrom, true);

                _sqlservice.ExecuteSP(_sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _sqlservice.Disconnect();
            }
        }
Example #9
0
        public override void ExecStore(string StoreName, string[] param1, object[] value)
        {
            string     _sql        = StoreName;
            SqlService _sqlservice = new SqlService(connectionString);

            for (int i = 0; i < param1.Length; i++)
            {
                _sqlservice.AddParameter(new SqlParameter(param1[i], value[i]));
            }
            try
            {
                _sqlservice.ExecuteSP(_sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _sqlservice.Disconnect();
            }
        }