Example #1
0
    private void EditEntry()
    {
        int ultimateid = 0;
        if (int.TryParse(Request.QueryString["ultimateid"], out ultimateid))
        {
            ultimateTable = dc.UltimateTables.Where(i => i.Id == ultimateid).SingleOrDefault();
        }

        if (!IsPostBack)
        {
            if (ultimateTable != null)
            {
                UltimateTableSelected();
                plhSelectedUltimateTable.Visible = true;
            }
            else
            {
                plhSelectedUltimateTable.Visible = false;
            }
        }
    }
Example #2
0
    protected void SubmitChangesCommand(object sender, CommandEventArgs e)
    {
        string command = e.CommandName;
        Validate("ultimatetable");
        if (IsValid)
        {
            if (command == "saveedit" || command == "savenew")
            {
                if (command == "savenew")
                {
                    ultimateTable = new UltimateTable();
                    dc.UltimateTables.InsertOnSubmit(ultimateTable);
                }
                ultimateTable.Title = tbxTitle.Text.Trim();
                ultimateTable.RegexExpression = tbxRegexExpression.Text.Trim();
                ultimateTable.RegexExpressionExtended = tbxRegexExpressionExtended.Text.Trim();
                ultimateTable.Description = tbxDescription.Text.Trim();
                ultimateTable.Accuweather = tbxAccuweather.Text.Trim();

                ultimateTable.IsIgnored = chbxIsIgnored.Checked;
                ultimateTable.Active = chbxActive.Checked;

                ultimateTable.LanguageId = ddlLanguageId.SelectedValue == "-1" ? (int?)null : int.Parse(ddlLanguageId.SelectedValue);
                ultimateTable.ObjectTypeId = int.Parse(ddlObjectTypeId.SelectedValue);

                dc.SubmitChanges();

                string statusmessage = "Promjene spremljene";

                var querystring = HttpUtility.ParseQueryString(Request.Url.Query);
                querystring.Remove("ultimateid");
                querystring.Remove("action");

                if (command == "savenew")
                {
                    statusmessage = "UspjeĊĦan unos";
                    querystring["action"] = "editentry";
                    querystring["ultimateid"] = ultimateTable.Id.ToString();
                }

                SetStatusMessage(statusmessage);
                Server.Transfer(String.Format("/manage/ultimatetable.aspx?{0}", querystring.ToString()));
            }
        }
    }