public ActionResult barcode(FormCollection f, DymoViewModel model) { int update_counter = 0; //if (f.AllKeys.Contains("txtcode")) //{ // var vCode = f["txtcode"]; // string barCode = BarCodeToHTML.get39(vCode, 2, 20); // ViewBag.htmlBarcode = barCode; // ViewBag.vCode = vCode; //} var db_counter = (from m in db.asset_tag_counter where m.Company == "interconnection" select m.count).SingleOrDefault(); int i = int.Parse(f["txtcode_num"]); model.barcode_arr2 = new string[i]; model.vcode2 = new string[i]; for (int start = 0; start < i; start++) { db_counter = db_counter += 1; var vCode2 = db_counter.ToString(); update_counter = int.Parse(vCode2); string barCode2 = BarCodeToHTML.get39(vCode2, 2, 20); model.barcode_arr2[start] = barCode2; // ViewBag.htmlBarcode = barCode; string html = "<p style=\"page-break-after:always; text-align:center; \"><div style=\"clear: both\" id=\"div_print\"><img id=\"img\"src=\"/Barcode.ashx?m=1&h=60&vCode=" + vCode2 + "\" alt=\"" + vCode2 + "\" /> </div></p>"; model.vcode2[start] = html; } ViewBag.test = model.vcode2; ViewBag.vCode = "Default"; //update the barcode counter var updateQuery = new asset_tag_counter() { Company = "interconnection", count = update_counter }; db.asset_tag_counter.Attach(updateQuery); db.Entry(updateQuery).Property(x => x.count).IsModified = true; db.SaveChanges(); return(View()); }
public ActionResult Index(int?asset, string pre_coa, string product, DymoViewModel model, string myList) { if (string.IsNullOrEmpty(pre_coa) == true) { pre_coa = "00999-999-000-999"; } ViewBag.user = User.Identity.GetUserName(); ViewBag.channel = myList; ViewBag.pre_coa = pre_coa; ViewBag.pallet = product; ViewBag.asset = asset; ViewBag.time = DateTime.Now; var current_machine = (from m in db.rediscovery where m.ictag == asset select m).ToList(); // start update query var update = db.rediscovery.Single(u => u.ictag == asset); update.pre_coa = pre_coa; update.pallet = product; update.location = myList; update.refurbisher = User.Identity.GetUserName(); db.SaveChanges(); //end update query //iterate asset obj foreach (var item in current_machine) { ViewBag.CPU = item.cpu; ViewBag.HDD = item.hdd + " GB"; int temp_ram = int.Parse(item.ram); temp_ram = temp_ram / 1000; ViewBag.Ram = temp_ram + " GB"; ViewBag.Model = item.model; ViewBag.Serial = item.serial; } var channel_list = db.label_menu .Select(p => p.name) .Distinct().ToList(); SelectList list = new SelectList(channel_list); ViewBag.myList = list; return(View()); }