public string[] getMessage() { string[] result = { "", "" }; string result_head = "药品清单:\n\n"; double money = 0; for (int i = 0; i < Orders.Count; i++) { Drug drug = Orders[i]; //string item= string.Format("{0}、 {1} \t数量 {2} \t\t单价 {3} 元\n\n", i + 1, drug.Name, (double)num[i], drug.R_price); string item = string.Format("{0}{1}{2}{3}\n\n", padRightEx(i + 1 + "、", 5), padRightEx(drug.Name, 30), padRightEx("数量 X" + num[i].ToString(), 10), padRightEx("单价 " + drug.R_price.ToString(), 10)); result_head += item; money += drug.R_price * (double)num[i]; //统计 insertOrder(drug, (double)num[i]); } result[0] = result_head; result[1] = money.ToString(); return(result); }
/// <summary> /// 添加药品 /// </summary> /// <param name="drug"></param> public void add(Drug drug) { Orders.Add(drug); }