private void ConfiguraModoCRUD(DetailsViewMode novoModo, especiePessoa especiePessoa, bool tipoPessoaColaborador, bool tipoPessoaAdvogado, bool tipoPessoaCliente, bool tipoPessoaParte, bool tipoPessoaTerceiro) { dvManutencao.ChangeMode(novoModo); if (especiePessoa != Pessoa.especiePessoa.Nenhuma) { if (tipoPessoaColaborador) { dvColaborador.ChangeMode(novoModo); } if (tipoPessoaAdvogado) { dvAdvogado.ChangeMode(novoModo); } dvContato.ChangeMode(novoModo); dvReferencias.ChangeMode(novoModo); } switch (especiePessoa) { case especiePessoa.Fisica: dvPessoaFisica.ChangeMode(novoModo); dvDadosProfissionais.ChangeMode(novoModo); break; case especiePessoa.Juridica: dvPessoaJuridica.ChangeMode(novoModo); break; } }
private void ConfiguraModoCRUD(DetailsViewMode novoModo) { switch (novoModo) { case DetailsViewMode.ReadOnly: dvProcessoAndamento.ChangeMode(novoModo); dvProcessoPeca.ChangeMode(novoModo); break; case DetailsViewMode.Edit: dvProcessoAndamento.ChangeMode(novoModo); if (ExistePecaProcessual()) { dvProcessoPeca.ChangeMode(novoModo); } else { dvProcessoPeca.ChangeMode(DetailsViewMode.Insert); } break; case DetailsViewMode.Insert: dvProcessoAndamento.ChangeMode(novoModo); dvProcessoPeca.ChangeMode(novoModo); break; default: break; } }
public HttpResponse Details(string id) { if (!IsUserLoggedIn()) { return(this.Redirect("/Users/Login")); } var album = this.albumsService.GetAlbum(id); if (album == null) { return(this.Redirect("/Albums/All")); } var viewModel = new DetailsViewMode() { Id = album.Id, Name = album.Name, Cover = album.Cover, Price = (album.Tracks.Sum(x => x.Price)) * 0.87M, Tracks = album.Tracks.Select(t => new TracksInfoViewModel { Id = t.Id, Name = t.Name }).ToList() }; return(this.View(viewModel)); }
/// <summary> /// Для внутренних вызовов, чтоб была обработка событий. /// </summary> /// <param name="mode">новый мод</param> /// <param name="cancelingEdit">является ли отменой изменения</param> public void ChangeModeWithEvent(DetailsViewMode mode, bool cancelingEdit) { DetailsViewModeEventArgs args = new DetailsViewModeEventArgs(mode, cancelingEdit); OnModeChanging(args); if (args.Cancel) { return; } ChangeMode(mode); OnModeChanged(EventArgs.Empty); }
private void ConfiguraModoCRUD(DetailsViewMode novoModo, string especiePessoa, bool tipoPessoaColaborador, bool tipoPessoaAdvogado, bool tipoPessoaCliente, bool tipoPessoaParte, bool tipoPessoaTerceiro) { switch (especiePessoa) { case "F": this.ConfiguraModoCRUD(novoModo, Pessoa.especiePessoa.Fisica, tipoPessoaColaborador, tipoPessoaAdvogado, tipoPessoaCliente, tipoPessoaParte, tipoPessoaTerceiro); break; case "J": this.ConfiguraModoCRUD(novoModo, Pessoa.especiePessoa.Juridica, tipoPessoaColaborador, tipoPessoaAdvogado, tipoPessoaCliente, tipoPessoaParte, tipoPessoaTerceiro); break; case "": this.ConfiguraModoCRUD(novoModo, Pessoa.especiePessoa.Nenhuma, false, false, false, false, false); break; } }
/// <summary> /// 模擬DetailView的ChangeMode /// </summary> public static void ChangeMode(this ListView lsv, DetailsViewMode newMode) { switch (newMode) { case DetailsViewMode.ReadOnly: { // Hide InsertItemTemplate lsv.InsertItemPosition = InsertItemPosition.None; // Hide EditItemTemplate lsv.EditIndex = -1; lsv.SelectedIndex = 0; } break; case DetailsViewMode.Insert: { // In Insert mode, we just want to see InsertItemTemplate // so we must do following 3 steps // 1) Hide EditItemTemplate lsv.EditIndex = -1; // 2) Hide ItemTemplate // ( In order to accomplish it, we must set Primary Key(s) to be NULL, // then OpenDetailsView function will return NULL while Pk(s) is NULL ) // [原因] 由於ListView的 Insert、Update、Select是一起執行的,這表示新增單筆資料時, // OpenDetailsView仍然會執行,為了使新增單筆資料時,只有InsertItemplate顯示 // 必須使OpenDetailsView回傳NULL。 // [做法] 根據OpenDetailsView對主鍵值限定 // "正常情況 DetailsView 主鍵值不得為null, 若特殊狀況允許null, 則必須移除過濾條件" // If BvUtil.IsNullObj(KeyValues("EmployeeID")) Then Return Nothing // 3) Show InsertItemTemplate lsv.InsertItemPosition = InsertItemPosition.FirstItem; } break; case DetailsViewMode.Edit: { // Hide InsertItemTemplate lsv.InsertItemPosition = InsertItemPosition.None; // Show EditItemTemplate lsv.EditIndex = 0; } break; } }
protected override void OnLoad(EventArgs e) { if (readOnly) { dvMode = DetailsViewMode.ReadOnly; } else { dvMode = DetailsViewMode.Edit; } dvControl.DefaultMode = dvMode; if (btnSave != null) { btnSave.Visible = !readOnly; } //--------------------------------------- base.OnLoad(e); }
public void InitData(int? id, DetailsViewMode mode) { base.InitData<Product>(id, mode); if (id == null) return; var product = Db.Session.Get<Product>(id); if (product == null) return; if (mode == DetailsViewMode.Edit) { foreach (var picture in product.Pictures) { var tr = new TableRow(); var cel = new TableCell(); var i = new Image { ImageUrl = string.Format("~/Data/xs{0}.jpeg", picture.Id) }; cel.Controls.Add(i); var b = new HtmlInputButton { Value = "Wstaw" }; b.Attributes.Add("OnClick", string.Format(@"javascript:InsertImage('Data/xs{0}.jpeg')", picture.Id)); cel.Controls.Add(b); tr.Cells.Add(cel); ZdjeciaTable.Rows.Add(tr); } } DescriptionEdit.Text =product.Description; CategoryEdit.DataBind(); if (product.Category != null) { CategoryEdit.SelectedValue = product.Category.Id.ToString(); } }
/// <devdoc> /// <para>Loads the control state for those properties that should persist across postbacks /// even when EnableViewState=false.</para> /// </devdoc> protected internal override void LoadControlState(object savedState) { // Any properties that could have been set in the persistance need to be // restored to their defaults if they're not in ControlState, or they will // be restored to their persisted state instead of their empty state. _pageIndex = 0; _defaultMode = DetailsViewMode.ReadOnly; _dataKeyNames = new string[0]; _pageCount = 0; object[] state = savedState as object[]; if (state != null) { base.LoadControlState(state[0]); if (state[1] != null) { _pageIndex = (int)state[1]; } if (state[2] != null) { _defaultMode = (DetailsViewMode)state[2]; } // if Mode isn't saved, it should be restored to DefaultMode. That will happen in Mode's getter, // since the persistance state hasn't been loaded yet. if (state[3] != null) { Mode = (DetailsViewMode)state[3]; } if (state[4] != null) { _dataKeyNames = (string[])state[4]; } if (state[5] != null) { KeyTable.Clear(); OrderedDictionaryStateHelper.LoadViewState((OrderedDictionary)KeyTable, (ArrayList)state[5]); } if (state[6] != null) { _pageCount = (int)state[6]; } } else { base.LoadControlState(null); } }
public void ChangeMode(DetailsViewMode newMode) { Mode = newMode; }
/// <devdoc> /// <para>Initializes a new instance of <see cref='System.Web.UI.WebControls.DetailsViewModeEventArgs'/> class.</para> /// </devdoc> public DetailsViewModeEventArgs(DetailsViewMode mode, bool cancelingEdit) : base(false) { this._mode = mode; this._cancelingEdit = cancelingEdit; }
private void ConfiguraModoCRUD(DetailsViewMode novoModo) { dvAbertura.ChangeMode(novoModo); }
protected internal override void LoadControlState (object ob) { if (ob == null) return; object[] state = (object[]) ob; base.LoadControlState (state[0]); pageIndex = (int) state[1]; pageCount = (int) state[2]; CurrentMode = (DetailsViewMode) state[3]; dataKeyNames = (string[]) state[4]; defaultMode = (DetailsViewMode) state[5]; if (state [6] != null) ((IStateManager) DataKey).LoadViewState (state [6]); if (state [7] != null) ((IStateManager) OldEditValues).LoadViewState (state [7]); }
public void ChangeMode(DetailsViewMode mode) { DetailsViewEditItem.ChangeMode(mode); }
public DetailsViewModeEventArgs (DetailsViewMode mode, bool cancelingEdit) { this.mode = mode; this.cancelEdit = cancelingEdit; }
private void ConfiguraModoCRUD(DetailsViewMode novoModo) { dvPessoaSocio.ChangeMode(novoModo); }
private void ConfiguraModoCRUD(DetailsViewMode novoModo) { dvProcessoPeca.ChangeMode(novoModo); }
protected void ChangeMode(DetailsViewMode mode) { dvNews.ChangeMode(mode); pnlShow.Visible = mode == DetailsViewMode.Edit; }
public void ChangeMode (DetailsViewMode newMode) { CurrentMode = newMode; RequireBinding (); }
public DetailsViewModeEventArgs(DetailsViewMode mode, bool cancelingEdit) { }
public void ChangeMode(DetailsViewMode mode) { DvMap.ChangeMode(mode); }
public void ChangeMode (DetailsViewMode newMode) { DetailsViewModeEventArgs args = new DetailsViewModeEventArgs (newMode, false); OnModeChanging (args); if (!args.Cancel) { currentMode = args.NewMode; OnModeChanged (EventArgs.Empty); RequireBinding (); } }
protected internal override void LoadControlState(object savedState) { this._pageIndex = 0; this._defaultMode = DetailsViewMode.ReadOnly; this._dataKeyNames = new string[0]; this._pageCount = 0; object[] objArray = savedState as object[]; if (objArray != null) { base.LoadControlState(objArray[0]); if (objArray[1] != null) { this._pageIndex = (int) objArray[1]; } if (objArray[2] != null) { this._defaultMode = (DetailsViewMode) objArray[2]; } if (objArray[3] != null) { this.Mode = (DetailsViewMode) objArray[3]; } if (objArray[4] != null) { this._dataKeyNames = (string[]) objArray[4]; } if (objArray[5] != null) { this.KeyTable.Clear(); OrderedDictionaryStateHelper.LoadViewState(this.KeyTable, (ArrayList) objArray[5]); } if (objArray[6] != null) { this._pageCount = (int) objArray[6]; } } else { base.LoadControlState(null); } }
protected internal override void LoadControlState (object ob) { if (ob == null) return; object[] state = (object[]) ob; base.LoadControlState (state[0]); pageIndex = (int) state[1]; pageCount = (int) state[2]; currentMode = (DetailsViewMode) state[3]; }
protected override int CreateChildControls (IEnumerable data, bool dataBinding) { PagedDataSource dataSource; if (dataBinding) { DataSourceView view = GetData (); dataSource = new PagedDataSource (); dataSource.DataSource = data; if (AllowPaging) { dataSource.AllowPaging = true; dataSource.PageSize = 1; dataSource.CurrentPageIndex = PageIndex; if (view.CanPage) { dataSource.AllowServerPaging = true; if (view.CanRetrieveTotalRowCount) dataSource.VirtualCount = SelectArguments.TotalRowCount; else { dataSource.DataSourceView = view; dataSource.DataSourceSelectArguments = SelectArguments; dataSource.SetItemCountFromPageIndex (PageIndex + PagerSettings.PageButtonCount); } } } pageCount = dataSource.PageCount; } else { dataSource = new PagedDataSource (); dataSource.DataSource = data; if (AllowPaging) { dataSource.AllowPaging = true; dataSource.PageSize = 1; dataSource.CurrentPageIndex = PageIndex; } } bool showPager = AllowPaging && (PageCount > 1); Controls.Clear (); table = CreateTable (); Controls.Add (table); ArrayList list = new ArrayList (); if (!Page.IsPostBack) currentMode = DefaultMode; // Gets the current data item IEnumerator e = dataSource.GetEnumerator (); if (e.MoveNext ()) dataItem = e.Current; else dataItem = null; // Creates the set of fields to show ICollection fieldCollection = CreateFieldSet (dataItem, dataBinding); DataControlField[] fields = new DataControlField [fieldCollection.Count]; fieldCollection.CopyTo (fields, 0); foreach (DataControlField field in fields) { field.Initialize (false, this); if (EnablePagingCallbacks) field.ValidateSupportsCallback (); } // Main table creation if (HeaderText.Length != 0 || headerTemplate != null) { headerRow = CreateRow (-1, DataControlRowType.Header, DataControlRowState.Normal); DataControlFieldCell cell = new DataControlFieldCell (null); cell.ColumnSpan = 2; if (headerTemplate != null) headerTemplate.InstantiateIn (cell); else cell.Text = HeaderText; headerRow.Cells.Add (cell); table.Rows.Add (headerRow); } if (showPager && PagerSettings.Position == PagerPosition.Top || PagerSettings.Position == PagerPosition.TopAndBottom) { topPagerRow = CreateRow (-1, DataControlRowType.Pager, DataControlRowState.Normal); InitializePager (topPagerRow, dataSource); table.Rows.Add (topPagerRow); } if (dataSource.Count > 0) { foreach (DataControlField field in fields) { DataControlRowState rstate = GetRowState (list.Count); DetailsViewRow row = CreateRow (list.Count, DataControlRowType.DataRow, rstate); InitializeRow (row, field); table.Rows.Add (row); list.Add (row); if (commandField == field) commandRow = row; } if (!dataBinding) { if (CurrentMode == DetailsViewMode.Edit) oldEditValues = new DataKey (new OrderedDictionary ()); key = new DataKey (new OrderedDictionary (), DataKeyNames); } } else { table.Rows.Add (CreateEmptyrRow ()); } rows = new DetailsViewRowCollection (list); if (showPager && PagerSettings.Position == PagerPosition.Bottom || PagerSettings.Position == PagerPosition.TopAndBottom) { bottomPagerRow = CreateRow (-1, DataControlRowType.Pager, DataControlRowState.Normal); InitializePager (bottomPagerRow, dataSource); table.Rows.Add (bottomPagerRow); } if (FooterText.Length != 0 || footerTemplate != null) { footerRow = CreateRow (-1, DataControlRowType.Footer, DataControlRowState.Normal); DataControlFieldCell cell = new DataControlFieldCell (null); cell.ColumnSpan = 2; if (footerTemplate != null) footerTemplate.InstantiateIn (cell); else cell.Text = FooterText; footerRow.Cells.Add (cell); table.Rows.Add (footerRow); } if (dataBinding) DataBind (false); return dataSource.DataSourceCount; }
public void ChangeMode(DetailsViewMode newMode) { }
void ProcessChangeMode (DetailsViewMode newMode) { DetailsViewModeEventArgs args = new DetailsViewModeEventArgs (newMode, false); OnModeChanging (args); if (args.Cancel || !IsBoundUsingDataSourceID) return; ChangeMode (args.NewMode); OnModeChanged (EventArgs.Empty); }