public bool insertNewMedicine(MedicineDTO medicine)
        {
            try
            {
                Db.Ado.BeginTran();
                MEDICINE_INFORMATION medicineInformation = new MEDICINE_INFORMATION()
                {
                    MEDICINE_ID            = medicine._medicine_id,
                    MEDICINE_APPLICABILITY = medicine._medicine_applicability,
                    MEDICINE_CHARACTER     = medicine._medicine_character,
                    MEDICINE_ATTENTION     = medicine._medicine_attention,
                    MEDICINE_NAME          = medicine._medicine_name,
                    MEDICINE_TYPE          = medicine._medicine_type,
                    MEDICINE_INGREDIENTS   = medicine._medicine_ingredients,
                    MEDICINE_USAGE         = medicine._medicine_usage,
                    SUPPLIER_ID            = medicine._supplier_id,
                    MEDICINE_IMAGE         = medicine._medicine_image
                };

                bool judge = Db.Queryable <MEDICINE_INFORMATION>().Where(it => it.MEDICINE_ID == medicine._medicine_id).Any();
                if (!judge)
                {
                    Db.Insertable(medicineInformation).ExecuteCommand();
                }

                Db.Ado.CommitTran();
                return(true);
            }
            catch (Exception ex)
            {
                Db.Ado.RollbackTran();
                return(false);
            }
        }
        public bool updateMedicineInfo(MedicineDTO medicineDTO)
        {
            try
            {
                Db.Ado.BeginTran();
                MEDICINE_INFORMATION medicineInformation = new MEDICINE_INFORMATION()
                {
                    MEDICINE_ID            = medicineDTO._medicine_id,
                    MEDICINE_APPLICABILITY = medicineDTO._medicine_applicability,
                    MEDICINE_CHARACTER     = medicineDTO._medicine_character,
                    MEDICINE_ATTENTION     = medicineDTO._medicine_attention,
                    MEDICINE_NAME          = medicineDTO._medicine_name,
                    MEDICINE_TYPE          = medicineDTO._medicine_type,
                    MEDICINE_INGREDIENTS   = medicineDTO._medicine_ingredients,
                    MEDICINE_USAGE         = medicineDTO._medicine_usage,
                    SUPPLIER_ID            = medicineDTO._supplier_id,
                    MEDICINE_IMAGE         = medicineDTO._medicine_image
                };

                Db.Updateable(medicineInformation).ExecuteCommand();

                Db.Ado.CommitTran();
                return(true);
            }
            catch (Exception ex)
            {
                Db.Ado.RollbackTran();
                return(false);
            }
        }
        //获取所有药品的销售记录
        public List <MedicineSaleDataDTO> getAllMedicineSaleData()
        {
            List <MedicineSaleDataDTO> group = Db.Queryable <SALE_RECORD_ITEM, MEDICINE_INFORMATION>(
                (s, mi) => s.MEDICINE_ID == mi.MEDICINE_ID).GroupBy((s, mi) => mi.MEDICINE_ID)
                                               .Select((s, mi) => new MedicineSaleDataDTO
            {
                _medicine_id = mi.MEDICINE_ID,
                _sale_num    = SqlFunc.AggregateSum(s.SALE_NUM)
            }).ToList();

            foreach (MedicineSaleDataDTO temp in group)
            {
                MEDICINE_INFORMATION s = Db.Queryable <MEDICINE_INFORMATION>().InSingle(temp._medicine_id);
                int amount             = Db.Queryable <MEDICINE_STOCK>().Where(it => it.MEDICINE_ID == temp._medicine_id).Sum(it => it.AMOUNT);
                temp._medicine_name = s.MEDICINE_NAME;
                temp._amount        = amount;
            }
            group.Sort();
            return(group);
        }