Example #1
0
        void btnOK_MouseClick(object sender, MouseEventArgs e)
        {
            CiOrdSheet[] sheets = xapFormControl1.GetSelected <CiOrdSheet>("sheetItem");

            sheets.ToList().ForEach(p => sheetList.Add(p));
            model.Save(sheetList.ToArray());//把数据保存到数据库
        }
        /// <summary>
        /// 保存重整打印医嘱
        /// </summary>
        /// <param name="ordPrintDOs">重整后的医嘱OrdPrintDO集合</param>
        /// <returns></returns>
        public OrdPrintDO[] SaveResretOrdPrintDO(OrdPrintDO[] ordPrintDOs)
        {
            List <object> args = new List <object>();

            args.Add(ordPrintDOs[0].Id_en);
            args.Add((FBoolean)ordPrintDOs[0].Fg_long);
            args.Add(ordPrintDOs[0].Page_num);
            StringBuilder builder = new StringBuilder();

            builder.Append("Id_en = '{0}' and Fg_long = '{1}' and Page_num < {2} and Fg_reformed = 'N'");
            //builder.Append("Id_en = '{0}' and Fg_long = '{1}' and Fg_reformed = 'N'");

            string condition = string.Format(builder.ToString(), args.ToArray());

            string orderBy = "Page_num,Row_num";

            //查询重整第一页之前的已打印医嘱
            OrdPrintDO[]             ordPrintDOsUpdate = ordPrintService.find(condition, orderBy, FBoolean.False);
            XapDataList <OrdPrintDO> lstPrintDOsUpdate = new XapDataList <OrdPrintDO>();

            for (int i = 0; i < ordPrintDOsUpdate.Length; i++)
            {
                ordPrintDOsUpdate[i].Fg_reformed = FBoolean.True;
                ordPrintDOsUpdate[i].Dt_reform   = ordPrintDOs[0].Dt_reform != null ? ordPrintDOs[0].Dt_reform : DateTime.Now;
                ordPrintDOsUpdate[i].Status      = DOStatus.UPDATED;
                lstPrintDOsUpdate.Add(ordPrintDOsUpdate[i]);
            }

            ordPrintService.update(lstPrintDOsUpdate.ToArray());

            return(ordPrintService.save(ordPrintDOs));
        }