Beispiel #1
0
    public void SaveValue()
    {
        if (DropDownList1.SelectedIndex > 0)
        {
            tblItems itm = new tblItems();
            itm.LoadByPrimaryKey(_itemId);

            tblItemFieldsXValue val = new tblItemFieldsXValue();
            val.Where.ItemId.Value      = _itemId;
            val.Where.ItemFieldId.Value = 5;
            val.Where.LanguageId.Value  = int.Parse(Request["langId"]);

            val.Query.Load();

            if (val.RowCount == 0)
            {
                val.AddNew();
                val.ItemId     = _itemId;
                val.ItemId     = 5;
                val.LanguageId = int.Parse(Request["langId"]);
            }

            if (val.ItemFieldPdfAssetId != Int32.Parse(DropDownList1.SelectedValue))
            {
                val.ItemFieldPdfAssetTempId = Int32.Parse(DropDownList1.SelectedValue);
            }
            val.Save();
        }
    }
Beispiel #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        tblItems item = new tblItems();
        item.AddNew();

        item.ItemTitle = TextBox1.Text;
        item.ItemTypeId = int.Parse(DropDownList1.SelectedValue);

        item.Save();

        tblItemFieldsXValue fxv = new tblItemFieldsXValue();
         // now, create the field values
        switch (DropDownList1.SelectedValue)
        {
            case "1":
                tblItemFieldStringValues txt21 = new tblItemFieldStringValues();
                txt21.AddNew();
                txt21.ItemFieldValue = " ";
                txt21.Save();

                fxv.AddNew();
                fxv.ItemId = item.ItemId;
                fxv.LanguageId = int.Parse(Request["langId"]);
                fxv.ItemFieldId = 7; // text
                fxv.ItemFieldStringId = -1;
                if (ConfigurationManager.AppSettings["usesApprovals"] == "true")
                {
                    fxv.ItemFieldStringTempId = txt21.ItemFieldStringValueId;
                }
                else
                {
                    fxv.ItemFieldStringId = txt21.ItemFieldStringValueId;
                }
                fxv.Save();
                break;

            case "2":
                // image
                //tblImageAssets blob = new tblImageAssets();
                //blob.AddNew();
                //blob.Save();
                tblItemFieldStringValues img = new tblItemFieldStringValues();
                img.AddNew();
                img.ItemFieldValue = " ";
                img.Save();

                fxv.AddNew();
                fxv.ItemId = item.ItemId;
                fxv.LanguageId = int.Parse(Request["langId"]);
                fxv.ItemFieldId = 3; // image
                fxv.ItemFieldStringId = -1;
                if (ConfigurationManager.AppSettings["usesApprovals"] == "true")
                {
                    fxv.ItemFieldStringTempId = img.ItemFieldStringValueId;
                }
                else
                {
                    fxv.ItemFieldStringId = img.ItemFieldStringValueId;
                }

                fxv.Save();
                break;
            case "3":
                // rich text
                tblItemFieldTextValues txt = new tblItemFieldTextValues();
                txt.AddNew();
                txt.Save();

                fxv.AddNew();
                fxv.ItemId = item.ItemId;
                fxv.LanguageId = int.Parse(Request["langId"]);
                fxv.ItemFieldId = 2; // image

                if (ConfigurationManager.AppSettings["usesApprovals"] == "true")
                {
                    fxv.ItemFieldTextTempId = txt.ItemFieldStringValueId;
                }
                else
                {
                    fxv.ItemFieldTextId = txt.ItemFieldStringValueId;
                }
                fxv.Save();
                break;
            case "4":
                // pdf
                fxv.AddNew();
                fxv.ItemId = item.ItemId;
                fxv.LanguageId = int.Parse(Request["langId"]);
                fxv.ItemFieldId = 5; // pdf
                fxv.ItemFieldPdfAssetId = -1;

                fxv.Save();
                break;
            case "5":
                // rich text
                tblItemFieldStringValues txt2 = new tblItemFieldStringValues();
                txt2.AddNew();
                txt2.ItemFieldValue = " ";
                txt2.Save();

                fxv.AddNew();
                fxv.ItemId = item.ItemId;
                fxv.LanguageId = int.Parse(Request["langId"]);
                fxv.ItemFieldId = 6; // image
                if (ConfigurationManager.AppSettings["usesApprovals"] == "true")
                {
                    fxv.ItemFieldStringTempId = txt2.ItemFieldStringValueId;
                }
                else
                {
                    fxv.ItemFieldStringId = txt2.ItemFieldStringValueId;
                }

                fxv.Save();
                break;
        }

        tblControlsXItems cxi = new tblControlsXItems();
        cxi.AddNew();
        cxi.ControlId = int.Parse(Request["ctl"]);
        cxi.LanguageId = int.Parse(Request["langId"]);
        cxi.ItemId = item.ItemId;

        cxi.Save();

        lbJs.Text = epicCMSLib.Navigation.CloseWindowString;
    }
    public void SaveValue()
    {
        tblItemFieldsXValue val = new tblItemFieldsXValue();
        val.Where.ItemId.Value = _itemId;

        // hard coded
        val.Where.ItemFieldId.Value = 2;
        val.Where.LanguageId.Value = int.Parse(Request["langId"]);

        val.Query.Load();

        if (val.RowCount == 0)
        {
            val.AddNew();
            val.ItemFieldId = 2;
            val.LanguageId = int.Parse(Request["langId"]); ;
            val.ItemId = _itemId;
        }

        tblItemFieldTextValues txt = new tblItemFieldTextValues();
        try
        {
            txt.LoadByPrimaryKey(val.ItemFieldTextTempId);

            if (txt.RowCount == 0)
            {
                txt.AddNew();
            }
        }
        catch
        {
            txt.AddNew();
        }

        // check if we need an update
        tblItemFieldTextValues valtxt = new tblItemFieldTextValues();

        bool update = true;

        try
        {
            valtxt.LoadByPrimaryKey(val.ItemFieldTextId);

            if (valtxt.ItemFieldValue == CtlRichTextControl1.Text)
            {
                update = false;
            }
        }
        catch
        {
        }

        if (update)
        {
            txt.ItemFieldValue = CtlRichTextControl1.Text;
            txt.Save();

            if (ConfigurationManager.AppSettings["usesApprovals"] == "true")
                val.ItemFieldTextTempId = txt.ItemFieldStringValueId;
            else
                val.ItemFieldTextId = txt.ItemFieldStringValueId;
            val.Save();
        }
    }
