Exemple #1
0
    /// <summary>
    /// Handles the Click event of the AddControlButton control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void AddControlButton_Click(object sender, EventArgs e)
    {
        LotusDataContext      db = new LotusDataContext(Data.ConnectionManager());
        form_field_definition fieldDefinition = new form_field_definition();

        fieldDefinition.form_field_name = ControlNameTextBox.Text;
        int sortNumber = 0;

        int.TryParse(SortingTextBox.Text, out sortNumber);
        fieldDefinition.sorting     = sortNumber;
        fieldDefinition.sorting     = int.Parse(SortingTextBox.Text);
        fieldDefinition.is_required = RequiredCheckBox.Checked;
        fieldDefinition.input_type  = ControlTypeDropDownList.SelectedValue;
        fieldDefinition.page_id     = PageID;
        fieldDefinition.div_id      = int.Parse(ContainerDropDownList.SelectedValue.ToString());
        if (DefaultValueTextBox.Text != string.Empty)
        {
            fieldDefinition.default_value = DefaultValueTextBox.Text;
        }
        if (WidthTextBox.Text != string.Empty)
        {
            fieldDefinition.width = int.Parse(WidthTextBox.Text);
        }
        db.form_field_definitions.InsertOnSubmit(fieldDefinition);
        db.SubmitChanges();
        FormControlsGridView.DataSource = Data.GetControls(PageID);
        FormControlsGridView.DataBind();
    }
Exemple #2
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     Session["Service"] = ModuleData;
     if (!Page.User.Identity.IsAuthenticated)
     {
         BookingLogin.DestinationPageUrl = Request.RawUrl;
         AnonymousPanel.Visible          = true;
     }
     else
     {
         if (Page.User.IsInRole("administrators"))
         {
             AdministrationPanel.Visible     = true;
             LogedinPanel.Visible            = false;
             FormControlsGridView.DataSource = Data.GetControls(PageID);
             FormControlsGridView.DataBind();
             LinqDataSource1.Where = "page_id=" + PageID.ToString();
             ContainerDropDownList.DataBind();
         }
         else
         {
             LogedinPanel.Visible = true;
         }
     }
 }