コード例 #1
0
    /// <summary>
    /// name:         DeleteCategory
    /// description:  Method is passed category ID then proceeds to delete the category   
    /// </summary>
    protected void DeleteCategory(string parCategoryCode)
    {
        int recordToDelete = Convert.ToInt32(parCategoryCode);

        DA_POI_Category categoryObject = new DA_POI_Category();
        categoryObject.DeleteCategory(recordToDelete);
    }
コード例 #2
0
    /// <summary>
    /// This method saves all tours as a JSON file.
    /// It calls the appropriate methods and then writes the output string to a file.
    /// </summary>
    public void SaveJSONCategoriesAsFile()
    {
        //Instantiate and Fill a DataTable object with test data

        DA_POI_Category tourDataObject      = new DA_POI_Category();
        DataTable       tourDataTableObject = tourDataObject.GetAllCategories();

        /*Instantiate Method to retrieve the data from the filled DataTable object
         * and concatenates it into a JSON-formatted string*/

        JSON_Utils utils          = new JSON_Utils();
        string     tourJsonString = utils.CovertCategoryDataTableToJSON(tourDataTableObject);
        string     pathToJSONFile;

        //Set path and filename for saved JSON file(NOTE: This is used when using a Data_Categories file to hold Category_.js files...
        //Claws at this time will not allow admin to be run with this extra layer)
        //pathToJSONFile = currentContext.Server.MapPath("../Data_Categories/ListOfCategories.js");

        //Set path and filename for saved JSON file
        pathToJSONFile = currentContext.Server.MapPath("../ListOfCategories.js");

        //Create StreamWriter object
        StreamWriter StreamWriter = new StreamWriter(pathToJSONFile);

        //Writing JSON string to the file.
        StreamWriter.Write(tourJsonString);

        ////Close the file.
        StreamWriter.Close();
    }
コード例 #3
0
    /// <summary>
    /// name:         DeleteCategory
    /// description:  Method is passed category ID then proceeds to delete the category
    /// </summary>
    protected void DeleteCategory(string parCategoryCode)
    {
        int recordToDelete = Convert.ToInt32(parCategoryCode);

        DA_POI_Category categoryObject = new DA_POI_Category();

        categoryObject.DeleteCategory(recordToDelete);
    }
コード例 #4
0
    /// <summary>
    /// Need to fill the drop down...
    /// Jason Eades
    /// </summary>
    private void FillDropDown()
    {
        DA_POI_Category DAObject = new DA_POI_Category();

        ddlCategory.DataSource     = DAObject.GetAllCategories();
        ddlCategory.DataTextField  = "Category_Name";
        ddlCategory.DataValueField = "Category_Code";
        ddlCategory.DataBind();
    }
    /// <summary>
    /// name:         BindGridData
    /// description:  retrieves category information from database and binds it to gridview   
    /// </summary>
    public void BindGridData()
    {
        DA_POI_Category inventoryDAObject = new DA_POI_Category();
        grdvCategories.DataSource = inventoryDAObject.GetAllCategories();
        grdvCategories.DataBind();
        grdvCategories.PagerSettings.Mode = PagerButtons.Numeric;

        //Hides the Uncategorized cateogry so it cannot be deleted
        grdvCategories.Rows[0].Visible = true;
    }
    /// <summary>
    /// name:         butAdd_Click
    /// description:  button click method that adds the new category to the database   
    /// </summary>
    protected void butAdd_Click(object sender, EventArgs e)
    {
        string categoryName = Convert.ToString(txtCategoryName.Text);
        string categoryDesc = Convert.ToString(txtCategoryDesc.Text);

        DA_POI_Category inventoryObject = new DA_POI_Category();
        inventoryObject.AddCategory(categoryName, categoryDesc);

        this.BindGridData();
    }
