/// <summary>
        /// 增加一条数据
        /// </summary>
        /// <param name="model">model</param>
        public int AddRecord(BSendNotesListData model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("set nocount on; ");
            strSql.Append("insert into BSendNotesList(");
            strSql.Append(@"sendEmpId,sendEmpNo,sendEmpNm,acceptMobileGroupId,acceptEmp,mobile,tranDt,sendState,sendResult,noteContent,
                            noteType)");
            strSql.Append(" values (");
            strSql.Append(@"@sendEmpId,@sendEmpNo,@sendEmpNm,@acceptMobileGroupId,@acceptEmp,@mobile,@tranDt,@sendState,@sendResult,@noteContent,
                            @noteType)");
            strSql.Append("; select @@identity; set nocount off; ");
            SqlParameter[] parameters = {
                    new SqlParameter("@sendEmpId", SqlDbType.Int),
                    new SqlParameter("@sendEmpNo", SqlDbType.NVarChar,20),
                    new SqlParameter("@sendEmpNm", SqlDbType.NVarChar,20),
                    new SqlParameter("@acceptMobileGroupId", SqlDbType.Int),
                    new SqlParameter("@acceptEmp", SqlDbType.NVarChar,20),
                    new SqlParameter("@mobile", SqlDbType.NVarChar,20),
                    new SqlParameter("@tranDt", SqlDbType.DateTime),
                    new SqlParameter("@sendState", SqlDbType.VarChar,2),
                    new SqlParameter("@sendResult", SqlDbType.VarChar,50),
                    new SqlParameter("@noteContent", SqlDbType.NVarChar,500),
                    new SqlParameter("@noteType", SqlDbType.TinyInt)
                };
            parameters[0].Value = model.sendEmpId;
            parameters[1].Value = model.sendEmpNo;
            parameters[2].Value = model.sendEmpNm;
            parameters[3].Value = model.acceptMobileGroupId;
            parameters[4].Value = model.acceptEmp;
            parameters[5].Value = model.mobile;
            parameters[6].Value = model.tranDt == string.Empty ? null : model.tranDt;
            parameters[7].Value = model.sendState;
            parameters[8].Value = model.sendResult;
            parameters[9].Value = model.noteContent;
            parameters[10].Value = model.noteType;

            int id = 0;
            try
            {
                object ret = SqlHelper.ExecuteScalar(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);

                if (ret != null && ret != DBNull.Value)
                {
                    id = Convert.ToInt32(ret);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return id;
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="model">model</param>
        public bool ModifyRecord(BSendNotesListData model)
        {
            bool ret = false;
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update BSendNotesList set ");
            strSql.Append("sendEmpId=@sendEmpId,");
            strSql.Append("sendEmpNo=@sendEmpNo,");
            strSql.Append("sendEmpNm=@sendEmpNm,");
            strSql.Append("acceptMobileGroupId=@acceptMobileGroupId,");
            strSql.Append("acceptEmp=@acceptEmp,");
            strSql.Append("mobile=@mobile,");
            strSql.Append("tranDt=@tranDt,");
            strSql.Append("sendState=@sendState,");
            strSql.Append("sendResult=@sendResult,");
            strSql.Append("noteContent=@noteContent,");
            strSql.Append("noteType=@noteType");
            strSql.Append(" where id = @id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int),
                    new SqlParameter("@sendEmpId", SqlDbType.Int),
                    new SqlParameter("@sendEmpNo", SqlDbType.NVarChar,20),
                    new SqlParameter("@sendEmpNm", SqlDbType.NVarChar,20),
                    new SqlParameter("@acceptMobileGroupId", SqlDbType.Int),
                    new SqlParameter("@acceptEmp", SqlDbType.NVarChar,20),
                    new SqlParameter("@mobile", SqlDbType.NVarChar,20),
                    new SqlParameter("@tranDt", SqlDbType.DateTime),
                    new SqlParameter("@sendState", SqlDbType.VarChar,2),
                    new SqlParameter("@sendResult", SqlDbType.VarChar,50),
                    new SqlParameter("@noteContent", SqlDbType.NVarChar,500),
                    new SqlParameter("@noteType", SqlDbType.TinyInt)
                };
            parameters[0].Value = model.id;
            parameters[1].Value = model.sendEmpId;
            parameters[2].Value = model.sendEmpNo;
            parameters[3].Value = model.sendEmpNm;
            parameters[4].Value = model.acceptMobileGroupId;
            parameters[5].Value = model.acceptEmp;
            parameters[6].Value = model.mobile;
            parameters[7].Value = model.tranDt == string.Empty ? null : model.tranDt;
            parameters[8].Value = model.sendState;
            parameters[9].Value = model.sendResult;
            parameters[10].Value = model.noteContent;
            parameters[11].Value = model.noteType;

            try
            {
                SqlHelper.ExecuteNonQuery(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);
                ret = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return ret;
        }
        /// <summary>
        /// 得到一个model
        /// </summary>
        /// <param name="id">主键值</param>
        /// <returns>model</returns>
        public BSendNotesListData GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(@"select id,sendEmpId,sendEmpNo,sendEmpNm,acceptMobileGroupId,acceptEmp,mobile,tranDt,sendState,sendResult,noteContent,
                            noteType from BSendNotesList");
            strSql.Append(" where id = @id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int)
                };
            parameters[0].Value = id;

            BSendNotesListData model = new BSendNotesListData();
            DataSet ds = SqlHelper.ExecuteDataset(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow row = ds.Tables[0].Rows[0];
                if (row["id"] != DBNull.Value)
                {
                    model.id = Convert.ToInt32(row["id"]);
                }
                if (row["sendEmpId"] != DBNull.Value)
                {
                    model.sendEmpId = Convert.ToInt32(row["sendEmpId"]);
                }
                if (row["sendEmpNo"] != DBNull.Value)
                {
                    model.sendEmpNo = Convert.ToString(row["sendEmpNo"]);
                }
                if (row["sendEmpNm"] != DBNull.Value)
                {
                    model.sendEmpNm = Convert.ToString(row["sendEmpNm"]);
                }
                if (row["acceptMobileGroupId"] != DBNull.Value)
                {
                    model.acceptMobileGroupId = Convert.ToInt32(row["acceptMobileGroupId"]);
                }
                if (row["acceptEmp"] != DBNull.Value)
                {
                    model.acceptEmp = Convert.ToString(row["acceptEmp"]);
                }
                if (row["mobile"] != DBNull.Value)
                {
                    model.mobile = Convert.ToString(row["mobile"]);
                }
                if (row["tranDt"] != DBNull.Value)
                {
                    model.tranDt = Convert.ToString(row["tranDt"]);
                }
                if (row["sendState"] != DBNull.Value)
                {
                    model.sendState = Convert.ToString(row["sendState"]);
                }
                if (row["sendResult"] != DBNull.Value)
                {
                    model.sendResult = Convert.ToString(row["sendResult"]);
                }
                if (row["noteContent"] != DBNull.Value)
                {
                    model.noteContent = Convert.ToString(row["noteContent"]);
                }
                if (row["noteType"] != DBNull.Value)
                {
                    model.noteType = Convert.ToByte(row["noteType"]);
                }
                return model;
            }
            else
            {
                return null;
            }
        }
        /// <summary>
        /// 更新一条""信息
        /// </summary>
        /// <param name="model">model</param>
        public bool ModifyRecord(BSendNotesListData model)
        {
            bool ret = false;
            SqlTransaction trans = null;
            try
            {
                if (this.transaction == null)
                {
                    trans = this.connection.BeginTransaction("TransModify");
                    this.sendNotesListBB.Transaction = trans;
                    this.errorDiaryBB.Transaction = trans;
                    this.operatDiaryBB.Transaction = trans;
                    this.commBB.Transaction = trans;
                }

                this.sendNotesListBB.ModifyRecord(model);

                SOperatDiaryData operatDiaryData = new SOperatDiaryData();
                operatDiaryData.empId = this.empId;
                operatDiaryData.functionId = "";
                operatDiaryData.recordId = model.id.ToString();
                operatDiaryData.operateContent = "修改一条id为“" + model.id.ToString() + "”的记录";
                this.operatDiaryBB.AddRecord(operatDiaryData);

                if (this.transaction == null) trans.Commit();
                ret = true;
            }
            catch (Exception ex)
            {
                if (this.transaction == null) trans.Rollback("TransModify");
                SErrorDiaryData errorDiaryData = new SErrorDiaryData();
                errorDiaryData.empId = this.empId;
                errorDiaryData.functionId = "";
                errorDiaryData.errorText = "修改记录“" + model.id.ToString() + "”时报错:" + ex.Message;
                this.errorDiaryBB.AddRecord(errorDiaryData);
                throw ex;
            }
            finally
            {
            }
            return ret;
        }
        /// <summary>
        /// 增加一条""信息
        /// </summary>
        /// <param name="model">model</param>
        public int AddRecord(BSendNotesListData model)
        {
            int id = 0;
            SqlTransaction trans = null;
            try
            {
                if (this.transaction == null)
                {
                    trans = this.connection.BeginTransaction("TransAdd");
                    this.sendNotesListBB.Transaction = trans;
                    this.errorDiaryBB.Transaction = trans;
                    this.operatDiaryBB.Transaction = trans;
                    this.commBB.Transaction = trans;
                }

                id = this.sendNotesListBB.AddRecord(model);

                SOperatDiaryData operatDiaryData = new SOperatDiaryData();
                operatDiaryData.empId = this.empId;
                operatDiaryData.functionId = "";
                operatDiaryData.recordId = id.ToString();
                operatDiaryData.operateContent = "增加一条id为“" + id.ToString() + "”的记录";
                this.operatDiaryBB.AddRecord(operatDiaryData);

                if (this.transaction == null) trans.Commit();
            }
            catch (Exception ex)
            {
                if (this.transaction == null) trans.Rollback("TransAdd");
                SErrorDiaryData errorDiaryData = new SErrorDiaryData();
                errorDiaryData.empId = this.empId;
                errorDiaryData.functionId = "";
                errorDiaryData.errorText = "增加记录时报错:" + ex.Message;
                this.errorDiaryBB.AddRecord(errorDiaryData);
                throw ex;
            }
            finally
            {
            }
            return id;
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">model</param>
 public bool ModifyRecord(BSendNotesListData model)
 {
     return this.sendNotesListDB.ModifyRecord(model);
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="model">model</param>
 public int AddRecord(BSendNotesListData model)
 {
     return this.sendNotesListDB.AddRecord(model);
 }