private TableRow buildPermissionRow(TblPermissions permission) { TableRow operationRow = new TableRow(); Label dateSinceLabel = new Label(); dateSinceLabel.Text = since + ": "; GMDatePicker dateSinceDatePicker = recreateDatePicker(since + permission.ID.ToString()); Label dateTillLabel = new Label(); dateTillLabel.Text = till + ": "; GMDatePicker dateTillDatePicker = recreateDatePicker(till + permission.ID.ToString()); TableCell operationNameCell = new TableCell(); if (permission.StageOperationRef.HasValue) { FxStageOperations stageOperation = ServerModel.DB.Load <FxStageOperations>(permission.StageOperationRef.Value); operationNameCell.Text = stageOperation.Name; } if (permission.CurriculumOperationRef.HasValue) { FxCurriculumOperations curriculumOperation = ServerModel.DB.Load <FxCurriculumOperations>(permission.CurriculumOperationRef.Value); operationNameCell.Text = curriculumOperation.Name; } operationRow.Cells.Add(operationNameCell); Table layoutTable = new Table(); TableRow layoutRow = new TableRow(); TableCell sinceLabelCell = new TableCell(); sinceLabelCell.Controls.Add(dateSinceLabel); TableCell sincePickerCell = new TableCell(); sincePickerCell.HorizontalAlign = HorizontalAlign.Right; sincePickerCell.Controls.Add(dateSinceDatePicker); TableCell tillLabelCell = new TableCell(); tillLabelCell.Controls.Add(dateTillLabel); TableCell tillPickerCell = new TableCell(); tillPickerCell.HorizontalAlign = HorizontalAlign.Right; tillPickerCell.Controls.Add(dateTillDatePicker); operationRow.Cells.Add(sinceLabelCell); operationRow.Cells.Add(sincePickerCell); operationRow.Cells.Add(tillLabelCell); operationRow.Cells.Add(tillPickerCell); if (permission.DateSince.HasValue) { dateSinceDatePicker.InitialText = permission.DateSince.Value.ToShortDateString(); dateSinceDatePicker.InitialTimePickerText = permission.DateSince.Value.ToShortTimeString(); } if (permission.DateTill.HasValue) { dateTillDatePicker.InitialText = permission.DateTill.Value.ToShortDateString(); dateTillDatePicker.InitialTimePickerText = permission.DateTill.Value.ToShortTimeString(); } TableCell operationCell = new TableCell(); Button ApppyButton = new Button(); ApppyButton.ID = applyChar + permission.ID.ToString(); ApppyButton.Click += new EventHandler(ApppyButton_Click); ApppyButton.Text = apply; Button RemoveButton = new Button(); RemoveButton.ID = removeChar + permission.ID.ToString(); RemoveButton.Click += new EventHandler(RemoveButton_Click); RemoveButton.Text = remove; operationCell.Controls.Add(ApppyButton); operationCell.Controls.Add(RemoveButton); operationRow.Cells.Add(operationCell); return(operationRow); }
private void Button_AddStageOperation(object sender, EventArgs e) { FxStageOperations operation = ServerModel.DB.Load <FxStageOperations>(int.Parse(DropDownList_StageOperations.SelectedValue)); PermissionsManager.Grand(stage, operation, null, group.ID, DateTimeInterval.Full); }