示例#1
0
    /// <summary>
    /// Add new link to db.
    /// </summary>
    private void AddNewLink()
    {
        LinksManager linkObj    = new LinksManager();
        SiteLink     linkToSave = new SiteLink();

        try
        {
            // assign newlink info.
            linkToSave.link_details = editorLinkDetails.Value;
            linkToSave.link_lang_id = Convert.ToInt32(ddlLanguage.SelectedValue);

            //if (ddlParentLinks.SelectedIndex > 0) { linkToSave.ParentID = Convert.ToInt32(ddlParentLinks.SelectedValue); }
            //if (txtLinkURL.Text.Trim() != String.Empty) { linkToSave.link_url = txtLinkURL.Text; }

            linkToSave.link_name  = txtName.Text;
            linkToSave.link_order = Convert.ToInt32(txtPriority.Text);
            //linkToSave.link_place = GetPlaceofLink();
            linkToSave.Active = cbActive.Checked;

            // perform saving method.
            if (linkObj.AddNewLink(linkToSave))
            {
                // go to links list.
                string url = "SiteLinksView.aspx"; //?langid=" + ddlLanguageID.SelectedValue;
                Response.Redirect(url);
            }
            else
            {
                lblError.Text = Resources.AdminResources_en.ErrorSave;
            }
        }
        catch { lblError.Text = Resources.AdminResources_en.ErrorSave; }
    }
示例#2
0
    /// <summary>
    /// Show palce of the link
    /// (v= vertical, h= horizontal).
    /// </summary>
    /// <param name="val"></param>
    /// <returns></returns>
    //private void ShowLinkPlace(string val)
    //{
    //    if (val == "v")
    //        v.Checked = true;
    //    else
    //        h.Checked = true;

    //}
    private void UpdateLinkInfo()
    {
        LinksManager linkObj    = new LinksManager();
        SiteLink     linkToSave = new SiteLink();

        try
        {
            linkToSave.id        = hfID.Value != String.Empty ? Convert.ToInt32(hfID.Value) : 0; // ConvertLinkIdToInt();
            linkToSave.link_name = txtName.Text;

            //if (ddlParentLinks.SelectedIndex > 0) { linkToSave.ParentID = Convert.ToInt32(ddlParentLinks.SelectedValue); }
            //if (txtLinkURL.Text.Trim() != String.Empty) { linkToSave.link_url = txtLinkURL.Text; }
            //linkToSave.link_place = GetPlaceofLink();

            linkToSave.link_lang_id = Convert.ToInt32(ddlLanguage.SelectedValue);
            linkToSave.link_order   = Convert.ToInt32(txtPriority.Text);

            linkToSave.link_details = editorLinkDetails.Value;
            linkToSave.Active       = cbActive.Checked;

            // Perform saving data.
            if (linkObj.UpdateLinkInfo(linkToSave))
            {
                Response.Redirect("../SiteLinksView.aspx"); //?langid=" + ddlLanguageID.SelectedValue); // success save.
            }
            else
            {
                lblError.Text = Resources.AdminResources_en.ErrorSave; lblError.ForeColor = System.Drawing.Color.DarkRed;
            }                                                                                                                  // fail save.
        }
        catch { lblError.Text = Resources.AdminResources_en.ErrorSave; lblError.ForeColor = System.Drawing.Color.DarkRed; }
    }
示例#3
0
 public ActionResult GetLinks()
 {
     try
     {
         return(Json(LinksManager.GetAllLinks(), JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError));
     }
 }
示例#4
0
    protected void gvlinks_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            // Get link id to delete.
            int linkID = Convert.ToInt32(e.CommandArgument);

            // Execute delete func.
            LinksManager linkOnj = new LinksManager();
            linkOnj.DeleteLink(linkID);
        }
    }
        public static void checkUrl()
        {
            List <Links> allowedLinks = LinksManager.getAllowedLinks();

            String currentUrl = HttpContext.Current.Request.CurrentExecutionFilePath;

            int allowed = allowedLinks.FindIndex(f => f.getPath() == currentUrl);

            if (allowed < 0)
            {
                HttpContext.Current.Response.Redirect("~/index.aspx");
            }
        }
示例#6
0
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance == this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);

        InitializeManager();
    }
示例#7
0
    private void ShowLinkDetails(int id)
    {
        LinksGetLinkDetailsByIdResult linkToShow = new LinksManager().GetLinkDetails(id);


        if (linkToShow != null)
        {
            txtName.Text = linkToShow.link_name;
            ddlLanguage.SelectedValue = linkToShow.link_lang_id.ToString();
            txtPriority.Text          = linkToShow.link_order.ToString();
            editorLinkDetails.Value   = linkToShow.link_details;

            //if (linkToShow.ParentID != null) { ddlParentLinks.SelectedValue = linkToShow.ParentID.ToString(); }
            //txtLinkURL.Text = linkToShow.link_url;

            //ShowLinkPlace(linkToShow.link_place);

            cbActive.Checked = linkToShow.Active != null ? (bool)linkToShow.Active : true;
        }
    }
示例#8
0
 public void reloadLinks()
 {
     LinksManager.getLinksFromDB();
 }
示例#9
0
    private void getNavLinks()
    {
        List <Links> allowedLinks = LinksManager.getAllowedLinks();

        sendLinksToWrite(allowedLinks);
    }