protected void gvProcess_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { if (e.Column.FieldName == "STATUS") { e.DisplayText = e.Value.ToString() == "1" ? "激活" : "关闭"; } }
protected void grid_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { if (e.Column.Name != "RowNumber") { return; } ASPxGridView g = sender as ASPxGridView; if (IsGridUngrouped) { rowInGroupNumber = e.VisibleRowIndex + 1; } else { if (isFirstDisplayedRow) { rowInGroupNumber = e.VisibleRowIndex - GetParentGroupIndex(e.VisibleRowIndex); isFirstDisplayedRow = false; } else { if (IsRowIsFirstGroup(e.VisibleRowIndex)) { rowInGroupNumber = 1; } else { rowInGroupNumber++; } } } e.Value = rowInGroupNumber; e.DisplayText = rowInGroupNumber.ToString(); }
protected void grid_OnCustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { if (e.Column.FieldName == "PREV_FIRE_TIME") { long prevTime = long.Parse(e.GetFieldValue("PREV_FIRE_TIME").ToString()); if (prevTime > 0) { e.DisplayText = new DateTime(prevTime).AddHours(8).ToString("yyyy-MM-dd HH:mm:ss"); } else { e.DisplayText = "-----------------"; } } if (e.Column.FieldName == "NEXT_FIRE_TIME") { e.DisplayText = new DateTime(long.Parse(e.GetFieldValue("NEXT_FIRE_TIME").ToString())).AddHours(8).ToString("yyyy-MM-dd HH:mm:ss"); long nextTime = long.Parse(e.GetFieldValue("NEXT_FIRE_TIME").ToString()); if (nextTime > 0) { e.DisplayText = new DateTime(nextTime).AddHours(8).ToString("yyyy-MM-dd HH:mm:ss"); } else { e.DisplayText = "-----------------"; } } }
protected void gridModuleGroup_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { if (e.Column.FieldName == "STATUS") { e.DisplayText = e.Value.ToString() == "1" ? "启用" : "禁用"; } }
protected void gridviewGeneralJournal_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { if (e.Column.FieldName.Equals("AccountId!Key")) { Guid accountId = (Guid)e.Value; NAS.DAL.Accounting.AccountChart.Account account = session.GetObjectByKey <NAS.DAL.Accounting.AccountChart.Account>(accountId); e.DisplayText = String.Format("{0} - {1}", account.Code, account.Name); } }
protected void dg_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { for (int i = 0; i <= dg.Columns.Count - 1; i++) { if (dg.Columns[i] is GridViewCommandColumn) { text.Text = Convert.ToInt32(dg.Columns[i]).ToString(); } } }
protected void grid_CustomGroupDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { int ind = GetGroupNumber(e.Value.ToString()); switch (ind) { case 1: e.DisplayText = "A-E"; break; case 2: e.DisplayText = "F-J"; break; case 3: e.DisplayText = "K-Q"; break; case 4: e.DisplayText = "R-V"; break; case 5: e.DisplayText = "X-Z"; break; } }
protected void gridviewCustomField_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { if (e.Column.FieldName.Equals("CustomFieldType")) { string customFieldType = (string)e.Value; switch (customFieldType) { case CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_DEFAULT: e.DisplayText = "Người dùng tạo"; break; default: e.DisplayText = "Hệ thống"; break; } } }
protected void gridviewGeneralJournal_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { if (e.Column.FieldName.Equals("AccountId!Key")) { Guid accountId = (Guid)e.Value; NAS.DAL.Accounting.AccountChart.Account account = session.GetObjectByKey <NAS.DAL.Accounting.AccountChart.Account>(accountId); e.DisplayText = String.Format("{0} - {1}", account.Code, account.Name); } else if (e.Column.Name.Equals("DynamicObjectList")) { ASPxGridView grid = sender as ASPxGridView; //Get TransactionId var generalJournalId = grid.GetRowValues(e.VisibleRowIndex, "GeneralJournalId"); if (generalJournalId == null) { return; } //Get transction NAS.DAL.Accounting.Journal.GeneralJournal generalJournal = session.GetObjectByKey <NAS.DAL.Accounting.Journal.GeneralJournal>(generalJournalId); GeneralJournalObject generalJournalObject = generalJournal.GeneralJournalObjects.FirstOrDefault(); if (generalJournalObject != null) { ObjectBO objectBO = new ObjectBO(); DynamicObjectListSerialize dynamicObjectList = objectBO.GetDynamicObjectList(generalJournalObject.ObjectId.ObjectId); if (dynamicObjectList != null) { e.DisplayText = dynamicObjectList.ToString(); } } } else if (e.Column.FieldName.Equals("Credit") || e.Column.FieldName.Equals("Debit")) { double amount = double.Parse(e.Value.ToString()); if (amount == 0) { e.DisplayText = string.Empty; } else { e.DisplayText = string.Format("{0:#,###} VNĐ", amount); } } }
protected void xgvPerson_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { if (e.Column.FieldName == "DEPTID" || e.Column.FieldName == "MAINDEPTID") { e.DisplayText = ((from dept in dc.Department where dept.Deptnumber == e.Value.ToString() select dept).SingleOrDefault()) == null ? "" : (from dept in dc.Department where dept.Deptnumber == e.Value.ToString() select dept).SingleOrDefault().Deptname; } //if (e.Column.FieldName == "POSID") //{ // e.DisplayText = ((from pos in dc.Position // where pos.Posid.ToString() == e.Value.ToString() // select pos).SingleOrDefault()) == null ? "" : (from pos in dc.Position // where pos.Posid.ToString() == e.Value.ToString() // select pos).SingleOrDefault().Posname; //} }
protected void grid_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { if (e.Column.FieldName == "PartyDate" || e.Column.FieldName == "Birthday" || e.Column.FieldName == "JobDateTime" || e.Column.FieldName == "ComDateTime" || e.Column.FieldName == "ApplyPartyDate" || e.Column.FieldName == "FstGraduateDate" || e.Column.FieldName == "LstGraduateDate" ) { DateTime partyDate = Convert.ToDateTime(e.Value); if (partyDate.Year == 1900) { e.DisplayText = ""; } else { e.DisplayText = partyDate.ToString("yyyy-MM-dd"); } } }
protected void grdPaymentVoucher_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { ASPxGridView gridview = sender as ASPxGridView; if (e.Column.FieldName.Equals("EntryBookingStatus")) { try { Guid voucherId = (Guid)gridview.GetRowValues(e.VisibleRowIndex, "VouchesId"); bool isApproved = TransactionBO.isApprovedCosting <PaymentVouches>(session, voucherId); if (isApproved) { e.DisplayText = "Đã hạch toán"; } else { e.DisplayText = "Chưa hạch toán"; } } catch (Exception ex) { } } }
protected void gridVoucherAllocation_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { if (e.Column.FieldName.Equals("AllocationId!Key")) { if (e.Value != null) { Guid allocationId = (Guid)e.Value; Allocation allocation = session.GetObjectByKey <Allocation>(allocationId); e.DisplayText = allocation.Name; } } else if (e.Column.Name.Equals("MasterAccountActor")) { //Get name of master account actor var obj = gridVoucherAllocation.GetRowValues(e.VisibleRowIndex, "VoucherAllocationId"); if (obj != null) { Guid voucherAllocationId = (Guid)obj; VoucherAllocation voucherAllocation = session.GetObjectByKey <VoucherAllocation>(voucherAllocationId); VoucherAllocationRole voucherAllocationRoleMaster = voucherAllocation.VoucherAllocationRoles.Where(r => r.IsMaster).FirstOrDefault(); if (voucherAllocationRoleMaster == null) { e.DisplayText = String.Empty; } else { VoucherAllocationSubject subject = voucherAllocationRoleMaster.VoucherAllocationSubjectId; e.DisplayText = String.Format("{0}: {1} - {2}", subject.AccountActorTypeId.Name, subject.Code, subject.Name); } } } }
protected void dg_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { }
protected void gridviewBillItem_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e) { if (e.Column.FieldName.Equals("UnitId!Key")) { if (e.Value == null || e.Value == DBNull.Value) { return; } NAS.DAL.Nomenclature.Item.Unit unit = session.GetObjectByKey <NAS.DAL.Nomenclature.Item.Unit>(e.Value); e.DisplayText = String.Format("{0} - {1}", unit.Code, unit.Name); } else if (e.Column.FieldName.Equals("PromotionInPercentage")) { var billId = gridviewBillItem.GetRowValues(e.VisibleRowIndex, "BillId!Key"); if (billId == null) { return; } Bill bill = session.GetObjectByKey <Bill>(billId); if (bill.PromotionCalculationType.Equals(Utility.Constant.CALCULATION_TYPE_ON_ITEMS)) { if (e.Value == null || e.Value == DBNull.Value) { return; } double promotionInPercentage = (double)e.Value; if (promotionInPercentage == -1) { e.DisplayText = "N/A"; } else { e.DisplayText = promotionInPercentage.ToString(); } } else if (bill.PromotionCalculationType.Equals(Utility.Constant.CALCULATION_TYPE_ON_BILL_BY_AMOUNT) || bill.PromotionCalculationType.Equals(Utility.Constant.CALCULATION_TYPE_ON_BILL_BY_PERCENTAGE)) { e.DisplayText = "N/A"; e.Column.CellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#EFEFEF"); } } else if (e.Column.Name.Equals("VATInPercentage")) { var val = gridviewBillItem.GetRowValues(e.VisibleRowIndex, "BillItemId"); if (val == null) { return; } BillItem billItem = session.GetObjectByKey <BillItem>(val); BillItemTax billItemTax = billItem.BillItemTaxs.FirstOrDefault(); if (billItemTax != null) { e.DisplayText = billItemTax.TaxInPercentage.ToString(); } else { e.DisplayText = "N/A"; } } }