コード例 #7
0
    /// <summary>
    /// name:         butAdd_Click
    /// description:  button click method that adds the new category to the database
    /// </summary>
    protected void butAdd_Click(object sender, EventArgs e)
    {
        string categoryName = Convert.ToString(txtCategoryName.Text);

        DA_POI_Category inventoryObject = new DA_POI_Category();

        inventoryObject.AddCategory(categoryName);

        this.BindGridData();
    }
    /// <summary>
    /// name:         butDeletePOI_Click
    /// description:  button click method that is used when a POI is deleted
    ///               displays blanks in all text boxes and verifies to the user that the POI has been deleted
    /// </summary>
    protected void butDeletePOI_Click(object sender, EventArgs e)
    {
        int recordToDelete = Convert.ToInt32(Request.QueryString["qryID"]);

        DA_POI_Category categoryObject = new DA_POI_Category();
        categoryObject.DeleteCategory(recordToDelete);

        txtCategoryName.Text = "Category Deleted!";
        lblCategoryCode.Text = "";
    }
コード例 #9
0
    /// <summary>
    /// name:         BindGridData
    /// description:  retrieves category information from database and binds it to gridview
    /// </summary>
    public void BindGridData()
    {
        DA_POI_Category inventoryDAObject = new DA_POI_Category();

        grdvCategories.DataSource = inventoryDAObject.GetAllCategories();
        grdvCategories.DataBind();
        grdvCategories.PagerSettings.Mode = PagerButtons.Numeric;

        //Hides the Uncategorized cateogry so it cannot be deleted
        grdvCategories.Rows[0].Visible = false;
    }
コード例 #10
0
    /// <summary>
    /// name:         butDeletePOI_Click
    /// description:  button click method that is used when a POI is delete
    ///               displays blanks in all text boxes and verifies to the user that the POI has been deleted
    /// </summary>
    protected void butDeletePOI_Click(object sender, EventArgs e)
    {
        int recordToDelete = Convert.ToInt32(Request.QueryString["qryID"]);

        DA_POI_Category categoryObject = new DA_POI_Category();

        categoryObject.DeleteCategory(recordToDelete);

        txtCategoryName.Text = "Category Deleted!";
        lblCategoryCode.Text = "";
    }
コード例 #11
0
    /// <summary>
    /// This method FillDropDown() will fill the dropdown list with the available categories.  When a user is
    /// adding a New POI, they will now have to choose a category for that POI.
    /// By. Jason Eades
    /// </summary>
    private void FillDropDown()
    {
        //Bind the drop down list to the categories table in the database
        DA_POI_Category poiDAObject = new DA_POI_Category();

        ddlCategory.DataSource    = poiDAObject.GetAllCategories();
        ddlCategory.DataTextField = "Category_Name";
        Trace.Warn("DataTextField = " + ddlCategory.DataTextField);
        ddlCategory.DataValueField = "Category_Code";
        Trace.Warn("DataValueField = " + ddlCategory.DataValueField);
        ddlCategory.DataBind();

        ddlCategory.Items.Insert(0, new ListItem("----"));
        ddlCategory.SelectedIndex = 0;
    }
コード例 #12
0
    /// <summary>
    /// name:         DisplayRecord
    /// description:  method to display initial data on page load when modifying a POI
    /// </summary>
    private void DisplayRecord()
    {
        //Assign the label the qryID which will be the Category_Code of the Category
        string locationID = (Request.QueryString["qryID"]);
        lblCategoryCode.Text = locationID.ToString();

        //Get Category where Category_Code equals previous "locationID"
        DA_POI_Category inventoryObject = new DA_POI_Category();
        DataRow dataRowObject = inventoryObject.GetCategoryByCategoryCode(locationID);

        //Assign the field values of the DataRow object to variables
        string categoryName = Convert.ToString(dataRowObject["Category_Name"]);
        txtCategoryName.Text = categoryName.ToString();

    }
コード例 #13
0
    /// <summary>
    /// name:         delBTN_Click
    /// description:  generates the modal popup for handling category deletion   
    /// </summary>
    protected void delBTN_Click(object sender, ImageClickEventArgs e)
    {
        ImageButton btndetails = sender as ImageButton;
        GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer;

        DA_POI_Category categoryDAObject = new DA_POI_Category();
        DataRow dataRowObject = categoryDAObject.GetCategoryByCategoryCode(gvrow.Cells[0].Text);

        string ID = Convert.ToString(dataRowObject["Category_Code"]);
        string title = Convert.ToString(dataRowObject["Category_Name"]);

        lblID.Text = ID;
        lblTitle.Text = title;
        this.ModalPopupExtender1.Show();
    }
    /// <summary>
    /// name:         butUpdate_Click
    /// description:  button click method that is used to initiate updating the category
    /// </summary>
    protected void butUpdate_Click(object sender, EventArgs e)
    {
        //Get ID value
        string locationID = lblCategoryCode.Text;

        //Declare Variables
        string categoryName = Convert.ToString(txtCategoryName.Text);
        string categoryDesc = Convert.ToString(txtCategoryDesc.Text);

        //Pass in categoryName from txtBox and locationID from lbl
        DA_POI_Category categoryObject = new DA_POI_Category();
        categoryObject.UpdateCategory(categoryName, categoryDesc, locationID);

        lblDisplay.Text = "The Category information has been saved.";
    }
