protected void Grid_ArtifactDetail_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { try { session.BeginTransaction(); e.Cancel = true; string rowstatus = Utility.Constant.ROWSTATUS_ACTIVE.ToString(); NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact legalInvoiceArtifactId = BO.get_LegalInvoiceArtifactId(session, LegalInvoiceArtifactId, rowstatus); LegalInvoiceArtifactDetail detail = new LegalInvoiceArtifactDetail(session); Item itemid = BO.get_ItemId(session, itemId, rowstatus); NAS.DAL.Nomenclature.Item.Unit unitid = BO.get_UnitId(session, unitID, rowstatus); //detail.ItemId = itemid; detail.Price = int.Parse(e.NewValues["Price"].ToString()); detail.Amount = int.Parse(e.NewValues["Amount"].ToString()); //detail.UnitId = unitid; detail.Total = int.Parse(e.NewValues["Total"].ToString()); detail.RowStatus = Utility.Constant.ROWSTATUS_ACTIVE; detail.LegalInvoiceArtifactId = legalInvoiceArtifactId; session.FlushChanges(); session.CommitTransaction(); Grid_ArtifactDetail.CancelEdit(); } catch (Exception) { session.RollbackTransaction(); throw; } }
protected void Grid_ArtifactDetail_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { try { session.BeginTransaction(); e.Cancel = true; string rowstatus = Utility.Constant.ROWSTATUS_ACTIVE.ToString(); LegalInvoiceArtifactDetail detail = session.FindObject <LegalInvoiceArtifactDetail>( CriteriaOperator.And( new BinaryOperator("LegalInvoiceArtifactId", LegalInvoiceArtifactId, BinaryOperatorType.Equal), new BinaryOperator("ItemId", e.NewValues["ItemId"].ToString(), BinaryOperatorType.Equal), new BinaryOperator("UnitId", e.NewValues["UnitId"].ToString(), BinaryOperatorType.Equal), new BinaryOperator("RowStatus", rowstatus, BinaryOperatorType.Equal) )); Item itemid = BO.get_ItemId(session, e.NewValues["ItemId"].ToString(), rowstatus); NAS.DAL.Nomenclature.Item.Unit unitid = BO.get_UnitId(session, e.NewValues["UnitId"].ToString(), rowstatus); //detail.ItemId = itemid; detail.Price = int.Parse(e.NewValues["Price"].ToString()); detail.Amount = int.Parse(e.NewValues["Amount"].ToString()); //detail.UnitId = unitid; detail.Total = int.Parse(e.NewValues["Total"].ToString()); session.FlushChanges(); session.CommitTransaction(); Grid_ArtifactDetail.CancelEdit(); } catch (Exception) { session.RollbackTransaction(); throw; } }
protected void Grid_ArtifactDetail_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e) { object val = Grid_ArtifactDetail.GetRowValuesByKeyValue(e.KeyValue, "ItemId!Key"); if (val == DBNull.Value || val == null) { return; } string item = (string)val; ASPxComboBox combo = e.Editor as ASPxComboBox; combo.Callback += new CallbackEventHandlerBase(cmb_Unit_OnCallback); }