Beispiel #4
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        tblItems item = new tblItems();

        item.AddNew();

        item.ItemTitle  = TextBox1.Text;
        item.ItemTypeId = int.Parse(DropDownList1.SelectedValue);

        item.Save();

        tblItemFieldsXValue fxv = new tblItemFieldsXValue();

        // now, create the field values
        switch (DropDownList1.SelectedValue)
        {
        case "1":
            tblItemFieldStringValues txt21 = new tblItemFieldStringValues();
            txt21.AddNew();
            txt21.ItemFieldValue = " ";
            txt21.Save();

            fxv.AddNew();
            fxv.ItemId            = item.ItemId;
            fxv.LanguageId        = int.Parse(Request["langId"]);
            fxv.ItemFieldId       = 7; // text
            fxv.ItemFieldStringId = -1;
            if (ConfigurationManager.AppSettings["usesApprovals"] == "true")
            {
                fxv.ItemFieldStringTempId = txt21.ItemFieldStringValueId;
            }
            else
            {
                fxv.ItemFieldStringId = txt21.ItemFieldStringValueId;
            }
            fxv.Save();
            break;

        case "2":
            // image
            //tblImageAssets blob = new tblImageAssets();
            //blob.AddNew();
            //blob.Save();
            tblItemFieldStringValues img = new tblItemFieldStringValues();
            img.AddNew();
            img.ItemFieldValue = " ";
            img.Save();

            fxv.AddNew();
            fxv.ItemId            = item.ItemId;
            fxv.LanguageId        = int.Parse(Request["langId"]);
            fxv.ItemFieldId       = 3; // image
            fxv.ItemFieldStringId = -1;
            if (ConfigurationManager.AppSettings["usesApprovals"] == "true")
            {
                fxv.ItemFieldStringTempId = img.ItemFieldStringValueId;
            }
            else
            {
                fxv.ItemFieldStringId = img.ItemFieldStringValueId;
            }

            fxv.Save();
            break;

        case "3":
            // rich text
            tblItemFieldTextValues txt = new tblItemFieldTextValues();
            txt.AddNew();
            txt.Save();

            fxv.AddNew();
            fxv.ItemId      = item.ItemId;
            fxv.LanguageId  = int.Parse(Request["langId"]);
            fxv.ItemFieldId = 2;     // image

            if (ConfigurationManager.AppSettings["usesApprovals"] == "true")
            {
                fxv.ItemFieldTextTempId = txt.ItemFieldStringValueId;
            }
            else
            {
                fxv.ItemFieldTextId = txt.ItemFieldStringValueId;
            }
            fxv.Save();
            break;

        case "4":
            // pdf
            fxv.AddNew();
            fxv.ItemId              = item.ItemId;
            fxv.LanguageId          = int.Parse(Request["langId"]);
            fxv.ItemFieldId         = 5; // pdf
            fxv.ItemFieldPdfAssetId = -1;

            fxv.Save();
            break;

        case "5":
            // rich text
            tblItemFieldStringValues txt2 = new tblItemFieldStringValues();
            txt2.AddNew();
            txt2.ItemFieldValue = " ";
            txt2.Save();

            fxv.AddNew();
            fxv.ItemId      = item.ItemId;
            fxv.LanguageId  = int.Parse(Request["langId"]);
            fxv.ItemFieldId = 6;     // image
            if (ConfigurationManager.AppSettings["usesApprovals"] == "true")
            {
                fxv.ItemFieldStringTempId = txt2.ItemFieldStringValueId;
            }
            else
            {
                fxv.ItemFieldStringId = txt2.ItemFieldStringValueId;
            }

            fxv.Save();
            break;
        }

        tblControlsXItems cxi = new tblControlsXItems();

        cxi.AddNew();
        cxi.ControlId  = int.Parse(Request["ctl"]);
        cxi.LanguageId = int.Parse(Request["langId"]);
        cxi.ItemId     = item.ItemId;

        cxi.Save();

        lbJs.Text = epicCMSLib.Navigation.CloseWindowString;
    }
