protected void grdProducts_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e) { if (e.Column.FieldName == "Total") { decimal price = (decimal)e.GetListSourceFieldValue("UnitPrice"); int quantity = Convert.ToInt32(e.GetListSourceFieldValue("UnitsInStock")); e.Value = price * quantity; } }
protected void grid_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e) { if (e.Column.FieldName == "UrlText") { String url = e.GetListSourceFieldValue("NavigateUrl").ToString(); e.Value = url; } }
protected void gvxPaymentClinics_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e) { if (e.Column.FieldName == "Total Required") { PaymentRepository paymentRepository = new PaymentRepository(); e.Value = paymentRepository.GetAllCostTreatmentByClinic(int.Parse(e.GetListSourceFieldValue("ClinicID").ToString())); } else if (e.Column.FieldName == "Total Payed") { PaymentRepository paymentRepository = new PaymentRepository(); e.Value = paymentRepository.GetAllPayedReceitsByClinic(int.Parse(e.GetListSourceFieldValue("ClinicID").ToString())); } else if (e.Column.FieldName == "Total Deserved") { e.Value = decimal.Parse(e.GetListSourceFieldValue("Total Required").ToString()) - decimal.Parse(e.GetListSourceFieldValue("Total Payed").ToString()); } }
protected void ASPxGridView1_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e) { ASPxGridView grid = (ASPxGridView)sender; int visibleIndex = grid.FindVisibleIndexByKeyValue(e.GetListSourceFieldValue("ProductID")); e.Value = (visibleIndex != 0) ? Convert.ToInt32(grid.GetRowValues(visibleIndex, "UnitsInStock")) + Convert.ToInt32(grid.GetRowValues(visibleIndex - 1, "Total")) : Convert.ToInt32(grid.GetRowValues(visibleIndex, "UnitsInStock")); }
protected void gvxDoctor_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e) { ASPxGridView gvDoctor = (ASPxGridView)sender; int clinicID = int.Parse(gvDoctor.GetMasterRowKeyValue().ToString()); if (e.Column.FieldName == "Total Required") { PaymentRepository paymentRepository = new PaymentRepository(); e.Value = paymentRepository.GetAllTeratmentByDoctor(int.Parse(e.GetListSourceFieldValue("DoctorID").ToString()), clinicID); } else if (e.Column.FieldName == "Total Payed") { PaymentRepository paymentRepository = new PaymentRepository(); e.Value = paymentRepository.GetAllPaymentReceitByDoctor(int.Parse(e.GetListSourceFieldValue("DoctorID").ToString()), clinicID); } else if (e.Column.FieldName == "Total Deserved") { e.Value = decimal.Parse(e.GetListSourceFieldValue("Total Required").ToString()) - decimal.Parse(e.GetListSourceFieldValue("Total Payed").ToString()); } }
protected void gvCategories_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e) { object categoryID = e.GetListSourceFieldValue("CategoryID"); if (e.Column.FieldName == "UnitsInStock") { e.Value = DataHelper.ExecuteCommand(String.Format("SELECT SUM([UnitsInStock]) FROM [Products] WHERE ([CategoryID] = {0})", categoryID)); } if (e.Column.FieldName == "AverageUnitPrice") { e.Value = DataHelper.ExecuteCommand(String.Format("SELECT AVG([UnitPrice]) FROM [Products] WHERE ([CategoryID] = {0})", categoryID)); } }
protected void ASPxGridView1_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e) { if (e.Column.FieldName == "LowerBound") { Dictionary <object, int> lowerBoundStorage = Session["lowerBoundStorage"] as Dictionary <object, int>; if (lowerBoundStorage == null) { lowerBoundStorage = new Dictionary <object, int>(); Session["lowerBoundStorage"] = lowerBoundStorage; } object key = e.GetListSourceFieldValue(e.ListSourceRowIndex, "CategoryID"); if (lowerBoundStorage.ContainsKey(key)) { e.Value = lowerBoundStorage[key]; } else { e.Value = 0; } } }