/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.HeadPortrait Models) { string sqlStr = " insert into [MS_HeadPortrait](TITLE,FILE_URL,STATE,LAST_CHANGE_TIME,LAST_CHANGE_IP,LAST_CHANGE_GUID) values(@TITLE,@FILE_URL,@STATE,@LAST_CHANGE_TIME,@LAST_CHANGE_IP,@LAST_CHANGE_GUID);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }
/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.ProjectList Models) { string sqlStr = " insert into [MS_ProjectList](CREATE_GUID,PROJECT_ID,SYNOPSIS,EXPLAIN,SORT,CLASS_ID,STATE,LAST_CHANGE_TIME,LAST_CHANGE_IP,LAST_CHANGE_GUID) values(@CREATE_GUID,@PROJECT_ID,@SYNOPSIS,@EXPLAIN,@SORT,@CLASS_ID,@STATE,@LAST_CHANGE_TIME,@LAST_CHANGE_IP,@LAST_CHANGE_GUID);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }
/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.TouchMsg Models) { string sqlStr = " insert into [MS_TouchMsg](USER_EMAIL,MSG,STATE,LAST_CHANGE_TIME,LAST_CHANGE_IP) values(@USER_EMAIL,@MSG,@STATE,@LAST_CHANGE_TIME,@LAST_CHANGE_IP);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }
/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.BigClass Models) { string sqlStr = " insert into [MS_BigClass](CREATE_GUID,CLASS_NAME,CLASS_CODE,SORT,LAST_CHANGE_TIME,LAST_CHANGE_IP,LAST_CHANGE_GUID,STATE) values(@CREATE_GUID,@CLASS_NAME,@CLASS_CODE,@SORT,@LAST_CHANGE_TIME,@LAST_CHANGE_IP,@LAST_CHANGE_GUID,@STATE);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }
/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.LoginLog Models) { string sqlStr = " insert into [MS_LoginLog](LOGIN_ID,LOGIN_PWD,GUID,IP_ADDRESS,CITY,SUCCESS,STATE) values(@LOGIN_ID,@LOGIN_PWD,@GUID,@IP_ADDRESS,@CITY,@SUCCESS,@STATE);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }
/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.ProjectDetail Models) { string sqlStr = " insert into [MS_ProjectDetail](CREATE_GUID,TITLE,CONTENT,PROJECT_URL,DEMO_URL,STATE,LAST_CHANGE_TIME,LAST_CHANGE_IP,LAST_CHANGE_GUID) values(@CREATE_GUID,@TITLE,@CONTENT,@PROJECT_URL,@DEMO_URL,@STATE,@LAST_CHANGE_TIME,@LAST_CHANGE_IP,@LAST_CHANGE_GUID);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }
/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.ArticeList Models) { string sqlStr = " insert into [MS_ArticeList](CREATE_GUID,ARTICE_ID,SORT,CLASS_ID,LABEL_ID,STATE,LAST_CHANGE_TIME,LAST_CHANGE_IP,LAST_CHANGE_GUID) values(@CREATE_GUID,@ARTICE_ID,@SORT,@CLASS_ID,@LABEL_ID,@STATE,@LAST_CHANGE_TIME,@LAST_CHANGE_IP,@LAST_CHANGE_GUID);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }
/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.NAVS Models) { string sqlStr = " insert into [MS_NAVS](CREATE_GUID,TITLE,URL,POWER,CLASS_ID,TYPE,STATE,LAST_CHANGE_TIME,LAST_CHANGE_IP,LAST_CHANGE_GUID) values(@CREATE_GUID,@TITLE,@URL,@POWER,@CLASS_ID,@TYPE,@STATE,@LAST_CHANGE_TIME,@LAST_CHANGE_IP,@LAST_CHANGE_GUID);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }
/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.DynamicPicture Models) { string sqlStr = " insert into [MS_DynamicPicture](CREATE_GUID,STATE,LAST_CHANGE_TIME,LAST_CHANGE_IP,LAST_CHANGE_GUID) values(@CREATE_GUID,@STATE,@LAST_CHANGE_TIME,@LAST_CHANGE_IP,@LAST_CHANGE_GUID);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }
/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.VisitLog Models) { string sqlStr = " insert into [MS_VisitLog](ENTRY_URL,VISIT_IP,VISIT_CITY,SESSION_GUID,STATE) values(@ENTRY_URL,@VISIT_IP,@VISIT_CITY,@SESSION_GUID,@STATE);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }
/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.ReaderLog Models) { string sqlStr = " insert into [MS_ReaderLog](ENTRY_URL,ARTICE_ID,PROJECT_ID,VISIT_IP,VISIT_CITY,SESSION_GUID,STATE,OUT_TIME) values(@ENTRY_URL,@ARTICE_ID,@PROJECT_ID,@VISIT_IP,@VISIT_CITY,@SESSION_GUID,@STATE,@OUT_TIME);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }
/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.NAV Models) { string sqlStr = " insert into [MS_NAV](TITLE,URL,POWER,CLASS,TYPE,STATE,BACKUP1) values(@TITLE,@URL,@POWER,@CLASS,@TYPE,@STATE,@BACKUP1);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }
/// <summary> ///根据id取得数据模型(返)一个Models) /// </summary> public Models.NAV GetModels(int id) { string sqlStr = " select top 1 * from [MS_NAV] where id = @id "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <Models.NAV>(sqlStr, new{ id = id }).SingleOrDefault()); } }
/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.OperationLog Models) { string sqlStr = " insert into [MS_OperationLog](GUID,IP_ADDRESS,CITY,OPERATION_URL,PARAM_STRING,RESULT_STRING,STATE) values(@GUID,@IP_ADDRESS,@CITY,@OPERATION_URL,@PARAM_STRING,@RESULT_STRING,@STATE);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }
/// <summary> /// 取所有数据的数量 /// </summary> public int GetCount() { string sqlStr = " select count(*) from [MS_NAV] "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr).SingleOrDefault()); } }
/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.SelfSign Models) { string sqlStr = " insert into [MS_SelfSign](CREATE_GUID,CONTENT,CLASS_ID,STATE,LAST_CHANGE_TIME,LAST_CHANGE_IP,LAST_CHANGE_GUID) values(@CREATE_GUID,@CONTENT,@CLASS_ID,@STATE,@LAST_CHANGE_TIME,@LAST_CHANGE_IP,@LAST_CHANGE_GUID);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }
/// <summary> /// 按条件取所有数据的数量 /// </summary> public int GetCount(string cond) { string sqlStr = " select count(*) from [MS_NAV] where state not in (2) "; if (!string.IsNullOrEmpty(cond)) { sqlStr += " and " + cond; } using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr).SingleOrDefault()); } }
/// <summary> ///按条件取多个字段的列表(返)一个List<Models>) /// </summary> public List <Models.NAV> GetListFields(string fields, string cond) { string sqlStr = " select " + fields + " from [MS_NAV] where state not in (2) "; if (!string.IsNullOrEmpty(cond)) { sqlStr += " and " + cond; } using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <Models.NAV>(sqlStr).AsList()); } }
/// <summary> ///按条件取一个字段的值(返)一个string) /// </summary> public string GetOneField(string field, string cond) { string sqlStr = " select top 1 " + field + " from [MS_NAV] where state not in (2) "; if (!string.IsNullOrEmpty(cond)) { sqlStr += " and " + cond; } using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <string>(sqlStr).SingleOrDefault()); } }
/// <summary> ///根据条件取得数据模型(返)一个Models) /// </summary> public Models.NAV GetModels(string cond) { string sqlStr = " select top 1 * from [MS_NAV] where state not in (2) "; if (!string.IsNullOrEmpty(cond)) { sqlStr += " and " + cond; } using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <Models.NAV>(sqlStr).SingleOrDefault()); } }
/// <summary> ///按条件取一个字段的列表(返)一个List<string>) /// </summary> public List <string> GetListField(string field, string cond) { string sqlStr = " select " + field + " from [MS_SelfSign] where state not in (2) "; if (!string.IsNullOrEmpty(cond)) { sqlStr += " and " + cond; } using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <string>(sqlStr).AsList()); } }
/// <summary> ///按条件取多个字段的值(返)一个Models) /// </summary> public Models.SelfSign GetFields(string fields, string cond) { string sqlStr = " select top 1 " + fields + " from [MS_SelfSign] where state not in (2) "; if (!string.IsNullOrEmpty(cond)) { sqlStr += " and " + cond; } using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <Models.SelfSign>(sqlStr).SingleOrDefault()); } }
/// <summary> ///按条件取得模型列表(返)一个List<Models>) /// </summary> public List <Models.SelfSign> GetListModels(string cond) { string sqlStr = " select * from [MS_SelfSign] where state not in (2) "; if (!string.IsNullOrEmpty(cond)) { sqlStr += " and " + cond; } using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <Models.SelfSign>(sqlStr).AsList()); } }