Beispiel #5
0
    public void SaveValue()
    {
        if (DropDownList1.SelectedIndex > 0)
        {
            tblItems itm = new tblItems();
            itm.LoadByPrimaryKey(_itemId);

            tblItemFieldsXValue val = new tblItemFieldsXValue();
            val.Where.ItemId.Value = _itemId;
            val.Where.ItemFieldId.Value = 5;
            val.Where.LanguageId.Value = int.Parse(Request["langId"]);

            val.Query.Load();

            if (val.RowCount == 0)
            {
                val.AddNew();
                val.ItemId = _itemId;
                val.ItemId = 5;
                val.LanguageId = int.Parse(Request["langId"]);
            }

            if (val.ItemFieldPdfAssetId != Int32.Parse(DropDownList1.SelectedValue))
                val.ItemFieldPdfAssetTempId = Int32.Parse(DropDownList1.SelectedValue);
            val.Save();
        }
    }
Beispiel #6
0
    private void loadPdfs()
    {
        tblPdfAssets assets = new tblPdfAssets();
        assets.LoadAll();

        int sel = -1;
        if (_itemId > -1)
        {
            tblItems itm = new tblItems();
            itm.LoadByPrimaryKey(_itemId);

            tblItemFieldsXValue val = new tblItemFieldsXValue();
            val.Where.ItemId.Value = _itemId;
            val.Where.ItemFieldId.Value = 5;
            val.Where.LanguageId.Value = int.Parse(Request["langId"]);

            val.Query.Load();

            if (val.RowCount > 0)
            {
                val.Rewind();
                if (_temp)
                    sel = val.ItemFieldPdfAssetTempId;
                else
                    sel = val.ItemFieldPdfAssetId;
                HyperLink2.Text = "View PDF";
                HyperLink2.Target = "_blank";
                HyperLink2.NavigateUrl = "~/renderpdf.aspx?itemid=" + _itemId.ToString()+"&langid=" + Request["langid"];
            }
            else
            {
                val.AddNew();
                val.ItemId = _itemId;
                val.ItemFieldId = 5;
                val.LanguageId = int.Parse(Request["langId"]);
                val.ItemFieldPdfAssetId = -1;
                val.Save();
            }
        }
        else
        {
            if (_pdfid > -1)
            {
                HyperLink2.NavigateUrl = "~/renderpdf.aspx?pdfid=" + _pdfid.ToString();
                HyperLink2.Text = "View PDF";
                HyperLink2.Target = "_blank";
                sel = _pdfid;
            }
            else
            {
                HyperLink2.Visible = false;
                LinkButton1.Visible = false;
            }
        }

        ListItem li2 = new ListItem("--Select--");
        DropDownList1.Items.Add(li2);
        if (assets.RowCount > 0)
        {
            assets.Rewind();
            do
            {
                ListItem li = new ListItem(assets.PdfTitle, assets.PdfAssetId.ToString());

                if (sel == assets.PdfAssetId)
                {
                    li.Selected = true;
                }

                DropDownList1.Items.Add(li);
            } while (assets.MoveNext());
        }

        if (DropDownList1.SelectedIndex == 0)
        {
            HyperLink2.Visible = false;
            LinkButton1.Visible = false;
        }
    }
    public void SaveValue()
    {
        tblItemFieldsXValue val = new tblItemFieldsXValue();

        val.Where.ItemId.Value = _itemId;

        // hard coded
        val.Where.ItemFieldId.Value = 7;
        val.Where.LanguageId.Value  = int.Parse(Request["langId"]);

        val.Query.Load();

        if (val.RowCount == 0)
        {
            val.AddNew();
            val.ItemFieldId = 7;
            val.LanguageId  = int.Parse(Request["langId"]);;
            val.ItemId      = _itemId;
        }

        tblItemFieldStringValues txt = new tblItemFieldStringValues();

        try
        {
            if (val.ItemFieldStringTempId > -1)
            {
                txt.LoadByPrimaryKey(val.ItemFieldStringTempId);
            }
            else
            {
                txt.AddNew();
            }
        }
        catch
        {
            txt.AddNew();
        }

        // check if we need an update
        tblItemFieldStringValues valtxt = new tblItemFieldStringValues();

        bool update = true;

        try
        {
            valtxt.LoadByPrimaryKey(val.ItemFieldStringId);

            if (valtxt.ItemFieldValue == TextBox1.Text)
            {
                update = false;
            }
        }
        catch
        {
        }

        if (update)
        {
            txt.ItemFieldValue = TextBox1.Text;
            txt.Save();

            val.ItemFieldStringTempId = txt.ItemFieldStringValueId;
            val.Save();
        }
    }
    public void SaveValue()
    {
        tblItemFieldsXValue val = new tblItemFieldsXValue();
        val.Where.ItemId.Value = _itemId;

        // hard coded
        val.Where.ItemFieldId.Value = 3;
        val.Where.LanguageId.Value = (int)ViewState["_langId"];

        val.Query.Load();

        if (val.RowCount == 0)
        {
            val.AddNew();
            val.ItemFieldId = 3;
            val.LanguageId = (int)ViewState["_langId"];
            val.ItemId = _itemId;

        }

        tblItemFieldStringValues txt = new tblItemFieldStringValues();
        try
        {
            if (val.ItemFieldStringTempId > -1)
            {
                txt.LoadByPrimaryKey(val.ItemFieldStringTempId);
            }
            else { txt.AddNew(); }
        }
        catch
        {
            txt.AddNew();
        }

        // check if we need an update
        tblItemFieldStringValues valtxt = new tblItemFieldStringValues();

        bool update = true;
        string imgroot = ddCat.SelectedItem.Value + "/" + ddFiles.SelectedItem.Value;
        try
        {
            valtxt.LoadByPrimaryKey(val.ItemFieldStringId);

            if (valtxt.ItemFieldValue == imgroot)
            {
                update = false;
            }
        }
        catch
        {
        }

        if (update)
        {
            txt.ItemFieldValue = imgroot;
            txt.Save();

            val.ItemFieldStringTempId = txt.ItemFieldStringValueId;
            val.Save();
        }
    }
    public void SaveValue()
    {
        tblItemFieldsXValue val = new tblItemFieldsXValue();
        val.Where.ItemId.Value = _itemId;

        // hard coded
        val.Where.ItemFieldId.Value = 7;
        val.Where.LanguageId.Value = int.Parse(Request["langId"]);

        val.Query.Load();

        if (val.RowCount == 0)
        {
            val.AddNew();
            val.ItemFieldId = 7;
            val.LanguageId = int.Parse(Request["langId"]); ;
            val.ItemId = _itemId;
        }

        tblItemFieldStringValues txt = new tblItemFieldStringValues();
        try
        {
            if (val.ItemFieldStringTempId > -1)
            {
                txt.LoadByPrimaryKey(val.ItemFieldStringTempId);
            }
            else { txt.AddNew(); }
        }
        catch
        {
            txt.AddNew();
        }

        // check if we need an update
        tblItemFieldStringValues valtxt = new tblItemFieldStringValues();

        bool update = true;

        try
        {
            valtxt.LoadByPrimaryKey(val.ItemFieldStringId);

            if (valtxt.ItemFieldValue == TextBox1.Text)
            {
                update = false;
            }
        }
        catch
        {
        }

        if (update)
        {
            txt.ItemFieldValue = TextBox1.Text;
            txt.Save();

            val.ItemFieldStringTempId = txt.ItemFieldStringValueId;
            val.Save();
        }
    }