コード例 #15
0
    /// <summary>
    /// name:         delBTN_Click
    /// description:  generates the modal popup for handling category deletion
    /// </summary>
    protected void delBTN_Click(object sender, ImageClickEventArgs e)
    {
        ImageButton btndetails = sender as ImageButton;
        GridViewRow gvrow      = (GridViewRow)btndetails.NamingContainer;

        DA_POI_Category categoryDAObject = new DA_POI_Category();
        DataRow         dataRowObject    = categoryDAObject.GetCategoryByCategoryCode(gvrow.Cells[0].Text);

        string ID    = Convert.ToString(dataRowObject["Category_Code"]);
        string title = Convert.ToString(dataRowObject["Category_Name"]);

        lblID.Text    = ID;
        lblTitle.Text = title;
        this.ModalPopupExtender1.Show();
    }
コード例 #16
0
    /// <summary>
    /// name:         butUpdate_Click
    /// description:  button click method that is used to initiate updating the category
    /// </summary>
    protected void butUpdate_Click(object sender, EventArgs e)
    {
        //Get ID value
        string locationID = lblCategoryCode.Text;

        //Declare Variables
        string categoryName = Convert.ToString(txtCategoryName.Text);

        //Pass in categoryName from txtBox and locationID from lbl
        DA_POI_Category categoryObject = new DA_POI_Category();

        categoryObject.UpdateCategory(categoryName, locationID);

        lblDisplay.Text = "The Category information has been saved.";
    }
コード例 #17
0
    /// <summary>
    /// name:         DisplayRecord
    /// description:  method to display initial data on page load when modifying a POI
    /// </summary>
    private void DisplayRecord()
    {
        //Assign the label the qryID which will be the Category_Code of the Category
        string locationID = (Request.QueryString["qryID"]);

        lblCategoryCode.Text = locationID.ToString();

        //Get Category where Category_Code equals previous "locationID"
        DA_POI_Category inventoryObject = new DA_POI_Category();
        DataRow         dataRowObject   = inventoryObject.GetCategoryByCategoryCode(locationID);

        //Assign the field values of the DataRow object to variables
        string categoryName = Convert.ToString(dataRowObject["Category_Name"]);

        txtCategoryName.Text = categoryName.ToString();
    }
コード例 #18
0
    public void SaveJSONCategoriesAndLocationsAsFile()
    {
        //Instantiate and Fill a DataTable object with Category data

        DA_POI_Category tourDataObject      = new DA_POI_Category();
        DataTable       tourDataTableObject = tourDataObject.GetAllCategories();

        foreach (DataRow row in tourDataTableObject.Rows)
        {
            string tourID        = Convert.ToString(row["Category_Code"]);
            bool   checkIsActive = true;

            /*Instantiate Method to retrieve the data from the filled DataTable object
             * and concatenates it into a JSON-formatted string*/

            JSON_Utils utils          = new JSON_Utils();
            string     tourJsonString = JSON_Utils.CovertCategoryPOIDataTableToJSON(tourID, tourDataTableObject, checkIsActive);
            string     pathToJSONFile;

            //Set path and filename for saved JSON file (NOTE: This is used when using a Data_Categories file to hold Category_.js files...
            //Claws at this time will not allow admin to be run with this extra layer)
            // pathToJSONFile = currentContext.Server.MapPath("../Data_Categories/Category_" + tourID + ".js");

            //Set path and filename for saved JSON file
            pathToJSONFile = currentContext.Server.MapPath("../Category_" + tourID + ".js");

            //Create StreamWriter object
            StreamWriter StreamWriter = new StreamWriter(pathToJSONFile);

            //Writing JSON string to the file.
            StreamWriter.Write(tourJsonString);

            ////Close the file.
            StreamWriter.Close();
        }
    }
