Пример #1
0
        /// <summary>
        /// Insert Or Update 表单信息
        /// </summary>
        /// <param name="nsf">护理表单</param>
        /// <param name="nsfv">护理表单版本</param>
        /// <param name="nsff">护理表单版本文件</param>
        /// <returns></returns>
        public int NursingFormInsertOrUpdate(Form nsf, FormFile nsff)
        {
            string ids = nsf.ID;

            if (string.IsNullOrEmpty(ids))
            {
                ///insert
                string id = Utils.getGUID();
                nsf.ID      = id;
                nsff.FormID = id;
                IList <DBState> dblist = new List <DBState>();
                dblist.Add(new DBState
                {
                    Name  = nsf.MAP_INSERT,
                    Param = nsf.ToDict(),
                    Type  = ESqlType.INSERT
                });
                dblist.Add(new DBState
                {
                    Name  = nsff.MAP_INSERT,
                    Param = nsff.ToDict(),
                    Type  = ESqlType.INSERT
                });
                return(DB.Execute(dblist));
            }
            else
            {
                ///update
                IList <DBState> dblist = new List <DBState>();
                dblist.Add(new DBState
                {
                    Name  = "UPDATE_Form",
                    Param = nsf.ToDict(),
                    Type  = ESqlType.UPDATE
                });
                dblist.Add(new DBState
                {
                    Name  = "UPDATE_FormFile",
                    Param = nsff.ToDict(),
                    Type  = ESqlType.UPDATE
                });
                return(DB.Execute(dblist));
            }
        }