//-----------------------------------------------------------------------------------------------------------------
        public bool UpdateNoInform(string LogFilePath, string LogFileName, byte DistributedProcess, string IpAddress, int ActUserId)
        {
            bool RetVal = false;

            try
            {
                if (this.ArticleContentMediaItemId > 0)
                {
                    SqlCommand cmd = new SqlCommand("ArticleContentMediaItems_UpdateNoInform");
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@DistributedProcess", DistributedProcess));
                    cmd.Parameters.Add(new SqlParameter("@IpAddress", IpAddress));
                    cmd.Parameters.Add(new SqlParameter("@ArticleContentId", this.ArticleContentId));
                    cmd.Parameters.Add(new SqlParameter("@MediaItemId", this.MediaItemId));
                    cmd.Parameters.Add(new SqlParameter("@CrUserId", ActUserId));
                    cmd.Parameters.Add(new SqlParameter("@CrDateTime", this.CrDateTime));
                    cmd.Parameters.Add(new SqlParameter("@ArticleContentMediaItemId", this.ArticleContentMediaItemId));
                    db.ExecuteSQL(cmd);
                    RetVal = true;
                }
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
Beispiel #2
0
        public void OnException(ExceptionContext filterContext)
        {
            var exception = filterContext.Exception;

            //var request = filterContext.HttpContext.Request;
            LogFiles.WriteLog(LogFiles.LogLevel.ERROR, exception, filterContext);
        }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string redirect = "";

        try
        {
            m_Categories     = new Categories(WEB_CONSTR);
            m_CategoryStatus = new CategoryStatus(WEB_CONSTR);
            IpAddress        = Request.UserHostAddress;
            ActUserId        = MyConstants.ActUserId;
            if (ActUserId > 0)
            {
                if (!IsPostBack)
                {
                    bindData(-1);
                }
            }
            else
            {
                redirect = MyConstants.PRJ_ROOT + "/Login.aspx";
            }
        }
        catch (Exception ex)
        {
            LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
        }
        if (!string.IsNullOrEmpty(redirect))
        {
            Response.Redirect(redirect);
        }
    }
        //-------------------------------------------------------------------------------------
        public bool InsertNoInform(string LogFilePath, string LogFileName, byte DistributedProcess, string IpAddress, int ActUserId)
        {
            bool RetVal = false;

            try
            {
                SqlCommand cmd = new SqlCommand("ArticleContentMediaItems_InsertNoInform");
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@DistributedProcess", DistributedProcess));
                cmd.Parameters.Add(new SqlParameter("@IpAddress", IpAddress));
                cmd.Parameters.Add(new SqlParameter("@ArticleContentId", this.ArticleContentId));
                cmd.Parameters.Add(new SqlParameter("@MediaItemId", this.MediaItemId));
                cmd.Parameters.Add(new SqlParameter("@CrUserId", ActUserId));
                cmd.Parameters.Add(new SqlParameter("@CrDateTime", this.CrDateTime));
                cmd.Parameters.Add("@ArticleContentMediaItemId", SqlDbType.Int).Direction = ParameterDirection.Output;
                db.ExecuteSQL(cmd);
                this.ArticleContentMediaItemId = Convert.ToInt32((cmd.Parameters["@ArticleContentMediaItemId"].Value == null) ? "0" : cmd.Parameters["@ArticleContentMediaItemId"].Value.ToString().Trim());
                RetVal = (this.ArticleContentMediaItemId > 0);
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
Beispiel #5
0
		//-----------------------------------------------------------------------
		public List<ImageTypes> Init(string LogFilePath, string LogFileName, SqlCommand cmd)
		{
			SqlConnection con = db.getConnection();
			cmd.Connection = con;
			con.Open();
			SqlDataReader dr = cmd.ExecuteReader();
			SmartDataReader rd = new SmartDataReader(dr);
			List<ImageTypes> l_ImageTypes = new List<ImageTypes>();
			try
			{
				while (rd.Read())
				{
					ImageTypes m_ImageTypes = new ImageTypes(db.ConnectionString);
					m_ImageTypes.ImageTypeId = rd.GetByte("ImageTypeId");
					m_ImageTypes.ImageTypeDesc = rd.GetString("ImageTypeDesc");
					m_ImageTypes.ImageTypeName = rd.GetString("ImageTypeName");
					l_ImageTypes.Add(m_ImageTypes);
				}
			}
			catch (SqlException ex)
			{
				LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
			}
			finally
			{
				rd.disposeReader(dr);
				cmd.Dispose();
				db.closeConnection(con);
			}
			return l_ImageTypes;
		}
Beispiel #6
0
        //---------------------------------------------------------------------------------------------------------
        public bool UpdateNoInform(string LogFilePath, string LogFileName, byte DistributedProcess, string IpAddress, int ActUserId)
        {
            bool RetVal = false;

            try
            {
                if (this.CategoryId > 0)
                {
                    SqlCommand cmd = new SqlCommand("Categories_UpdateNoInform");
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@DistributedProcess", DistributedProcess));
                    cmd.Parameters.Add(new SqlParameter("@IpAddress", IpAddress));
                    cmd.Parameters.Add(new SqlParameter("@DisplayOrder", this.DisplayOrder));
                    cmd.Parameters.Add(new SqlParameter("@ParentCategoryId", this.ParentCategoryId));
                    cmd.Parameters.Add(new SqlParameter("@CategoryName", this.CategoryName));
                    cmd.Parameters.Add(new SqlParameter("@CategoryDesc", this.CategoryDesc));
                    cmd.Parameters.Add(new SqlParameter("@Url", this.Url));
                    cmd.Parameters.Add(new SqlParameter("@CategoryStatusId", this.CategoryStatusId));
                    cmd.Parameters.Add(new SqlParameter("@ImageIcon", this.ImageIcon));
                    cmd.Parameters.Add(new SqlParameter("@CrUserId", ActUserId));
                    cmd.Parameters.Add(new SqlParameter("@CrDateTime", this.CrDateTime));
                    cmd.Parameters.Add(new SqlParameter("@CategoryId", this.CategoryId));
                    db.ExecuteSQL(cmd);
                    RetVal = true;
                }
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
Beispiel #7
0
        //-------------------------------------------------------------------------------------------------------------------
        private List <ImageMediaItems> Init(string LogFilePath, string LogFileName, SqlCommand cmd)
        {
            SqlConnection con = db.getConnection();

            cmd.Connection = con;
            List <ImageMediaItems> l_ImageMediaItems = new List <ImageMediaItems>();

            try
            {
                con.Open();
                SqlDataReader   reader      = cmd.ExecuteReader();
                SmartDataReader smartReader = new SmartDataReader(reader);
                while (smartReader.Read())
                {
                    ImageMediaItems m_ImageMediaItems = new ImageMediaItems(db.ConnectionString);
                    m_ImageMediaItems.ImageMediaItemId = smartReader.GetInt32("ImageMediaItemId");
                    m_ImageMediaItems.ImageId          = smartReader.GetInt32("ImageId");
                    m_ImageMediaItems.MediaItemId      = smartReader.GetInt32("MediaItemId");
                    m_ImageMediaItems.CrUserId         = smartReader.GetInt32("CrUserId");
                    m_ImageMediaItems.CrDateTime       = smartReader.GetDateTime("CrDateTime");
                    l_ImageMediaItems.Add(m_ImageMediaItems);
                }
                smartReader.disposeReader(reader);
                db.closeConnection(con);
            }
            catch (SqlException ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(l_ImageMediaItems);
        }
        //----------------------------------------------------------
        private List <Aligns> Init(string LogFilePath, string LogFileName, SqlCommand cmd)
        {
            List <Aligns> AlignList = new List <Aligns>();
            SqlConnection con       = db.getConnection();

            cmd.Connection = con;
            try
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                SqlDataReader   reader      = cmd.ExecuteReader();
                SmartDataReader smartReader = new SmartDataReader(reader);
                while (smartReader.Read())
                {
                    Aligns m_Aligns = new Aligns(db.ConnectionString);
                    m_Aligns.AlignId   = smartReader.GetByte("AlignId");
                    m_Aligns.AlignName = smartReader.GetString("AlignName");
                    m_Aligns.AlignDesc = smartReader.GetString("AlignDesc");
                    AlignList.Add(m_Aligns);
                }
                smartReader.DisposeReader(reader);
            }
            catch (SqlException ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            finally
            {
                con.Close();
            }
            return(AlignList);
        }
Beispiel #9
0
        //-------------------------------------------------------------------------------------
        public bool InsertNoInform(string LogFilePath, string LogFileName, byte DistributedProcess, string IpAddress, int ActUserId)
        {
            bool RetVal = false;

            try
            {
                SqlCommand cmd = new SqlCommand("Categories_InsertNoInform");
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@DistributedProcess", DistributedProcess));
                cmd.Parameters.Add(new SqlParameter("@IpAddress", IpAddress));
                cmd.Parameters.Add(new SqlParameter("@DisplayOrder", this.DisplayOrder));
                cmd.Parameters.Add(new SqlParameter("@ParentCategoryId", this.ParentCategoryId));
                cmd.Parameters.Add(new SqlParameter("@CategoryName", this.CategoryName));
                cmd.Parameters.Add(new SqlParameter("@CategoryDesc", this.CategoryDesc));
                cmd.Parameters.Add(new SqlParameter("@Url", this.Url));
                cmd.Parameters.Add(new SqlParameter("@CategoryStatusId", this.CategoryStatusId));
                cmd.Parameters.Add(new SqlParameter("@ImageIcon", this.ImageIcon));
                cmd.Parameters.Add(new SqlParameter("@CrUserId", ActUserId));
                cmd.Parameters.Add(new SqlParameter("@CrDateTime", this.CrDateTime));
                cmd.Parameters.Add("@CategoryId", SqlDbType.SmallInt).Direction = ParameterDirection.Output;
                db.ExecuteSQL(cmd);
                this.CategoryId = Convert.ToInt16((cmd.Parameters["@CategoryId"].Value == null) ? "0" : cmd.Parameters["@CategoryId"].Value.ToString().Trim());
                RetVal          = (this.CategoryId > 0);
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
        //-----------------------------------------------------------------------
        private List <CategoryStatus> Init(string LogFilePath, string LogFileName, SqlCommand cmd)
        {
            SqlConnection con = db.getConnection();

            cmd.Connection = con;
            List <CategoryStatus> l_CategoryStatus = new List <CategoryStatus>();

            try
            {
                con.Open();
                SqlDataReader   reader      = cmd.ExecuteReader();
                SmartDataReader smartReader = new SmartDataReader(reader);
                while (smartReader.Read())
                {
                    CategoryStatus m_CategoryStatus = new CategoryStatus(db.ConnectionString);
                    m_CategoryStatus.CategoryStatusId   = smartReader.GetByte("CategoryStatusId");
                    m_CategoryStatus.CategoryStatusName = smartReader.GetString("CategoryStatusName");
                    m_CategoryStatus.CategoryStatusDesc = smartReader.GetString("CategoryStatusDesc");
                    l_CategoryStatus.Add(m_CategoryStatus);
                }
                smartReader.disposeReader(reader);
                db.closeConnection(con);
            }
            catch (SqlException ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(l_CategoryStatus);
        }
        //-----------------------------------------------------------------------
        public List <CategoryStatus> GetList(string LogFilePath, string LogFileName, string Conditions, string OrderBy)
        {
            List <CategoryStatus> RetVal = new List <CategoryStatus>();

            try
            {
                string Sql = "SELECT * FROM V$CategoryStatus";
                if (!string.IsNullOrEmpty(Conditions))
                {
                    Sql += " WHERE " + Conditions;
                }
                if (!string.IsNullOrEmpty(OrderBy))
                {
                    Sql += " ORDER BY " + OrderBy;
                }
                SqlCommand cmd = new SqlCommand(Sql);
                cmd.CommandType = CommandType.Text;
                RetVal          = Init(LogFilePath, LogFileName, cmd);
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
        //--------------------------------------------------------------------
        public List <ArticleContents> GetList(string LogFilePath, string LogFileName, int RowAmount, string Conditions, string OrderBy)
        {
            List <ArticleContents> RetVal = new List <ArticleContents>();

            try
            {
                string Sql = "SELECT ";
                if (RowAmount > 0)
                {
                    Sql += " TOP (" + RowAmount.ToString() + ")";
                }
                Sql += " * FROM V$ArticleContents";
                if (!string.IsNullOrEmpty(Conditions))
                {
                    Sql += " WHERE " + Conditions;
                }
                if (!string.IsNullOrEmpty(OrderBy))
                {
                    Sql += " ORDER BY " + OrderBy;
                }
                SqlCommand cmd = new SqlCommand(Sql);
                cmd.CommandType = CommandType.Text;
                RetVal          = Init(LogFilePath, LogFileName, cmd);
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
Beispiel #13
0
 //--------------------------------------------------------------------------------------------
 protected void m_grid_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         short delId = (Int16)m_grid.DataKeys[e.RowIndex].Value;
         if (delId > 0)
         {
             m_Categories.CategoryId = delId;
             m_Categories.CrUserId   = ActUserId;
             m_Categories.CrDateTime = System.DateTime.Now;
             if (m_Categories.DeleteNoInform(LogFilePath, LogFileName, MyConstants.DISTRIBUTED_PROCESS, IpAddress, ActUserId))
             {
                 SysMessageDesc = "Đã xoá chuyên mục";
             }
             else
             {
                 SysMessageDesc = "Lỗi xoá chuyên mục";
             }
             JSAlert.Alert(SysMessageDesc, this);
             bindData(-1);
         }
     }
     catch (Exception ex)
     {
         LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
     }
 }
        //-------------------------------------------------------------------------------------
        public bool InsertNoInform(string LogFilePath, string LogFileName, byte DistributedProcess, string IpAddress, int ActUserId)
        {
            bool RetVal = false;

            try
            {
                SqlCommand cmd = new SqlCommand("Images_InsertNoInform");
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@DistributedProcess", DistributedProcess));
                cmd.Parameters.Add(new SqlParameter("@IpAddress", IpAddress));
                cmd.Parameters.Add(new SqlParameter("@ImagePath", this.ImagePath));
                cmd.Parameters.Add(new SqlParameter("@ImageFileName", this.ImageFileName));
                cmd.Parameters.Add(new SqlParameter("@ImageFileSize", this.ImageFileSize));
                cmd.Parameters.Add(new SqlParameter("@ImageHeight", this.ImageHeight));
                cmd.Parameters.Add(new SqlParameter("@ImageWidth", this.ImageWidth));
                cmd.Parameters.Add(new SqlParameter("@ImageDesc", this.ImageDesc));
                cmd.Parameters.Add(new SqlParameter("@AlignId", this.AlignId));
                cmd.Parameters.Add(new SqlParameter("@ImageTypeId", this.ImageTypeId));
                cmd.Parameters.Add(new SqlParameter("@CrUserId", ActUserId));
                cmd.Parameters.Add(new SqlParameter("@CrDateTime", this.CrDateTime));
                cmd.Parameters.Add("@ImageId", SqlDbType.Int).Direction = ParameterDirection.Output;
                db.ExecuteSQL(cmd);
                this.ImageId = (cmd.Parameters["@ImageId"].Value == null) ? 0 : Convert.ToInt32(cmd.Parameters["@ImageId"].Value);
                RetVal       = (this.ImageId > 0);
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
Beispiel #15
0
		//-----------------------------------------------------------------------
		public static List<ImageTypes> Static_GetList(string LogFilePath, string LogFileName, string constr)
		{
			List<ImageTypes> RetVal = new List<ImageTypes>();
			ImageTypes m_ImageTypes = new ImageTypes(constr);
			try
			{
				RetVal = m_ImageTypes.GetList(LogFilePath, LogFileName);
			}
			catch (Exception ex)
			{
				LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + m_ImageTypes.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
			}
			return RetVal;
		}
Beispiel #16
0
        //--------------------------------------------------------------------------------------------------------------------
        public string GetLink(string LogFilePath, string LogFileName, string ROOT_PATH, string FILE_EXTEND, string TitleName, string SubjectName, int SubjectId, byte SubjectTypeId, int MediaItemId)
        {
            string RetVal = "";

            try
            {
                RetVal = ROOT_PATH + StringUtils.TitleFormat(TitleName) + "/" + StringUtils.TitleFormat(SubjectName) + "-" + MediaItemId.ToString() + "." + FILE_EXTEND;
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
Beispiel #17
0
 protected void m_grid_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     try
     {
         short DisplayOrder = 0;
         short ParentCategoryId;
         int   id = e.RowIndex;
         m_grid.EditIndex = id;
         GridViewRow row      = m_grid.Rows[id];
         short       updateId = 0;
         Int16.TryParse(m_grid.DataKeys[id].Value.ToString(), out updateId);
         Int16.TryParse(((DropDownList)row.FindControl("cboParentCategories")).SelectedValue, out ParentCategoryId);
         m_Categories = m_Categories.Get(LogFilePath, LogFileName, updateId);
         if (m_Categories.CategoryId > 0)
         {
             Int16.TryParse(((TextBox)row.FindControl("txtDisplayOrder")).Text.Trim(), out DisplayOrder);
             if (DisplayOrder > 0)
             {
                 m_Categories.DisplayOrder = DisplayOrder;
             }
             m_Categories.CategoryName     = ((TextBox)row.FindControl("txtCategoryName")).Text;
             m_Categories.CategoryDesc     = ((TextBox)row.FindControl("txtCategoryDesc")).Text;
             m_Categories.ParentCategoryId = ParentCategoryId;
             m_Categories.Url = ((TextBox)row.FindControl("txtUrl")).Text.Trim();
             m_Categories.CategoryStatusId = Convert.ToByte(((DropDownList)row.FindControl("ddlCategoryStatus")).Text);
             m_Categories.ImageIcon        = ((TextBox)row.FindControl("txtImageIcon")).Text;
             m_Categories.CrUserId         = ActUserId;
             m_Categories.CrDateTime       = System.DateTime.Now;
             if (m_Categories.UpdateNoInform(LogFilePath, LogFileName, MyConstants.DISTRIBUTED_PROCESS, IpAddress, ActUserId))
             {
                 SysMessageDesc = "Đã cập nhật chuyên mục";
             }
             else
             {
                 SysMessageDesc = "Lỗi cập nhật chuyên mục";
             }
         }
         else
         {
             SysMessageDesc = "Không tìm thấy chuyên mục";
         }
         JSAlert.Alert(SysMessageDesc, this);
         bindData(-1);
     }
     catch (Exception ex)
     {
         LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
     }
 }
Beispiel #18
0
		//-----------------------------------------------------------------------
		public ImageTypes Get(string LogFilePath, string LogFileName, string ImageTypeName)
		{
			ImageTypes RetVal = new ImageTypes(db.ConnectionString);
			try
			{
				List<ImageTypes> list = GetListByImageTypeName(LogFilePath, LogFileName, ImageTypeName);
				if (list.Count > 0)
				{
					RetVal = (ImageTypes)list[0];
				}
			}
			catch (Exception ex)
			{
				LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
			}
			return RetVal;
		}
        //-----------------------------------------------------------------------
        public CategoryStatus Get(string LogFilePath, string LogFileName, byte CategoryStatusId)
        {
            CategoryStatus RetVal = new CategoryStatus(db.ConnectionString);

            try
            {
                List <CategoryStatus> list = GetListByCategoryStatusId(LogFilePath, LogFileName, CategoryStatusId);
                if (list.Count > 0)
                {
                    RetVal = (CategoryStatus)list[0];
                }
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
Beispiel #20
0
        //--------------------------------------------------------------------------------------------------------------------
        public Articles Get(string LogFilePath, string LogFileName, int ArticleId)
        {
            Articles RetVal = new Articles(db.ConnectionString);

            try
            {
                List <Articles> list = GetListByArticleId(LogFilePath, LogFileName, ArticleId);
                if (list.Count > 0)
                {
                    RetVal = (Articles)list[0];
                }
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
Beispiel #21
0
        //-------------------------------------------------------------------------------------------------------------------------------
        public string GetArticleLink(string LogFilePath, string LogFileName, string ROOT_PATH, string FILE_EXTEND, string CategoryName)
        {
            string RetVal = "";

            try
            {
                if (string.IsNullOrEmpty(CategoryName))
                {
                    CategoryName = Categories.Static_GetName(LogFilePath, LogFileName, db.ConnectionString, this.CategoryId);
                }
                RetVal = ROOT_PATH + ((string.IsNullOrEmpty(CategoryName)) ? "Unknown" : StringUtils.TitleFormat(CategoryName)) + "/" + StringUtils.TitleFormat(this.ArticleTitle) + "-" + this.ArticleId + "." + FILE_EXTEND;
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        string redirect = "";

        try
        {
            UserPass  = (Session["UserPass"] == null) ? "" : Session["UserPass"].ToString();
            IpAddress = Request.UserHostAddress.ToString();
        }
        catch (Exception ex)
        {
            LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
        }
        if (!string.IsNullOrEmpty(redirect))
        {
            Response.Redirect(redirect);
        }
    }
Beispiel #23
0
        //--------------------------------------------------------------------------------------------------------------------
        public ImageMediaItems GetByMediaItemId(string LogFilePath, string LogFileName, int MediaItemId)
        {
            ImageMediaItems RetVal = new ImageMediaItems(db.ConnectionString);

            try
            {
                List <ImageMediaItems> list = GetListByMediaItemId(LogFilePath, LogFileName, MediaItemId);
                if (list.Count > 0)
                {
                    RetVal = (ImageMediaItems)list[0];
                }
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
Beispiel #24
0
		//-----------------------------------------------------------------------
		public static byte Static_GetIdByImageTypeName(string LogFilePath, string LogFileName, string constr, string ImageTypeName)
		{
			byte RetVal = 0;
			ImageTypes m_ImageTypes = new ImageTypes(constr);
			try
			{
				m_ImageTypes = m_ImageTypes.Get(LogFilePath, LogFileName, ImageTypeName);
				if (m_ImageTypes.ImageTypeId > 0)
				{
					RetVal = m_ImageTypes.ImageTypeId;
				}
			}
			catch (Exception ex)
			{
				LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + m_ImageTypes.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
			}
			return RetVal;
		}
        //-------------------------------------------------------------------------------------------------------------------------------
        public string GetArticleLink(string LogFilePath, string LogFileName, string ROOT_PATH, string FILE_EXTEND, string CategoryName)
        {
            string RetVal = "";

            try
            {
                Articles m_Articles = new Articles(this.db.ConnectionString);
                m_Articles = m_Articles.Get(LogFilePath, LogFileName, this.ArticleId);
                if (m_Articles.ArticleId > 0)
                {
                    RetVal = m_Articles.GetArticleLink(LogFilePath, LogFileName, ROOT_PATH, FILE_EXTEND, CategoryName);
                }
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
        //-----------------------------------------------------------------------
        public static string Static_GetName(string LogFilePath, string LogFileName, string constr, byte AllignId)
        {
            string RetVal   = "";
            Aligns m_Aligns = new Aligns(constr);

            try
            {
                m_Aligns = m_Aligns.Get(LogFilePath, LogFileName, AllignId);
                if (!string.IsNullOrEmpty(m_Aligns.AlignName))
                {
                    RetVal = m_Aligns.AlignName;
                }
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + m_Aligns.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
Beispiel #27
0
        //----------------------------------------------------------------------------
        public static string Static_GetName(string LogFilePath, string LogFileName, string constr, short CategoryId)
        {
            string     RetVal       = "";
            Categories m_Categories = new Categories(constr);

            try
            {
                m_Categories = m_Categories.Get(LogFilePath, LogFileName, CategoryId);
                if (!string.IsNullOrEmpty(m_Categories.CategoryName))
                {
                    RetVal = m_Categories.CategoryName.Trim();
                }
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + m_Categories.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
Beispiel #28
0
 //-------------------------------------------------------------------------------------------------
 private void bindData(int index)
 {
     try
     {
         List <Categories> l_Categories = m_Categories.GetList(LogFilePath, LogFileName, ActUserId);
         cboParentCategories = m_Categories.CopyNA(l_Categories);
         cboCategoryStatus   = m_CategoryStatus.GetList(LogFilePath, LogFileName);
         m_grid.EditIndex    = index;
         bool NoRecord = (l_Categories.Count <= 0);
         if (NoRecord)
         {
             l_Categories.Add(new Categories(WEB_CONSTR));
         }
         m_grid.DataSource = l_Categories;
         m_grid.DataBind();
         if (m_grid.Rows.Count > 0)
         {
             if (NoRecord)
             {
                 m_grid.Rows[0].Enabled = false;
             }
             else
             {
                 GridViewRow row;
                 LinkButton  lbutton;
                 string      confirm = "return confirm('Bạn thực sự muốn xóa chuyên mục này?')";
                 for (int i = 0; i < m_grid.Rows.Count; i++)
                 {
                     row     = m_grid.Rows[i];
                     lbutton = (LinkButton)row.FindControl("cmdDelete");
                     if (lbutton != null)
                     {
                         lbutton.Attributes.Add("onclick", confirm);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
     }
 }
Beispiel #29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             m_login.Focus();
             if (Request.Cookies["myCookie"] != null)
             {
                 HttpCookie icookie = Request.Cookies.Get("myCookie");
                 m_login.UserName = icookie.Values["uname"].ToString();
             }
         }
     }
     catch (Exception ex)
     {
         LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
     }
 }
Beispiel #30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string name = "Loi";
            int    age  = 18;
            Person p    = new Student(name, age);
            res = p.render();
            int z = 0;
            int a = 1 / z;
        }
        catch (Exception ex)
        {
            string fileName = this.GetType().Name + MethodBase.GetCurrentMethod().Name;
            LogFiles.WriteLog(ex.Message, _Default.pathServer, fileName);
        }

        Debug.WriteLine("--------" + pathServer);
    }