コード例 #19
0
    /// <summary>
    /// This method saves all tours as a JSON file. 
    /// It calls the appropriate methods and then writes the output string to a file.
    /// </summary>
    public void SaveJSONCategoriesAsFile()
    {
        //Instantiate and Fill a DataTable object with test data

        DA_POI_Category tourDataObject = new DA_POI_Category();
        DataTable tourDataTableObject = tourDataObject.GetAllCategories();

        /*Instantiate Method to retrieve the data from the filled DataTable object
        and concatenates it into a JSON-formatted string*/

        JSON_Utils utils = new JSON_Utils();
        string tourJsonString = utils.CovertCategoryDataTableToJSON(tourDataTableObject);
        string pathToJSONFile;

        //Set path and filename for saved JSON file(NOTE: This is used when using a Data_Categories file to hold Category_.js files...
        //Claws at this time will not allow admin to be run with this extra layer)
        //pathToJSONFile = currentContext.Server.MapPath("../Data_Categories/ListOfCategories.js");

        //Set path and filename for saved JSON file
        pathToJSONFile = currentContext.Server.MapPath("../ListOfCategories.js");

        //Create StreamWriter object
        StreamWriter StreamWriter = new StreamWriter(pathToJSONFile);

        //Writing JSON string to the file.
        StreamWriter.Write(tourJsonString);

        ////Close the file.
        StreamWriter.Close();
    }
コード例 #20
0
    public void SaveJSONCategoriesAndLocationsAsFile()
    {
        //Instantiate and Fill a DataTable object with Category data

        DA_POI_Category tourDataObject = new DA_POI_Category();
        DataTable tourDataTableObject = tourDataObject.GetAllCategories();

        foreach (DataRow row in tourDataTableObject.Rows)
        {
            string tourID = Convert.ToString(row["Category_Code"]);
            bool checkIsActive = true;

            /*Instantiate Method to retrieve the data from the filled DataTable object
            and concatenates it into a JSON-formatted string*/

            JSON_Utils utils = new JSON_Utils();
            string tourJsonString = JSON_Utils.CovertCategoryPOIDataTableToJSON(tourID, tourDataTableObject, checkIsActive);
            string pathToJSONFile;

            //Set path and filename for saved JSON file (NOTE: This is used when using a Data_Categories file to hold Category_.js files...
            //Claws at this time will not allow admin to be run with this extra layer)
           // pathToJSONFile = currentContext.Server.MapPath("../Data_Categories/Category_" + tourID + ".js");

            //Set path and filename for saved JSON file
            pathToJSONFile = currentContext.Server.MapPath("../Category_" + tourID + ".js");

            //Create StreamWriter object
            StreamWriter StreamWriter = new StreamWriter(pathToJSONFile);

            //Writing JSON string to the file.
            StreamWriter.Write(tourJsonString);

            ////Close the file.
            StreamWriter.Close();
        }
    }
コード例 #21
0
 /// <summary>
 /// Need to fill the drop down...
 /// Jason Eades
 /// </summary>
 private void FillDropDown()
 {
     DA_POI_Category DAObject = new DA_POI_Category();
     ddlCategory.DataSource = DAObject.GetAllCategories();
     ddlCategory.DataTextField = "Category_Name";
     ddlCategory.DataValueField = "Category_Code";
     ddlCategory.DataBind();
 }
コード例 #22
0
 /// <summary>
 /// This method FillDropDown() will fill the dropdown list with the available categories.  When a user is 
 /// adding a New POI, they will now have to choose a category for that POI.
 /// By. Jason Eades
 /// </summary>
 private void FillDropDown()
 {
     //Bind the drop down list to the categories table in the database
     DA_POI_Category poiDAObject = new DA_POI_Category();
     ddlCategory.DataSource = poiDAObject.GetAllCategories();
     ddlCategory.DataTextField = "Category_Name";
     Trace.Warn("DataTextField = " + ddlCategory.DataTextField);
     ddlCategory.DataValueField = "Category_Code";
     Trace.Warn("DataValueField = " + ddlCategory.DataValueField);
     ddlCategory.DataBind();
     ddlCategory.SelectedIndex = 0;
 }