public static JqgridTable ToTransactionJqGrid(this IEnumerable <order> rows, long viewerid) { var grid = new JqgridTable(); foreach (var row in rows) { var currency = row.currency.ToCurrency(); var sellingPrice = row.total.ToString("n" + currency.decimalCount); var transactionType = row.type.ToEnum <TransactionType>(); var entry = new JqgridRow { id = row.id.ToString(), cell = new object[] { string.Format("<div class='pl10'><span class='jqview' href='/dashboard/{0}/{1}'><strong>{2}</strong> #{3}</span><br/>{4}</div>", transactionType == TransactionType.INVOICE?"invoices":"orders", row.id, transactionType == TransactionType.INVOICE?"invoice":"order", row.orderNumber.ToString("D8"), row.orderDate.ToLocalTime().ToShortDateString()), row.ToOrderDetails(viewerid), currency.symbol + sellingPrice, string.Format("{0}{1}", row.GetStatusStringForGrid(row.receiverUserid == viewerid), row.GetJqGridActionString(viewerid)) } }; grid.rows.Add(entry); grid.records++; } return(grid); }
public static JqgridTable ToContactsJqGrid(this IEnumerable <user> values, long subdomainid) { var grid = new JqgridTable(); foreach (var value in values) { var entry = new JqgridRow { id = value.id.ToString(), cell = new object[] { value.id, "", value.ToProfilePhoto(Imgsize.THUMB, true).url.ToHtmlImage(), string.Concat(value.ToContactLink(subdomainid), SPLITSTRING, value.ToContactTypeLink()), value.organisation1.name, value.phoneNumber, value.ToContactLink(), value.organisation1.subdomain == subdomainid?string.Format("<a class='jqedit' href='/dashboard/contacts/edit/{0}'>edit</a>", value.id) : "" } }; grid.rows.Add(entry); } return(grid); }
public static JqgridTable ToEnrolJqGrid(this IEnumerable <registration> rows) { var grid = new JqgridTable(); foreach (var row in rows) { var entry = new JqgridRow(); entry.id = row.id.ToString(); entry.cell = new object[] { row.id, row.user.photo.HasValue ? Img.by_size(row.user.user_image.url, Imgsize.USER_THUMB).ToHtmlImage() : Img.PHOTO_NO_THUMBNAIL.ToHtmlImage(), row.user.ToJqName(), row.created.ToString(Constants.DATETIME_SHORT_DATE), row.ToEnrollingSchool(), row.enrollingYear.HasValue?row.enrollingYear.Value.ToString():"", row.ToStatus(), row.ToEnrolGridActions() }; grid.rows.Add(entry); } return(grid); }
public static JqgridTable ToGroupPricingJqGrid(this IEnumerable <contactGroupPricing> rows) { Currency currency = null; var grid = new JqgridTable(); foreach (var row in rows) { if (currency == null) { currency = row.product.MASTERsubdomain.currency.ToCurrency(); } var entry = new JqgridRow(); entry.id = row.id.ToString(); // handle external network locations string variantString = row.product.product_variants.ToJqgridModel(null); entry.cell = new object[] { row.id, "", row.product.thumb.HasValue ? Img.by_size(row.product.product_image.url, Imgsize.THUMB).ToHtmlImage() : GeneralConstants.PHOTO_NO_THUMBNAIL.ToHtmlImage(), row.product.ToProductTitle(), string.Format("<ul class='variant_jqgrid'>{0}</ul>", variantString), string.Concat(currency.symbol, row.price.ToString("n" + currency.decimalCount)) }; grid.rows.Add(entry); } return(grid); }
public static JqgridTable ToCouponsJqGrid(this IEnumerable <coupon> rows) { var grid = new JqgridTable(); Currency currency = null; foreach (var row in rows) { if (currency == null) { currency = row.MASTERsubdomain.currency.ToCurrency(); } var entry = new JqgridRow { id = row.id.ToString(), cell = new object[] { row.id, row.code, row.ToValueString(currency), row.ToDescriptionString(currency), row.startDate.ToString(GeneralConstants.DATEFORMAT_GRID), row.expiryDate.HasValue? row.expiryDate.Value.ToString(GeneralConstants.DATEFORMAT_GRID):"", row.impressions, row.expired?"<span class='error_post'>inactive</span>":"<span class='ok_post'>active</span>" } }; grid.rows.Add(entry); grid.records++; } return(grid); }
public static JqgridTable ToProductJqGrid(this IEnumerable <product> rows, inventoryLocation location) { var grid = new JqgridTable(); foreach (var row in rows) { var entry = new JqgridRow(); entry.id = row.id.ToString(); var items = row.product_variants.SelectMany(x => x.inventoryLocationItems); if (location != null) { items = items.Where(y => y.locationid == location.id); } int?inventoryLevel = items.All(x => x.available == null) ? null : items.Sum(y => y.available); // handle external network locations string variantString = ""; if (location != null) { switch (location.name) { case Networks.LOCATIONNAME_GBASE: variantString = row.gbase_product.ToJqgridModel(); break; case Networks.LOCATIONNAME_EBAY: variantString = row.ebay_product.ToJqgridModel(); break; default: variantString = row.product_variants.ToJqgridModel(location.id); break; } } else { variantString = row.product_variants.ToJqgridModel(null); } entry.cell = new object[] { row.id, "", row.thumb.HasValue ? Img.by_size(row.product_image.url, Imgsize.THUMB).ToHtmlImage() : GeneralConstants.PHOTO_NO_THUMBNAIL.ToHtmlImage(), row.ToProductTitle(), string.Format("<table class='jqgrid_variants'>{0}</table>", variantString), string.Format("<div class='bold larger'><a class='variant_transactions_link' href='/dashboard/product/transactions/{0}'>{1}</a></div>", row.id, inventoryLevel.ToInventoryLevelString()), row.hits }; grid.rows.Add(entry); } return(grid); }
public static JqgridTable ToExamsJqGrid(this IEnumerable <ioschools.DB.exam> rows) { var grid = new JqgridTable(); foreach (var row in rows) { var entry = new JqgridRow(); entry.id = row.id.ToString(); entry.cell = new object[] { row.id, row.id, row.ToJqGridNameColumn(), row.ToDetailsJqgridColumn(), string.Format("<span class='jqdelete'>delete</span>") }; grid.rows.Add(entry); } return(grid); }
public static JqgridTable ToBlogsJqGrid(this IEnumerable <ioschools.DB.blog> rows) { var grid = new JqgridTable(); foreach (var row in rows) { var entry = new JqgridRow(); entry.id = row.id.ToString(); entry.cell = new object[] { row.id, string.Format("<a class='bold' target='_blank' href='/news/{3}/{4}'>{0}</a><div class='font_grey'>{1} - {2}</div>", row.title, row.created.ToString(Constants.DATETIME_SHORT_DATE), row.user.ToName(false), row.id, row.title.ToSafeUrl()), row.ToStatus(), "<span class='jqedit'>edit</span><span class='jqdelete'>delete</span>" }; grid.rows.Add(entry); } return(grid); }
public static JqgridTable ToUsersJqGrid(this IEnumerable <ioschools.DB.user> rows, int year) { var grid = new JqgridTable(); foreach (var row in rows) { var entry = new JqgridRow(); entry.id = row.id.ToString(); entry.cell = new object[] { row.id, row.photo.HasValue ? Img.by_size(row.user_image.url, Imgsize.USER_THUMB).ToHtmlImage() : Img.PHOTO_NO_THUMBNAIL.ToHtmlImage(), row.ToJqName(), row.ToSchoolClass(year), row.ToContactInfo(), row.ToStatus(year), RenderActionLinks(row.id, row.usergroup == (int)UserGroup.STUDENT) }; grid.rows.Add(entry); } return(grid); }