コード例 #1
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);
     }
 }
コード例 #2
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);
     }
 }
コード例 #3
0
 //-----------------------------------------------------------------------------------------------------
 protected void m_grid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         string      commandName = e.CommandName;
         GridViewRow row         = m_grid.FooterRow;
         if (commandName == "Insert")
         {
             short DisplayOrder = 0;
             Int16.TryParse(((TextBox)row.FindControl("txtInsertDisplayOrder")).Text.Trim(), out DisplayOrder);
             m_Categories.CategoryName     = ((TextBox)row.FindControl("txtInsertCategoryName")).Text;
             m_Categories.CategoryDesc     = ((TextBox)row.FindControl("txtInsertCategoryDesc")).Text;
             m_Categories.ParentCategoryId = Int16.Parse(((DropDownList)row.FindControl("cboInsertParentCategories")).SelectedValue);
             m_Categories.Url              = ((TextBox)row.FindControl("txtInsertUrl")).Text;
             m_Categories.DisplayOrder     = DisplayOrder;
             m_Categories.CategoryStatusId = Convert.ToByte(((DropDownList)row.FindControl("ddlInsertCategoryStatus")).Text);
             m_Categories.ImageIcon        = ((TextBox)row.FindControl("txtInsertImageIcon")).Text;
             m_Categories.CrUserId         = ActUserId;
             m_Categories.CrDateTime       = System.DateTime.Now;
             if (m_Categories.InsertNoInform(LogFilePath, LogFileName, MyConstants.DISTRIBUTED_PROCESS, IpAddress, ActUserId))
             {
                 SysMessageDesc = "Đã thêm chuyên mục";
             }
             else
             {
                 SysMessageDesc = "Lỗi thêm 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);
     }
 }