Exemplo n.º 1
0
    protected void dgvSubCategory_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (!string.IsNullOrEmpty(e.CommandArgument.ToString()))
        {
            objCommon = new clsCommon();
            if (e.CommandName == "Edit")
            {
                hdnSubCategoryId.Value = e.CommandArgument.ToString();
                SetSubCategoryValuesToControls();
            }
            else if (e.CommandName == "Up")
            {
                LinkButton  inkButton = (LinkButton)e.CommandSource;
                GridViewRow drCurrent = (GridViewRow)inkButton.Parent.Parent;
                if (drCurrent.RowIndex > 0)
                {
                    GridViewRow drUp = dgvSubCategory.Rows[drCurrent.RowIndex - 1];
                    objCommon.SetDisplayOrder("tblPropertySubCategory", tblPropertySubCategory.ColumnNames.AppPropertySubCategoryID, tblPropertySubCategory.ColumnNames.AppDisplayOrder, (int)dgvSubCategory.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvSubCategory.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvSubCategory.DataKeys[drUp.RowIndex].Values[0], (int)dgvSubCategory.DataKeys[drUp.RowIndex].Values[1]);
                    LoadSubCategoryData(false, false);
                    objCommon = null;
                }
            }
            else if (e.CommandName == "Down")
            {
                LinkButton  lnkButton = (LinkButton)e.CommandSource;
                GridViewRow drCurrent = (GridViewRow)lnkButton.Parent.Parent;
                if (drCurrent.RowIndex < dgvSubCategory.Rows.Count - 1)
                {
                    GridViewRow drUp = dgvSubCategory.Rows[drCurrent.RowIndex + 1];
                    objCommon.SetDisplayOrder("tblPropertySubCategory", tblPropertySubCategory.ColumnNames.AppPropertySubCategoryID, tblPropertySubCategory.ColumnNames.AppDisplayOrder, (int)dgvSubCategory.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvSubCategory.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvSubCategory.DataKeys[drUp.RowIndex].Values[0], (int)dgvSubCategory.DataKeys[drUp.RowIndex].Values[1]);
                    LoadSubCategoryData(false, false);
                    objCommon = null;
                }
            }
            else if (e.CommandName == "IsActive")
            {
                objPropertySubCategory = new tblPropertySubCategory();

                if (objPropertySubCategory.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())))
                {
                    if (objPropertySubCategory.AppIsActive == true)
                    {
                        objPropertySubCategory.AppIsActive = false;
                    }
                    else if (objPropertySubCategory.AppIsActive == false)
                    {
                        objPropertySubCategory.AppIsActive = true;
                    }
                    objPropertySubCategory.Save();
                    LoadSubCategoryData(false, false);
                }
                objPropertySubCategory = null;
            }
        }
    }
Exemplo n.º 2
0
 private void SetSubCategoryValuesToControls()
 {
     if (!string.IsNullOrEmpty(hdnSubCategoryId.Value) && hdnSubCategoryId.Value != "")
     {
         objPropertySubCategory = new tblPropertySubCategory();
         if (objPropertySubCategory.LoadByPrimaryKey(Convert.ToInt32(hdnSubCategoryId.Value)))
         {
             tblSubCategory objTemp = new tblSubCategory();
             if (objTemp.LoadByPrimaryKey(objPropertySubCategory.AppSubCategoryID))
             {
                 ddlCategory.SelectedValue = objTemp.s_AppCategoryID;
                 objCommon = new clsCommon();
                 objCommon = null;
             }
             objTemp = null;
         }
         objPropertySubCategory = null;
     }
 }