Beispiel #10
0
    private void loadPdfs()
    {
        tblPdfAssets assets = new tblPdfAssets();

        assets.LoadAll();

        int sel = -1;

        if (_itemId > -1)
        {
            tblItems itm = new tblItems();
            itm.LoadByPrimaryKey(_itemId);

            tblItemFieldsXValue val = new tblItemFieldsXValue();
            val.Where.ItemId.Value      = _itemId;
            val.Where.ItemFieldId.Value = 5;
            val.Where.LanguageId.Value  = int.Parse(Request["langId"]);

            val.Query.Load();

            if (val.RowCount > 0)
            {
                val.Rewind();
                if (_temp)
                {
                    sel = val.ItemFieldPdfAssetTempId;
                }
                else
                {
                    sel = val.ItemFieldPdfAssetId;
                }
                HyperLink2.Text        = "View PDF";
                HyperLink2.Target      = "_blank";
                HyperLink2.NavigateUrl = "~/renderpdf.aspx?itemid=" + _itemId.ToString() + "&langid=" + Request["langid"];
            }
            else
            {
                val.AddNew();
                val.ItemId              = _itemId;
                val.ItemFieldId         = 5;
                val.LanguageId          = int.Parse(Request["langId"]);
                val.ItemFieldPdfAssetId = -1;
                val.Save();
            }
        }
        else
        {
            if (_pdfid > -1)
            {
                HyperLink2.NavigateUrl = "~/renderpdf.aspx?pdfid=" + _pdfid.ToString();
                HyperLink2.Text        = "View PDF";
                HyperLink2.Target      = "_blank";
                sel = _pdfid;
            }
            else
            {
                HyperLink2.Visible  = false;
                LinkButton1.Visible = false;
            }
        }

        ListItem li2 = new ListItem("--Select--");

        DropDownList1.Items.Add(li2);
        if (assets.RowCount > 0)
        {
            assets.Rewind();
            do
            {
                ListItem li = new ListItem(assets.PdfTitle, assets.PdfAssetId.ToString());

                if (sel == assets.PdfAssetId)
                {
                    li.Selected = true;
                }

                DropDownList1.Items.Add(li);
            } while (assets.MoveNext());
        }

        if (DropDownList1.SelectedIndex == 0)
        {
            HyperLink2.Visible  = false;
            LinkButton1.Visible = false;
        }
    }
    public void SaveValue()
    {
        tblItemFieldsXValue val = new tblItemFieldsXValue();

        val.Where.ItemId.Value = _itemId;

        // hard coded
        val.Where.ItemFieldId.Value = 2;
        val.Where.LanguageId.Value  = int.Parse(Request["langId"]);

        val.Query.Load();

        if (val.RowCount == 0)
        {
            val.AddNew();
            val.ItemFieldId = 2;
            val.LanguageId  = int.Parse(Request["langId"]);;
            val.ItemId      = _itemId;
        }

        tblItemFieldTextValues txt = new tblItemFieldTextValues();

        try
        {
            txt.LoadByPrimaryKey(val.ItemFieldTextTempId);

            if (txt.RowCount == 0)
            {
                txt.AddNew();
            }
        }
        catch
        {
            txt.AddNew();
        }



        // check if we need an update
        tblItemFieldTextValues valtxt = new tblItemFieldTextValues();

        bool update = true;

        try
        {
            valtxt.LoadByPrimaryKey(val.ItemFieldTextId);

            if (valtxt.ItemFieldValue == CtlRichTextControl1.Text)
            {
                update = false;
            }
        }
        catch
        {
        }

        if (update)
        {
            txt.ItemFieldValue = CtlRichTextControl1.Text;
            txt.Save();

            if (ConfigurationManager.AppSettings["usesApprovals"] == "true")
            {
                val.ItemFieldTextTempId = txt.ItemFieldStringValueId;
            }
            else
            {
                val.ItemFieldTextId = txt.ItemFieldStringValueId;
            }
            val.Save();
        }
    }
    public void SaveValue()
    {
        tblItemFieldsXValue val = new tblItemFieldsXValue();

        val.Where.ItemId.Value = _itemId;

        // hard coded
        val.Where.ItemFieldId.Value = 3;
        val.Where.LanguageId.Value  = (int)ViewState["_langId"];

        val.Query.Load();

        if (val.RowCount == 0)
        {
            val.AddNew();
            val.ItemFieldId = 3;
            val.LanguageId  = (int)ViewState["_langId"];
            val.ItemId      = _itemId;
        }

        tblItemFieldStringValues txt = new tblItemFieldStringValues();

        try
        {
            if (val.ItemFieldStringTempId > -1)
            {
                txt.LoadByPrimaryKey(val.ItemFieldStringTempId);
            }
            else
            {
                txt.AddNew();
            }
        }
        catch
        {
            txt.AddNew();
        }

        // check if we need an update
        tblItemFieldStringValues valtxt = new tblItemFieldStringValues();

        bool   update  = true;
        string imgroot = ddCat.SelectedItem.Value + "/" + ddFiles.SelectedItem.Value;

        try
        {
            valtxt.LoadByPrimaryKey(val.ItemFieldStringId);

            if (valtxt.ItemFieldValue == imgroot)
            {
                update = false;
            }
        }
        catch
        {
        }

        if (update)
        {
            txt.ItemFieldValue = imgroot;
            txt.Save();

            val.ItemFieldStringTempId = txt.ItemFieldStringValueId;
            val.Save();
        }
    }