Exemplo n.º 1
0
        public ActionResult testcheck1(string data)
        {
            StringBuilder sb = new StringBuilder(data);

            sb.Append(CheckA.checksum(data));

            ViewData["Qrcode"] = sb.ToString();

            return(Content("62210" + sb.ToString()));
        }
Exemplo n.º 2
0
        public ActionResult exceportMbills()
        {
            var mb1 = mb1Service.GetEntities(b => true).AsQueryable().ToList();

            List <string> checkesum1 = new List <string>();

            foreach (var item in mb1)
            {
                string        b          = item.account.ToString().Substring(item.account.ToString().Length - 3, 3);
                string        straccount = b;
                StringBuilder sb         = new StringBuilder();
                sb.Append(straccount);
                sb.Append(item.billno.ToString());
                // sb.ToString();
                string Ocode = CheckA.checksum(sb.ToString());
                checkesum1.Add("62210" + sb.ToString() + Ocode);
            }
            HSSFWorkbook book = new HSSFWorkbook();

            ISheet sheet1 = book.CreateSheet("sheet1");
            IRow   row1   = sheet1.CreateRow(0);

            row1.CreateCell(0).SetCellValue("account");
            row1.CreateCell(2).SetCellValue("billno");
            row1.CreateCell(3).SetCellValue("prev");
            row1.CreateCell(4).SetCellValue("pres");
            row1.CreateCell(5).SetCellValue("unit");
            row1.CreateCell(6).SetCellValue("type");
            row1.CreateCell(7).SetCellValue("bf");
            row1.CreateCell(8).SetCellValue("odd");
            row1.CreateCell(9).SetCellValue("chg");
            row1.CreateCell(10).SetCellValue("misc");
            row1.CreateCell(11).SetCellValue("bill");
            row1.CreateCell(12).SetCellValue("auto");
            row1.CreateCell(13).SetCellValue("descs");
            row1.CreateCell(14).SetCellValue("name");
            row1.CreateCell(15).SetCellValue("address1");
            row1.CreateCell(16).SetCellValue("address2");
            row1.CreateCell(17).SetCellValue("address3");
            row1.CreateCell(18).SetCellValue("date");

            row1.CreateCell(1).SetCellValue("paycode");
            for (int i = 0; i < mb1.Count; i++)
            {
                IRow rowtemp = sheet1.CreateRow(i + 1);
                rowtemp.CreateCell(0).SetCellValue(mb1[i].account.ToString());
                rowtemp.CreateCell(1).SetCellValue(checkesum1[i].ToString());
                rowtemp.CreateCell(2).SetCellValue(mb1[i].billno.ToString());
                rowtemp.CreateCell(3).SetCellValue(mb1[i].prev.ToString());
                rowtemp.CreateCell(4).SetCellValue(mb1[i].pres.ToString());
                rowtemp.CreateCell(5).SetCellValue(mb1[i].unit.ToString());
                rowtemp.CreateCell(6).SetCellValue(mb1[i].type.ToString());
                rowtemp.CreateCell(7).SetCellValue(mb1[i].bf.ToString());
                rowtemp.CreateCell(8).SetCellValue(mb1[i].odd.ToString());
                rowtemp.CreateCell(9).SetCellValue(mb1[i].chg.ToString());
                rowtemp.CreateCell(10).SetCellValue(mb1[i].misc.ToString());
                rowtemp.CreateCell(11).SetCellValue(mb1[i].bill.ToString());
                rowtemp.CreateCell(12).SetCellValue(mb1[i].auto.ToString());
                rowtemp.CreateCell(13).SetCellValue(mb1[i].descs.ToString());
                rowtemp.CreateCell(14).SetCellValue(mb1[i].name.ToString());
                rowtemp.CreateCell(15).SetCellValue(mb1[i].address1.ToString());
                rowtemp.CreateCell(16).SetCellValue(mb1[i].address2.ToString());
                rowtemp.CreateCell(17).SetCellValue(mb1[i].address3.ToString());
                rowtemp.CreateCell(18).SetCellValue(mb1[i].date.ToString());
            }
            MemoryStream ms = new MemoryStream();

            book.Write(ms);
            ms.Seek(0, SeekOrigin.Begin);
            return(File(ms, "application/vnd.ms-excel", "code.xls"));

            //  return View();
        }