public int Add(Station model) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("insert into GpsStation("); stringBuilder.Append("RegionDot,RegionName,RegionType,StationType)"); stringBuilder.Append(" values ("); stringBuilder.Append("@RegionDot,@RegionName,@RegionType,@StationType)"); stringBuilder.Append(";select @@IDENTITY"); string str = stringBuilder.ToString(); List<SqlParam> sqlParams = new List<SqlParam>(); SqlParam sqlParam = new SqlParam() { name = "RegionDot", @value = model.RegionDot }; sqlParams.Add(sqlParam); SqlParam sqlParam1 = new SqlParam() { name = "RegionName", @value = model.RegionName }; sqlParams.Add(sqlParam1); SqlParam sqlParam2 = new SqlParam() { name = "RegionType", @value = model.RegionType }; sqlParams.Add(sqlParam2); SqlParam sqlParam3 = new SqlParam() { name = "StationType", @value = model.StationType }; sqlParams.Add(sqlParam3); DataTable dataTable = RemotingClient.ExecParamSqlByCompress(str, sqlParams); if (dataTable != null && dataTable.Rows.Count > 0) { return 1; } return 0; }
public bool Update(Station model) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("update GpsStation set "); stringBuilder.Append("RegionDot=@RegionDot,"); stringBuilder.Append("RegionName=@RegionName,"); stringBuilder.Append("RegionType=@RegionType,"); stringBuilder.Append("UpdateTime=@UpdateTime,"); stringBuilder.Append("StationType=@StationType"); stringBuilder.Append(" where ID=@ID"); string str = stringBuilder.ToString(); List<SqlParam> sqlParams = new List<SqlParam>(); SqlParam sqlParam = new SqlParam() { name = "RegionDot", @value = model.RegionDot }; sqlParams.Add(sqlParam); SqlParam sqlParam1 = new SqlParam() { name = "RegionName", @value = model.RegionName }; sqlParams.Add(sqlParam1); SqlParam sqlParam2 = new SqlParam() { name = "RegionType", @value = model.RegionType }; sqlParams.Add(sqlParam2); SqlParam sqlParam3 = new SqlParam() { name = "UpdateTime", @value = model.UpdateTime }; sqlParams.Add(sqlParam3); SqlParam sqlParam4 = new SqlParam() { name = "StationType", @value = model.StationType }; sqlParams.Add(sqlParam4); SqlParam sqlParam5 = new SqlParam() { name = "ID", @value = model.ID }; sqlParams.Add(sqlParam5); if (RemotingClient.ExecParamNoQuery(str, sqlParams).ResultCode == (long)0) { return true; } return false; }
public bool Delete(int ID) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("delete from GpsStation "); stringBuilder.Append(" where ID=@ID"); string str = stringBuilder.ToString(); List<SqlParam> sqlParams = new List<SqlParam>(); SqlParam sqlParam = new SqlParam() { name = "ID", @value = ID }; sqlParams.Add(sqlParam); if (RemotingClient.ExecParamNoQuery(str, sqlParams).ResultCode == (long)0) { return true; } return false; }