示例#1
0
        private bool AddDateElement(DataElementEntity dataElement, ref string message)
        {
            bool validateResult = ValidateDateElement(dataElement.ElementId);

            if (!validateResult)
            {
                message = "数据元ID存在,请重新输入";
                return(false);
            }
            else
            {
                SqlParameter[] sqlParams = new SqlParameter[] {
                    new SqlParameter("@ElementFlow", SqlDbType.VarChar, 50),
                    new SqlParameter("@ElementId", SqlDbType.VarChar, 50),
                    new SqlParameter("@ElementName", SqlDbType.VarChar, 50),
                    new SqlParameter("@ElementType", SqlDbType.VarChar, 50),
                    new SqlParameter("@ElementForm", SqlDbType.VarChar, 50),
                    new SqlParameter("@ElementRange", SqlDbType.VarChar, 50),
                    new SqlParameter("@ElementDescribe", SqlDbType.VarChar, 50),
                    new SqlParameter("@ElementClass", SqlDbType.VarChar, 50),
                    new SqlParameter("@IsDataElemet", SqlDbType.VarChar, 50),
                    new SqlParameter("@ElementPYM", SqlDbType.VarChar, 50)
                };

                dataElement.ElementFlow = Guid.NewGuid().ToString();
                dataElement.Valid       = "1";
                dataElement.ElementPYM  = StringCommon.GetChineseSpell(dataElement.ElementName);
                if (dataElement.ElementPYM == null || dataElement.ElementPYM == "")
                {
                    dataElement.ElementPYM = dataElement.ElementName;
                }
                sqlParams[0].Value = dataElement.ElementFlow;
                sqlParams[1].Value = dataElement.ElementId;
                sqlParams[2].Value = dataElement.ElementName;
                sqlParams[3].Value = dataElement.ElementType;
                sqlParams[4].Value = dataElement.ElementForm;
                sqlParams[5].Value = dataElement.ElementRange;
                sqlParams[6].Value = dataElement.ElementDescribe;
                sqlParams[7].Value = dataElement.ElementClass;
                sqlParams[8].Value = dataElement.IsDataElemet;
                sqlParams[9].Value = dataElement.ElementPYM;
                try
                {
                    m_app.SqlHelper.ExecuteNoneQuery("EMR_CommonNote.usp_InsertElement", sqlParams, CommandType.StoredProcedure);
                }
                catch (Exception ex)
                {
                    message = ex.Message;
                    return(false);
                }
                return(true);
            }
        }