Esempio n. 1
0
        public int UpdateAll(examTable entity, string updateFields = null)
        {
            if (updateFields == null)
            {
                updateFields = "[school_id]=@school_id,[schoolyear_nowyear]=@schoolyear_nowyear,[schoolyear_mester]=@schoolyear_mester,[grade_section]=@grade_section,[exam_name]=@exam_name,[exam_time]=@exam_time,[exam_level]=@exam_level";
            }
            else
            {
                updateFields = StringHelper.SqlUpdateFields(updateFields);
            }
            string sql = "UPDATE [exam] SET " + updateFields;

            return(SqlDapperHelper.Execute(sql, entity));
        }
Esempio n. 2
0
        public int UpdateFieldsByWhere(examTable entity, string whereFields, string updateFields = null)
        {
            if (updateFields == null)
            {
                updateFields = "[school_id]=@school_id,[schoolyear_nowyear]=@schoolyear_nowyear,[schoolyear_mester]=@schoolyear_mester,[grade_section]=@grade_section,[exam_name]=@exam_name,[exam_time]=@exam_time,[exam_level]=@exam_level";
            }
            else
            {
                updateFields = StringHelper.SqlUpdateFields(updateFields);
            }
            string where = "WHERE " + StringHelper.SqlWhereFields(whereFields);
            string sql = string.Format("UPDATE [exam] SET {0} " + where, updateFields);

            return(SqlDapperHelper.Execute(sql, entity));
        }
Esempio n. 3
0
        public int InsertIdentity(examTable entity)
        {
            string sql = "SET IDENTITY_INSERT [exam] ON;INSERT INTO [exam] ([id],[school_id],[schoolyear_nowyear],[schoolyear_mester],[grade_section],[exam_name],[exam_time],[exam_level]) VALUES (@id,@school_id,@schoolyear_nowyear,@schoolyear_mester,@grade_section,@exam_name,@exam_time,@exam_level);SET IDENTITY_INSERT [exam] OFF";

            return(SqlDapperHelper.Execute(sql, entity));
        }
Esempio n. 4
0
        public long Insert(examTable entity)
        {
            string sql = "INSERT INTO [exam] ([school_id],[schoolyear_nowyear],[schoolyear_mester],[grade_section],[exam_name],[exam_time],[exam_level]) VALUES (@school_id,@schoolyear_nowyear,@schoolyear_mester,@grade_section,@exam_name,@exam_time,@exam_level);SELECT @@IDENTITY";

            return(SqlDapperHelper.ExecuteScalar <long>(sql, entity));
        }