public ActionResult ChargeCartridge() { PrinterToner printerToner = new PrinterToner(_db); string strSerialNumber = Request.QueryString["SerialNumber"].ToString(); IEnumerable <ChargeCartridge> chargeCartridge = (from c in _db.t_ChargeCartridges where c.SerialNumber == strSerialNumber orderby c.ChargeDate select new ChargeCartridge { OldRemainToner = c.OldRemainToner, NewRemainToner = c.NewRemainToner, PageCount = c.PageCount, ColorToner = c.ColorToner, ChargeDate = c.ChargeDate }).ToList(); return(PartialView(chargeCartridge)); }
private void GetPrinterToner(Dictionary <Oid, AsnType> Inks, int numToner) { for (int i = 0; i < numToner; i++) { PrinterToner toner = new PrinterToner(); //1.3.6.1.2.1.43.11.1.1.6.1. string MarkerSuppliesDescription = "1.3.6.1.2.1.43.11.1.1.6.1." + (i + 1).ToString(); toner.MarkerSuppliesDescription = Inks[new Oid(MarkerSuppliesDescription)].ToString(); //.1.3.6.1.2.1.43.11.1.1.9.1.1 string MarkerSuppliesLevel = "1.3.6.1.2.1.43.11.1.1.9.1." + (i + 1).ToString(); toner.MarkerSuppliesLevel = Inks[new Oid(MarkerSuppliesLevel)].ToString(); //1.3.6.1.2.1.43.11.1.1.8.1. string MarkerSuppliesMaxCapacity = "1.3.6.1.2.1.43.11.1.1.8.1." + (i + 1).ToString(); toner.MarkerSuppliesMaxCapacity = Inks[new Oid(MarkerSuppliesMaxCapacity)].ToString(); toner.Precent = (int)(double.Parse(toner.MarkerSuppliesLevel) / double.Parse(toner.MarkerSuppliesMaxCapacity) * 100); Printertoners.Add(toner); } }
public ActionResult Index() { PrinterToner printerToner = new PrinterToner(_db); return(View(printerToner.StateToner())); }