private void setCondition() { //绑定表数据 ASPxGridView1.DataSource = StationSubFactory.GetAll(); ASPxGridView1.DataBind(); }
private void setCondition() { //绑定表数据 List <StationSubEntity> allEntity = StationSubFactory.GetAll(); List <string> plines = new List <string>(); foreach (var p in allEntity) { if ((!plines.Contains(p.PLINE_CODE)) && (!string.IsNullOrWhiteSpace(p.PLINE_CODE))) { plines.Add(p.PLINE_CODE); } } ASPxGridView1.DataSource = allEntity; GridViewDataComboBoxColumn colPline = ASPxGridView1.Columns["PLINE_CODE"] as GridViewDataComboBoxColumn; List <ProductLineEntity> plineEntities = ProductLineFactory.GetByIDs(plines.ToArray()); colPline.PropertiesComboBox.DataSource = plineEntities; colPline.PropertiesComboBox.ValueField = "RMES_ID"; colPline.PropertiesComboBox.TextField = "PLINE_NAME"; ASPxGridView1.DataBind(); }
protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { string id = e.Values["RMES_ID"] as string; StationSubEntity entity = StationSubFactory.GetByKey(id); StationSubFactory.Delete(entity); }
protected void ASPxGridView1_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { //判断当前记录是否可以删除 string strCode = e.Values["STATION_CODE_SUB"].ToString(); StationSubEntity entSub = StationSubFactory.GetByKey(strCode); db.Delete(entSub); setCondition(); e.Cancel = true; }
protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { //修改记录 string strCode = e.OldValues["STATION_CODE_SUB"].ToString(); StationSubEntity entSub = StationSubFactory.GetByKey(strCode); entSub.PLINE_CODE = e.NewValues["PLINE_CODE"].ToString(); entSub.STATION_CODE = e.NewValues["STATION_CODE"].ToString(); entSub.STATION_CODE_SUB = e.NewValues["STATION_CODE_SUB"].ToString(); entSub.STATION_NAME_SUB = e.NewValues["STATION_NAME_SUB"].ToString(); db.Update(entSub); e.Cancel = true; ASPxGridView1.CancelEdit(); setCondition(); }
protected void ASPxGridView1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { if (ASPxGridView1.IsEditing) { string id = e.NewValues["RMES_ID"] as string; string plineCode = e.NewValues["PLINE_CODE"] as string; string station = e.NewValues["STATION_CODE"] as string; string stationSub = e.NewValues["STATION_CODE_SUB"] as string; StationSubEntity entity = StationSubFactory.GetByKey(id); entity.PLINE_CODE = plineCode; entity.STATION_CODE = station; entity.STATION_CODE_SUB = stationSub; StationSubFactory.Update(entity); e.Cancel = true; ASPxGridView1.CancelEdit(); setCondition(); } }
protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { if (ASPxGridView1.IsNewRowEditing) { string plineCode = e.NewValues["PLINE_CODE"] as string; string station = e.NewValues["STATION_CODE"] as string; string stationSub = e.NewValues["STATION_CODE_SUB"] as string; StationSubEntity entity = new StationSubEntity { COMPANY_CODE = "01", PLINE_CODE = plineCode, STATION_CODE = station, STATION_CODE_SUB = stationSub }; StationSubFactory.Insert(entity); e.Cancel = true; ASPxGridView1.CancelEdit(); setCondition(); } }