public ActionResult Create(BillPropertyModels billPropertyModels)
        {
            if (ModelState.IsValid)
            {
                switch (billPropertyModels.CodeMethod)
                {
                    case CodeMethod.Two:
                        billPropertyModels.Year = 4;
                        billPropertyModels.Month = 2;
                        billPropertyModels.Day = 0;
                        billPropertyModels.SerialNumber = 4;
                        break;
                    case CodeMethod.Three:
                        billPropertyModels.Year = 0;
                        billPropertyModels.Month = 0;
                        billPropertyModels.Day = 0;
                        billPropertyModels.SerialNumber = this.GetSerialNumbers(billPropertyModels.Code);
                        break;
                    case CodeMethod.Four:
                        billPropertyModels.Year = 0;
                        billPropertyModels.Month = 0;
                        billPropertyModels.Day = 0;
                        billPropertyModels.SerialNumber = 0;
                        break;
                    default:
                        billPropertyModels.Year = 4;
                        billPropertyModels.Month = 2;
                        billPropertyModels.Day = 2;
                        billPropertyModels.SerialNumber = 2;
                        break;
                }
                //获取单据的编号值
                BillSort tmpBillSort = db.BillSorts.Find(billPropertyModels.BillSort);
                string num = tmpBillSort.SerialNumber.ToString();
                if (num.Length == 1)
                    num = num.Insert(0, "0");
                //更新BillSort表中某一类型单据可用的最大编号值
                tmpBillSort.SerialNumber += 2;
                db.Entry(tmpBillSort).State = EntityState.Modified;

                //拼凑出真实的单据性质编号(单据的类型编号+单据的可用最大编号值)
                billPropertyModels.Type = billPropertyModels.BillSort + num;

                db.BillProperties.Add(billPropertyModels);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(billPropertyModels);
        }
        public ActionResult Create(BillPropertyModels billPropertyModels)
        {
            if (ModelState.IsValid)
            {
                switch (billPropertyModels.CodeMethod)
                {
                    case CodeMethod.Two:
                        billPropertyModels.Year = 4;
                        billPropertyModels.Month = 2;
                        billPropertyModels.Day = 0;
                        billPropertyModels.SerialNumber = 4;
                        break;
                    case CodeMethod.Three:
                        billPropertyModels.Year = 0;
                        billPropertyModels.Month = 0;
                        billPropertyModels.Day = 0;
                        billPropertyModels.SerialNumber = this.GetSerialNumbers(billPropertyModels.Code);
                        break;
                    case CodeMethod.Four:
                        billPropertyModels.Year = 0;
                        billPropertyModels.Month = 0;
                        billPropertyModels.Day = 0;
                        billPropertyModels.SerialNumber = 0;
                        break;
                    default:
                        billPropertyModels.Year = 4;
                        billPropertyModels.Month = 2;
                        billPropertyModels.Day = 2;
                        billPropertyModels.SerialNumber = 2;
                        break;
                }
                db.BillProperties.Add(billPropertyModels);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(billPropertyModels);
        }