public static DataTable ActivityByNameReport(ASPxGridView grid, BizPortalSessionContext context) { var dt = new DataTable(); dt.Columns.Add("No", typeof(int)); dt.Columns.Add("LoginName"); dt.Columns.Add("UserName"); dt.Columns.Add("GroupTitle"); dt.Columns.Add("UserRoles"); dt.Columns.Add("LastLogin"); dt.Columns.Add("LastAction"); dt.Columns.Add("Details"); dt.Columns.Add("PrintBy"); dt.Columns.Add("PrintTS"); DateTime printTS = DateTime.Now; for (int i = 0; i < grid.VisibleRowCount; i++) { object[] log = ((DataRowView)grid.GetRow(i)).Row.ItemArray; dt.Rows.Add((i + 1), log[1].ToString(), log[2].ToString(), log[3].ToString(), log[4].ToString(), ((DateTime)log[5] == TimeInterval.MinDate) ? "" : ((DateTime)log[5]).ToString("dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture), log[6].ToString(), LogSystem.StripTagsCharArray(log[7].ToString()), (context.User == null) ? "" : context.User.LoginName, printTS.ToString("dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture) ); } return(dt); }
/// <summary> /// Delete target Bracket in gridview of visibleIndwx /// </summary> /// <param name="brackets"></param> /// <param name="gridView"></param> /// <param name="visibleIndex"></param> /// <param name="targetIndex"></param> /// <param name="lowerBound"></param> /// <param name="mockBracketId"></param> public static void DeleteBarcket(ref IList <FeeBracket> brackets, ASPxGridView gridView, string visibleIndex, ref int targetIndex, ref string lowerBound, ref int mockBracketId) { IList <FeeBracket> deletes = brackets; int size = deletes.Count - 1; // array start 0 FeeBracket feeBracket = (FeeBracket)gridView.GetRow(Int32.Parse(visibleIndex)); int index = feeBracket.TempID; targetIndex = index; lowerBound = feeBracket.LowerBound.ToString(); for (int i = size; i >= index; i--) { deletes.RemoveAt(i); --mockBracketId; } brackets = deletes; switch (index) { case 0: mockBracketId = 0; break; default: break; } }
public static DataTable ActivityLogClientReport(ASPxGridView grid, BizPortalSessionContext context) { var dt = new DataTable(); dt.Columns.Add("DateTime"); dt.Columns.Add("MemberNo"); dt.Columns.Add("MemberName"); dt.Columns.Add("MakerName"); dt.Columns.Add("Action"); dt.Columns.Add("Detail"); dt.Columns.Add("PrintBy"); dt.Columns.Add("PrintTS"); DateTime printTS = DateTime.Now; for (int i = 0; i < grid.VisibleRowCount; i++) { object[] log = ((DataRowView)grid.GetRow(i)).Row.ItemArray; dt.Rows.Add( ((DateTime)log[1] == TimeInterval.MinDate) ? "" : ((DateTime)log[1]).DateTimeFormat("dd/MM/yyyy HH:mm:ss"), log[3].ToString(), log[4].ToString(), log[7].ToString(), LogSystem.StripTagsCharArray(log[11].ToString()), LogSystem.StripTagsCharArray(log[12].ToString()), (context.User == null) ? "" : context.User.LoginName, printTS.DateTimeFormat("dd/MM/yyyy HH:mm:ss") ); } return(dt); }
public static DataTable AcitivityInaction(ASPxGridView grid, BizPortalSessionContext context) { var dt = new DataTable(); dt.Columns.Add("No", typeof(int)); dt.Columns.Add("LoginName"); dt.Columns.Add("UserName"); dt.Columns.Add("GroupTitle"); dt.Columns.Add("UserRoles"); dt.Columns.Add("MemberUserCreateDate"); dt.Columns.Add("Status"); dt.Columns.Add("LastLogin"); dt.Columns.Add("PrintBy"); dt.Columns.Add("PrintTS"); DateTime printTS = DateTime.Now; for (int i = 0; i < grid.VisibleRowCount; i++) { object[] log = ((DataRowView)grid.GetRow(i)).Row.ItemArray; dt.Rows.Add((i + 1), log[1].ToString(), log[2].ToString(), log[3].ToString(), log[4].ToString(), ((DateTime)log[5]).DateTimeFormat("dd/MM/yyyy HH:mm"), GetStatusInnerHTML(log[5].ToString(), "en-US"), ((DateTime)log[7]).DateTimeFormat("dd/MM/yyyy HH:mm"), (context.User == null) ? "" : context.User.LoginName, printTS.DateTimeFormat("dd/MM/yyyy HH:mm:ss") ); } return(dt); }
public static T GetRowObject <T>(ASPxGridView gv, long visibleIndex) { if (gv == null) { return(default(T)); } return((T)gv.GetRow(int.Parse(visibleIndex.ToString(CultureInfo.InvariantCulture)))); }
void gridView_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { string[] parameters = e.Parameters.Split('|'); if (parameters.Length == 2 && (parameters[0] == "up" || parameters[0] == "down")) { ASPxGridView gridView = (ASPxGridView)sender; Object key = TypeDescriptor.GetConverter(View.ObjectTypeInfo.KeyMember.MemberType).ConvertFromString(parameters[1]); int rowIndex = gridView.FindVisibleIndexByKeyValue(key); if (parameters[0] == "up" && rowIndex > 0) { SwitchIndices((DomainObject1)gridView.GetRow(rowIndex), (DomainObject1)gridView.GetRow(rowIndex - 1)); } if (parameters[0] == "down" && rowIndex < gridView.VisibleRowCount - 1) { SwitchIndices((DomainObject1)gridView.GetRow(rowIndex), (DomainObject1)gridView.GetRow(rowIndex + 1)); } } }
public static DataTable MemberUserReport(ASPxGridView grid, BizPortalSessionContext context) { var dt = new DataTable(); dt.Columns.Add("No", typeof(int)); dt.Columns.Add("LoginName"); dt.Columns.Add("UserName"); dt.Columns.Add("Group"); dt.Columns.Add("EffectiveFrom"); dt.Columns.Add("EffectiveTo"); dt.Columns.Add("CreaterName"); dt.Columns.Add("CreateActionDate"); dt.Columns.Add("ApproverName"); dt.Columns.Add("ApproveActionDate"); dt.Columns.Add("UpdateName"); dt.Columns.Add("UpdateDate"); dt.Columns.Add("LastLogin"); dt.Columns.Add("LastLogout"); dt.Columns.Add("LastFailed"); dt.Columns.Add("LastFailedCount", typeof(int)); dt.Columns.Add("Status"); dt.Columns.Add("StatusTransaction"); dt.Columns.Add("PrintBy"); dt.Columns.Add("PrintTS"); DateTime printTS = DateTime.Now; for (int i = 0; i < grid.VisibleRowCount; i++) { var item = ((DataRowView)grid.GetRow(i)).Row.ItemArray; dt.Rows.Add( (i + 1).ToString(), item[1].ToString(), //LoginName item[2].ToString(), //Person.NameWithoutAffixes item[3].ToString(), //EffectiveMemberGroups ((DateTime)item[4]).DateTimeFormat("dd/MM/yyyy HH:mm"), //EffectivePeriodFrom ((DateTime)item[5]).DateTimeFormat("dd/MM/yyyy HH:mm"), //EffectivePeriodTo item[6].ToString(), //CreateBy ((DateTime)item[7]).DateTimeFormat("dd/MM/yyyy HH:mm"), //CreateTS item[8].ToString(), //ApproveBy ((DateTime)item[9]).DateTimeFormat("dd/MM/yyyy HH:mm"), //ApproveTS item[10].ToString(), //UpdateBy ((DateTime)item[11]).DateTimeFormat("dd/MM/yyyy HH:mm"), //UpdateTS ((DateTime)item[12]).DateTimeFormat("dd/MM/yyyy HH:mm"), //LastLoginTimestamp ((DateTime)item[13]).DateTimeFormat("dd/MM/yyyy HH:mm"), //LastLogoutTS ((DateTime)item[14]).DateTimeFormat("dd/MM/yyyy HH:mm"), //LastFailedLoginTimestamp item[15].ToString(), //User.ConsecutiveFailedLoginCount LogSystem.StripTagsCharArray(item[16].ToString()), //Status item[17].ToString(), //IsNotFinalized (context.User == null) ? "" : context.User.LoginName, printTS.ToString("dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture) ); } return(dt); }
public static DataTable MemberUserReportCancel(ASPxGridView grid, BizPortalSessionContext context) { var dt = new DataTable(); dt.Columns.Add("LoginName"); dt.Columns.Add("UserName"); dt.Columns.Add("Group"); dt.Columns.Add("EffectiveMemberGroups"); dt.Columns.Add("EffectiveFrom"); dt.Columns.Add("EffectiveTo"); dt.Columns.Add("CreaterName"); dt.Columns.Add("CreateActionDate"); dt.Columns.Add("ApproverName"); dt.Columns.Add("ApproveActionDate"); dt.Columns.Add("UpdateName"); dt.Columns.Add("UpdateDate"); dt.Columns.Add("LastLogin"); dt.Columns.Add("LastLogout"); dt.Columns.Add("LastFailed"); dt.Columns.Add("LastFailedCount"); dt.Columns.Add("Status"); dt.Columns.Add("StatusTransaction"); dt.Columns.Add("PrintBy"); dt.Columns.Add("PrintTS"); DateTime printTS = DateTime.Now; for (int i = 0; i < grid.VisibleRowCount; i++) { var mu = (MemberUser)grid.GetRow(i); dt.Rows.Add( mu.LoginName, mu.Name.ToString(), LogSystem.GetGroupTitles(mu.EffectiveMemberGroups), (mu.EffectivePeriod.EffectiveDate == TimeInterval.MinDate) ? "" : mu.EffectivePeriod.EffectiveDate.DateTimeFormat(), (mu.EffectivePeriod.ExpiryDate == TimeInterval.MinDate) ? "" : mu.EffectivePeriod.ExpiryDate.DateTimeFormat(), mu.CreateAction == null ? string.Empty : mu.CreateAction.ByUser.LoginName, mu.CreateAction == null ? string.Empty : mu.CreateAction.Timestamp.DateTimeFormat(), mu.ApproveAction == null ? string.Empty : mu.ApproveAction.ByUser.LoginName, mu.ApproveAction == null ? string.Empty : mu.ApproveAction.Timestamp.DateTimeFormat(), mu.UpdateAction.ByUser == null ? string.Empty : mu.UpdateAction.ByUser.LoginName, (mu.UpdateAction.Timestamp == TimeInterval.MinDate) ? "" : mu.UpdateAction.Timestamp.DateTimeFormat(), (mu.LastLoginTimestamp == TimeInterval.MinDate) ? "" : mu.LastLoginTimestamp.DateTimeFormat(), (mu.LastLogoutTS == TimeInterval.MinDate) ? "" : mu.LastLogoutTS.DateTimeFormat(), (mu.LastFailedLoginTimestamp == TimeInterval.MinDate) ? "" : mu.LastFailedLoginTimestamp.DateTimeFormat(), Convert.ToString(mu.ConsecutiveFailedLoginCount), LogSystem.StripTagsCharArray(UserService.GetUserStatus(mu, "en-US")), (mu.IsNotFinalized || mu.IsNotFinalized) ? "รà¸à¸à¸™à¸¸à¸¡à¸±à¸•à¸´" : "", (context.User == null) ? "" : context.User.LoginName, printTS.ToString("dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture) ); } return(dt); }
protected void grid_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e) { ASPxGridView grid = sender as ASPxGridView; DataRowView row = (DataRowView)grid.GetRow(clickedRowIndex); foreach (DataColumn column in row.DataView.Table.Columns) { e.NewValues[column.ColumnName] = row[column.ColumnName]; } }
public static IList <T> GetSelectedOnGridView <T>(ASPxGridView gv) { IList <T> listId = new List <T>(); for (int i = 0; i < gv.VisibleRowCount; i++) { if (gv.Selection.IsRowSelected(i)) { listId.Add((T)gv.GetRow(i)); } } return(listId); }
protected BootstrapChartDataItem[] GetBootstrapChartData() { DataRow gridDataRow; BootstrapChartDataItem[] BootstrapChartDataItems = new BootstrapChartDataItem[ASPxGridView.VisibleRowCount]; for (int i = 0; i < ASPxGridView.VisibleRowCount; i++) { gridDataRow = (ASPxGridView.GetRow(i) as DataRowView).Row; BootstrapChartDataItems[i] = new BootstrapChartDataItem(gridDataRow.Field <string>("CategoryName"), gridDataRow.Field <decimal>("CategorySales")); } return(BootstrapChartDataItems); }
public object GetFocusedObject(CollectionSourceBase collectionSource) { if (_inGetFocusedObject || _gridView == null) { return(null); } try { _inGetFocusedObject = true; if (_gridView.FocusedRowIndex == -1) { return(null); } return(_gridView.GetRow(_gridView.FocusedRowIndex)); } finally { _inGetFocusedObject = false; } }
public bool ExibirBotao(ASPxGridView grid, int visibleIndex) { object row = grid.GetRow(visibleIndex); string arquivo = ""; if (visibleIndex != 0) { arquivo = grid.GetRowValues(visibleIndex, "ARQUIVO").ToString(); } if (string.IsNullOrEmpty(arquivo)) { return false; } else { return true; } }
protected void cbClickGdvRow_Callback(object sender, CallbackEventArgs e) { JsonObjectCollection objs = new JsonObjectCollection(); DataRow dr = null; if (!string.IsNullOrEmpty(e.Parameter)) { gdvMFCustomers.DataBind(); int index = int.Parse(e.Parameter); DataRowView drv = (DataRowView)gdvMFCustomers.GetRow(index); if (drv != null) { dr = drv.Row; } } else { string customerNo = bteMFCustomers.Text; if (!string.IsNullOrEmpty(customerNo)) { sqlDataSource.FilterExpression = "CustomerNO = '{0}'"; sqlDataSource.FilterParameters.Add("CustomerNO", customerNo); DataView dv = (DataView)sqlDataSource.Select(new DataSourceSelectArguments()); DataTable dt = dv.ToTable(); if (dt.Rows.Count > 0) { dr = dt.Rows[0]; } sqlDataSource.FilterExpression = string.Empty; sqlDataSource.FilterParameters.Clear(); } } if (dr != null) { objs.Add(new JsonNumericValue("custID", (int)dr[gdvMFCustomers.KeyFieldName])); objs.Add(new JsonStringValue("custNo", dr["CustomerNO"].ToString())); objs.Add(new JsonStringValue("custName", dr["CustomerName"].ToString())); } else { objs.Add(new JsonNumericValue("custID", 0)); objs.Add(new JsonStringValue("custNo", string.Empty)); objs.Add(new JsonStringValue("custName", string.Empty)); } e.Result = objs.ToString(); }
public static DataTable AccessLogCustomerReport(ASPxGridView grid, BizPortalSessionContext context , string reportType, string durationDate, string member, string groupUser) { var dt = new DataTable(); dt.Columns.Add("No", typeof(int)); dt.Columns.Add("Date"); dt.Columns.Add("MemberNo"); dt.Columns.Add("MemberName"); dt.Columns.Add("LoginName"); dt.Columns.Add("Status"); dt.Columns.Add("LoginType"); dt.Columns.Add("LoginAction"); dt.Columns.Add("ReportType"); dt.Columns.Add("DurationDate"); dt.Columns.Add("Member"); dt.Columns.Add("GroupUser"); dt.Columns.Add("PrintBy"); dt.Columns.Add("PrintTS"); DateTime printTS = DateTime.Now; for (int i = 0; i < grid.VisibleRowCount; i++) { object[] log = ((DataRowView)grid.GetRow(i)).Row.ItemArray; dt.Rows.Add((i + 1), ((DateTime)log[1] == TimeInterval.MinDate) ? "" : ((DateTime)log[1]).DateTimeFormat("dd/MM/yyyy HH:mm:ss"), log[3], log[4], log[6], LogSystem.StripTagsCharArray(log[7].ToString()), log[10], log[12], reportType, //ReportType durationDate, //DurationDate member, //Member groupUser, //GroupUser (context.User == null) ? "" : context.User.LoginName, printTS.DateTimeFormat("dd/MM/yyyy HH:mm:ss") ); } return(dt); }
protected void detailGrid_CustomButtonInitialize(object sender, ASPxGridViewCustomButtonEventArgs e) { int idx = e.VisibleIndex; if (e.VisibleIndex == -1) { return; } if (e.ButtonID == "btnID") { ASPxGridView grid = (ASPxGridView)sender; object row = grid.GetRow(idx); string subjid = ((DataRowView)row)["subjid"].ToString(); string id = ((DataRowView)row)["id"].ToString(); e.Text = id; } }
private bool DocumentButtonVisibleCriteria(ASPxGridView grid, int visibleIndex) { object row = grid.GetRow(visibleIndex); return(((DataRowView)row)["Documment"].ToString() == "No Document"); }
private bool EditButtonVisibleCriteria(ASPxGridView grid, int visibleIndex) { object row = grid.GetRow(visibleIndex); return(bool.Parse(((DataRowView)row)["ISLooK"].ToString())); }
public static object GetItem(this ASPxGridView source, int visibleIndex) { return(visibleIndex != ASPxGridView.InvalidRowIndex ? source.GetRow(visibleIndex) : null); }
public static object EditingItem(this ASPxGridView source) { return(source.GetRow(source.EditingRowVisibleIndex)); }
protected void grid_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { try { ASPxGridView grv = (sender as ASPxGridView); if (e.VisibleIndex > -1) { if (e.DataColumn.FieldName == "SendToMarketing") { DataRowView row = grv.GetRow(e.VisibleIndex) as DataRowView; string bpk = row["BPK"].ToString(); ASPxButton btnSend = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "btnSend") as ASPxButton; ASPxLabel lblSend = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblSend") as ASPxLabel; string caption = e.CellValue.ToString();// Convert.ToString(e.CellValue); if (caption == string.Empty && !string.IsNullOrEmpty(bpk)) { btnSend.Visible = true; lblSend.Visible = false; } else { lblSend.Text = caption; btnSend.Visible = false; lblSend.Visible = true; } } if (e.DataColumn.FieldName == "PrintNik") { ASPxButton btnPrintNik = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "btnPrintNIK") as ASPxButton; ASPxLabel lblPrintNik = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblPrintNIK") as ASPxLabel; string caption = e.CellValue.ToString("yyyy-MM-dd");// Convert.ToString(e.CellValue); if (caption != string.Empty) { lblPrintNik.Text = caption; btnPrintNik.Visible = false; lblPrintNik.Visible = true; } else { btnPrintNik.Visible = false; lblPrintNik.Visible = false; } } if (e.DataColumn.FieldName == "ReceivedByMarketing") { ASPxButton btnRCV = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "btnRCV") as ASPxButton; ASPxLabel lblRCV = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblRCV") as ASPxLabel; string caption = e.CellValue.ToString();// Convert.ToString(e.CellValue); if (caption != string.Empty) { lblRCV.Text = caption; btnRCV.Visible = false; lblRCV.Visible = true; } else { btnRCV.Visible = false; lblRCV.Visible = false; } } if (e.DataColumn.FieldName == "BPK") { ASPxButton btnBPK = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "btnBPK") as ASPxButton; ASPxLabel lblBPK = grv.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "lblBPK") as ASPxLabel; string caption = e.CellValue.ToString();// Convert.ToString(e.CellValue); if (caption != string.Empty) { lblBPK.Text = caption; btnBPK.Visible = false; lblBPK.Visible = true; } else { btnBPK.Visible = false; lblBPK.Visible = false; } } } } catch (Exception ex) { AppLogger.LogError(ex); } }
private bool DeleteButtonVisibleCriteria(ASPxGridView grid, int visibleIndex) { object row = grid.GetRow(visibleIndex); return(((DataRowView)row)["ProductName"].ToString().Contains("b")); }
private bool DeleteButtonVisibleCriteria(ASPxGridView grid, int visibleIndex) { object row = grid.GetRow(visibleIndex); return(((InvoiceModel.InvoiceHeader)(row)).StatusDesc.ToString().ToUpper().Contains("SAVE")); }
protected void gdvPartyAttribute_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { ASPxGridView gdv = (ASPxGridView)sender; ITransaction tx = iSabayaContext.PersistenceSession.BeginTransaction(); JsonObjectCollection objs = new JsonObjectCollection(); bool isSetNewFoucused = false; bool isCommit = true; long attributeID = 0; string msg = ""; try { string[] parameters = e.Parameters.Split(';'); switch (parameters[0]) { case KEY_EDIT: attributeID = this.CreatePartyAttribute(long.Parse(parameters[1])); isSetNewFoucused = true; break; case KEY_EXPIRE: int index = Int32.Parse(parameters[1]); if (OwnerID == 0) { gdv.DataBind(); PartyAttribute attribute = (PartyAttribute)gdv.GetRow(index); ICategorizedTemporalList <PartyAttribute> attributes = PartyAttributes; for (int i = 0; i < attributes.Count; i++) { if (attributes[i].AttributeKey == attribute.AttributeKey) { attributes.Remove(attributes[i]); break; } } } else { attributeID = (int)gdv.GetRowValues(index, gdv.KeyFieldName); this.ExpirePartyAttribute(attributeID); } break; // when owner id = 0 only case "clear": if (OwnerID == 0) { PartyAttributes.Clear(); } break; default: isCommit = false; break; } if (isCommit) { tx.Commit(); } gdv.DataBind(); if (attributeID > 0 && isSetNewFoucused) { for (int i = gdv.VisibleRowCount - 1; i >= gdv.VisibleStartIndex; i--) { if ((int)gdv.GetRowValues(i, gdv.KeyFieldName) == attributeID) { gdv.FocusedRowIndex = i; break; } } } else { gdv.FocusedRowIndex = 0; } } catch (Exception ex) { if (isCommit) { tx.Rollback(); } while (ex != null) { msg = ex.Message + "\n" + msg; ex = ex.InnerException; } gdv.DataBind(); } objs.Add(new JsonNumericValue("AttributeID", attributeID)); objs.Add(new JsonStringValue("Message", msg)); gdv.JSProperties[KEY_CP_RESULT] = objs.ToString(); }